分享几道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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值