深圳易高科技有限公司面试题目





 







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: 


 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值