![]() |
|
(31) 单击命令按钮时,下列程序的执行结果是
Private Sub Command1_Click()
BT 4
End Sub
Private Sub BT(x As Integer)
x=x * 2 + 1
If x < 6 Then
Call BT(x)
End If
x=x * 2
Print x;
End Sub
A.15
B.16
C.17
D.18
正确答案: D
(32) 单击窗体时,下列程序的执行结果是
Private Sub Invert(ByVal xstr As String, ystr As String)
Dim tempstr As String
Dim I As Integer
I=Len(xstr)
Do While I >=1
tempstr=tempstr + Mid(xstr, I, 1)
I=I - 1
Loop
ystr=tempstr
End Sub
Private Sub Form_Click()
Dim s1 As String, s2 As String
s1= "abcdef"
Invert s1, s2
Print s2
End Sub
A.abcdef
B.afbecd
C.fedcba
D.defabc
正确答案: C
(33) 在窗体上画一个命令按钮,然后编写下列程序:
Private Sub Command1_Click()
Dim a As Single, b As Single
a=6: b=2
RC a, b
Print a, b
End Sub
Sub RC(x As Single, y As Single)
i=x
x=i / y
y=i Mod y
End Sub
A.4 3
B.1 1
C.3 0
D.2 6
正确答案: C
(34) 有如下事件过程:
Private Sub Command1_Click()
Dim m As Integer, n As Integer
m=2: n=1
Print "m="; m; "n="; n
Call TOD(m, n)
Print "m="; m; "n="; n
End Sub
Sub TOD(x, y)
x=x ^ 2
y=y ^ 3
End Sub
程序运行后,输出的结果为
A.m=2,n=1
m=1,n=2
B.m=2,n=1
m=4,n=1
C.m=1,n=2
m=1,n=4
D.m=1,n=2
m=2,n=4
考生答案: 正确答案: B
(35) 有如下事件过程:
Private Sub Command1_Click()
Dim i As Integer
For i=1 To 2
DC
Next i
End Sub
Sub DC()
Dim x As Integer, m As String
Static y, n
x=x + 1
y=y + 1
m=m &"*": n=n & "#"
Print x, y, m, n
End Sub
程序运行后,输出的结果是
A.1 1 * #
1 1 * #
B.1 1 * #
1 2 * #
C.1 1 * #
1 1 * ##
D.1 1 * #
1 2 * ##
正确答案: D