分享几道VB.net笔试试题

下面是某公司招聘vb.net程序员的笔试题(部分),可以一起讨论哦!微笑

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 String) As 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

 

Question 2
 
Write a function that reverses the order of the words in a string. For instance, your function should transform the string “Do or do not, there is no try.” To “try. No is there not, do or Do”. Assume that all words are space delimited and treat punctuation the same as letters.
 
Use your most hands-on programming language.
 
 
Question 3
 
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
 

 

Question 4
 
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

你可能感兴趣的:(function,String,input,performance,VB.NET,combinations)