《VB程序设计》试卷一参考答案
一、选择题:
1. C 2. B 3. A 4. A 5. D
6. A 7. B 8. C 9. B 10. A
8 is Numeral Character
11. T 12. F 13. T 14.T 15. F
16. T 17. F 18. F 19.T 最强弃少 20. T
三、填空题:
21. Sqr(y^3+3*(a*a+b*b)/(x*x+y*y))
22. 200+Int(Rnd*100)
n = Val(InputBox("Please input a integer:"))
25. Picture1.move 200,100,picture1.width/sqr(2),picture1.height/sqr(2)
26. form1.scale (-200,250)-(300,-100)
27. form1.circle (15,15),10
28. Const PI!=3.14159或Const PI=3.14159
29. Command1.SetFocus
二、判断题:
四、程序阅读题:
Private Sub txtNo_LostFocus()
End Sub
? is Other Character
Dim sum As Single
A2=20 B2=10
33. 2
Print "s="; sum
9
五、程序填空题:
34. mn = m * n
35. m < n
36. n <> 0
23. False
38. strInput = txtInput.Text
39. Length = Len(RTrim(strInput))
40. strTemp = Mid(strInput, i, 1)
41. txtCode.Text = Code
37. r = m Mod n
六、综开编程:(仅供参考)
frmNotePad.Show
txtNo.MaxLength = 6
Dim x As Single
Dim n As Integer
32. A1=10 B1=20
x = Val(InputBox("Please input x Value:"))
Exit Sub
sum = s(n, x)
txtNo.SetFocus
End Sub
Function s(n As Integer, x As Single) As Single
End Function
s = 0
For i = 1 To n
t = 1
For j = 1 To 2 * i
t = t * j
Next j
s = s + x ^ (2 * i - 1) / t
End If
Dim i As Single, t As Long
2.编程2
在暗码窗口的属性窗口,对暗码文本框设置属性MultiLine为False.
Private Sub cmdOK_Click()
If txtPas.Text = "Pass" Then
30. lstBooks.AddItem “Visual biasic 程序设计”
1.编程1
frmPass.Hide
Else
MsgBox "暗码毛病!", vbExclamation + vbRetryCancel, "重输入暗码"
txtPas.Text = ""
txtPas.SetFocus
Next i
End Sub
Private Sub Form_Load()
txtPas.PasswordChar = "*"
Private Sub Form_Click()
End Sub
31. W is Alpha Character
24. x>=1 and x<12
For i = 1 To Len(txtNo.Text)
5
If Asc(s) < Asc("0") Or Asc(s) > Asc("9") Then
MsgBox "账号有非数字符号!", vbExclamation + vbRetryCancel, "l输入账号"
txtNo.Text = ""
s = Mid(txtNo.Text, i, 1)
Dim i As Integer, s As String * 1
End If
Next i
Load frmNotePad