计算机等级考试参考答案(二级Visual Basic)
试题1~6 (每小题3分)
⑴ B ⑵ B ⑶ D ⑷ C ⑸ A ⑹ B ⑺ A ⑻ A
⑼ D ⑽ B ⑾ D ⑿ A ⒀ B ⒁ C ⒂ B ⒃ D
⒄ B ⒅ C ⒆ A ⒇ A (21)C (22)D (23)B (24) A
试题7 (每题14分)
Private Sub Command1_Click()
Dim s As Single, x As Single, t As Single
Dim i As Integer, n As Integer
x = InputBox("x=")
n = InputBox("n=")
s = x / 2: t = x / 2
For i = 3 To n + 1
t = t * x / i
s = s + t
Next i
Print s
End Sub
试题8 (每题14分)
Private Sub Form_Click()
Dim xh As String, zf As Integer
Dim x As String, k1 As Integer, k2 As Integer
Commondialog1.ShowOpen
Open Commondialog1.FileName For Input As #1
Do while Not Eof(1)
Input #1,x,k1,k2
If k1 + k2 > zf Then
zf = k1 + k2
xh = x
End If
Loop
Close #1
Label1(0).Caption = xh
Label1(1).Caption = zf
End Sub