zoukankan      html  css  js  c++  java
  • 深圳易高科技有限公司面试题目





     







    Recruitment Quiz

    Paper A






    Prepare By

    2GoTrade Ltd.

    Version: 
    1.0

    6 Jan 2006
     
    Please complete the following 
    8 questions within 2 hours.

    Question 
    1

    The VB 
    function, GetCurrencyCode demonstrates the translation between the currency code and currency number.  However, the performance of this function is not good enough; the higher order of input number takes much more times to calculate.  Please suggest a way to improve the program performance:

    Function GetCurrencyCode(ByVal input As StringAs String
    If input = "01" Then
    return = "AFA"
    ElseIf input = "02" Then
    return = "ALL"
    ElseIf input = "03" Then
    return = "DZD"
    ElseIf input = "04" Then
    return = "USD"
    ElseIf input = "05" Then
    return = "HKD"
    ElseIf input = "75" Then
    return = "EUR"
    ElseIf input = "76" Then
    return = "XCD"
    ElseIf input = "77" Then
    return = "AMD"
    End If
    End Function


    Answer: 
    Function GetCurrencyCode(ByVal input As StringAs String     Select Case input         Case "01":    
    return = "AFA"         Case "02":    
    return = "ALL"         Case "03":    
    return = "DZD"         Case "04":    
    return = "USD"         Case "05":    
    return = "HKD"
    Case "75":    
    return = "EUR"
    Case "76":    
    return = "XCD"
    Case "77":    
    return = "AMD"
    Case Else:    
    return = "unknown"     End Select End Function


     
    Question 
    2

    Write a function that reverses the order of the words in a stringFor instance, your function should transform the string “Do or do not, there is no try.” To “try. No is there notdo or Do”. Assume that all words are space delimited and treat punctuation the same as letters.

    Use your most hands
    -on programming language.

    Answer: 

    JavaScript Version:
    function ReversesOrder()
    {
        var OldStr 
    = "Do or do not, there is no try."
        var NewStr 
    = "";
        var ArrayStr 
    = OldStr.split(" ");

        
    for (var i = ArrayStr.length - 1 ;i >= 0 ; i--)
        {
            NewStr 
    += ArrayStr[i] + " ";
        }
        
    return NewStr;
    }  
    Question 
    3

    Study the following VB program:

    Imports System
    Imports System.IO
    Module Module1
    Public ArtList As ArrayList
    End Module


    Public Class Form1
    Inherits System.Windows.Forms.Form

    Windows Form Designer generated code

    <[Serializable]()> Public Class Art
    Public Title As String
    Public Des As String
    Public Value As Integer
    Public Price As Double
    Public Picture As String
    End Class


    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim myArt As New Object
    Dim hashtable As New Collections.Hashtable
    Dim key As String

    Try
    myArt 
    = New Art
    With myArt
    .Title 
    = "Title"
    .Des 
    = "Desc"
    .Value 
    = 123
    .Price 
    = 321.05
    End With
    key 
    = myArt.Title & myArt.Des & CStr(myArt.Value) & CStr(myArt.Price)
    hashtable.Add(key, myArt)
    ArtList.Add(myArt)

    Catch ex As Exception 'This is the line 94’
    MsgBox(ex.Message & vbCrLf & ex.StackTrace)
    End Try
    End Sub

    End Class

    A form 
    is created on which a button control is placed.  When the Button1_Click is fired, a message box is popup:

     

    What 
    is the problem and how to fix it?

    Answer: 

     
    Question 
    4

    In the following VB program, please states any potential problem(s) and how to correct.

    Private Sub btnCalc_Click( )
    Dim result As Integer
    Try
    Me.Cursor = Windows.Forms.Cursors.WaitCursor
    result 
    = Convert.ToInt32(txtInput1.Text) / Convert.ToInt32(txtInput2.Text)
    txtResult.Text 
    = result
    Me.Cursor = Windows.Forms.Cursors.Default
    Catch ex As Exception
    MsgBox(ex.StackTrace)
    Catch ex As ArgumentNullException
    MsgBox("Input Test box cannot be null.")
    Catch ex As OverflowException
    MsgBox("Input Test box 2 cannot be zero!")
    Catch ex As FormatException
    MsgBox("Input Test box should be numeric format!")
    End Try
    End Sub


    Answer: 

     
    Question 
    5

    GetRecordset() 
    is a VB function that returns a ADODB.Recordset object:

            Ref_ID    Qty    Price
    Row 
    0    00123    1000    60.50
    Row 
    1    00123    2000    60.00
    Row 
    2    00123    3500    59.50
    Row 
    3    00124    3000    60.50
    Row 
    4    00125    2000    59.50
    Row 
    5    00125    1000    58.00

     (This recordset 
    is sorted by Ref_ID)

    The following program 

    Dim rst as ADODB.Recordset
    Rst 
    = GetRecordset
    Do While Not rst.EOF
    Console.writeline(rst.Fields(
    "Ref_ID"& vbcrlf & rst.Fields("Qty"& vbcrlf & rst.Fields("Price"))
    rst.MoveNext()
    Loop

    Can generate the following output:

    Output:

    00123 1000 60.50
    00123 2000 60.00
    00123 3500 59.50
    00124 3000 60.50
    00125 2000 59.50
    00125 1000 58.00

    Please suggest how 
    to modify the above program to generate the following output:

    Output:
    00123 
    1000         60.50
    2000         60.00
    3500        59.50
    ----         -----
    6500        60.00
    00124 
    3000        60.50
    ----         -----
    3000         60.50
    00125 
    2000        59.50
    1000        58.00
    ----         -----
    3000        58.75


    Answer: 

    Dim rst as ADODB.Recordset
    Rst 
    = GetRecordset
    Do While Not rst.EOF
    Console.writeline(rst.Fields(
    "Ref_ID"& vbcrlf & rst.Fields("Qty"& vbcrlf & rst.Fields("Price"))
    rst.MoveNext()
    Loop
     
    Question 
    6

    Problem: Use your most hands
    -on programming language to implement a function that prints all possible combinations of the characters in a string. These combinations range in length from one to the length of the string. Two combinations that differ only in ordering of the characters ARE the same combination.  In other words, “12” and “31” are different combinations from the input string “123”, but “21 is the same as “12”.

    For example, if we use “wxyz” as parameter for Combination(“wxyz”) the function will print out

    w
    x
    y
    z
    wx
    wy
    wz
    xy
    xz
    yz
    wxy
    wxz
    wyz
    xyz
    wxyz

    Answer: 

     
    Question 
    7

    Module modFree
    clsShape


    clsTriangle

    Public Sub Main()
    Dim objTriangle As New clsTriangle
    Dim objShape As New clsShape

    objTriangle.Area 
    = -330
    objTriangle.Sides 
    = 5.5
    objTriangle.CalculateArea(
    10.02.5)

    objShape.Area 
    = 123
    objShape.Sides 
    = -2
    objShape 
    = CType(objShape, clsTriangle)

    Console.WriteLine(
    TypeOf objTriangle Is clsShape)
    Console.WriteLine(
    TypeOf objShape Is clsTriangle)
    Console.WriteLine(objTriangle.Area)
    End Sub

    End Module


    7.1 Please find the line of code from the procedure Main to cause run-time error.

    Answer: 

    7.2 Please write the result output from the procedure Main.

    Answer: 

     
    Question 
    8

    Consider the following account 
    and customer tables:

    cust_tbl
    cust_id    title    e_first_name    e_last_name    address1    .
    0    MR    Martin    Ma    .    
    1    MR    Kirs    Cheung    .    
    2    MR    Ricky    Chan    .    
    3    MR    Tom    Kwan    .    
    4    MR    Corporate Default    Corporate Default    .    
    5    MRS    Mary     Mok    .    
    .    .    .    .    .    

    acc_grp_cust_tbl
    acc_group    Cust_id1    Cust_id2    Cust_id3    Cust_id4
    1400    0    1    2    
    1500    3    4        
    1600    5            
    .    .    .    .    .
    .    .    .    .    .

    The acc_grp_cust_tbl table 
    is responsible to store the customer ID, and the cust_tbl table is responsible to store customer personal information such as name, address, etc… Please write a SQL query in order to provide following result.

    ACC_GROUP    PAYEENAMES
    1400    Ma Martin/Cheung Kris/Chan Ricky
    1500    Kwan Tom/Corporate Default Corporate Default
    1600    Mok Mary
    .    .
    .    .

    Answer: 


  • 相关阅读:
    一个使用 Python 的人工智能聊天机器人框架
    【TensorFlow 官网 可以直接访问】让中国开发者更容易地使用TensorFlow打造人工智能应用
    Object Relational Tutorial 对象关系教程
    Automap sqlalchemy.ext.automap 自动映射数据库表结构
    回溯法
    子集树和排列树
    平衡树
    二叉查找树
    graphviz使用
    linux进程内存布局
  • 原文地址:https://www.cnblogs.com/Dicky/p/461866.html
Copyright © 2011-2022 走看看