21、【
单选题
】 设有声明语句
Dim b(-1 To 10, 2 To 9, 20) As Integer
则数组b中全部元素的个数
[2分]
、
2310
、
2016
、
1500
、
1658
答案:
22、【
单选题
】 设在窗体上有个文本框,然后编写如下的事件过程:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Const Alt=4
Const Key_F2=&H71
altdown%=(Shift And Alt) > 0
f2down%=(KeyCode=Key_F2)
If altdown% And f2down% Then
Text1.Text="BBBBB"
End If
End Sub
上述程序运行后,如果按 【Shift+F2】 ,则在文本框中显示得是
[2分]
、
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If Button=2 Then PopupMenu Bs, 2
End Sub
、
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
PopupMenu Bs
End Sub
、
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
PopupMenu Bs,0
End Sub
、
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
If (Button=vbLeftButton) Or (Button=vbRightButton) Then PopupMenu Bs
End Sub
答案:
24、【
单选题
】 要将名为MyForm的窗体显示出来,正确的使用方法是
[2分]
、
MyForm.Show
、
Show.MyForm
、
MyForm Load
、
MyForm Show
答案:
25、【
单选题
】 下列程序段的执行结果为
a=5
For k=1 To 0
a=a + k
Next k
Print k; a
[2分]
、
-1 6
、
-1 16
、
1 5
、
11 21
答案:
26、【
单选题
】 下列程序段的执行结果为
I=9
x=5
Do
I=I + 1
x=x + 2
Loop Until I >=7
Print "I="; I
Print "x="; x
[2分]
、
I=4x=5
、
I=7x=15
、
I=6x=8
、
I=10x=7
答案:
27、【
单选题
】 以下程序段运行时从键盘上输入字符"-",则输出结果为
op$=InputBox("op=")
If op$="+" Then a=a + 2
If op$="-" Then a=a - 2
Print a
[2分]
、
2
、
-2
、
0
、
+2
答案:
28、【
单选题
】 以下程序段的输出结果为
Dim l, a(10) , p(3)
k=5
For i=0 To 10
a(i) =i
Next i
For i=0 To 2
p(i) =a(i (i + 1) )
Next i
For i=0 To 2
k=k + p(i) 2
Next i
Print k
[2分]
、
20
、
21
、
56
、
32
答案:
29、【
单选题
】 下列程序的执行结果为
Private Sub Command1_Click()
Dim x As Integer, y As Integer
x=12: y=20
Call Value(x, y)
Print x; y
End Sub
Private Sub Value(ByVal m As Integer, ByVal n As Integer)
m=m * 2: n=n - 5
Print m; n
End Sub
[2分]
、
20 12
20 15
、
12 20
12 25
、
24 15
12 20
、
24 12
12 15
答案:
30、【
单选题
】 在窗体上画一个命令按钮,然后编写下列程序
Private Sub Command3_Click()
Tcl 2
Tcl 3
Tcl 4
End Sub
Sub Tcl(a As Integer)
Static x As Integer
x=x + a
Print x;
End Sub
程序运行后,单击命令按钮,输出结果为
[2分]
、
2 3 4
、
2 5 9
、
3 5 4
、
2 4 3
答案:
31、【
单选题
】 下面程序段,运行后的结果是Private Sub Command1_Click()
Dim b%(1 To 4) , i%, t#
For i=1 To 4
b(i) =i
Next i
t=Tof(b() )
Print "t="; t,
End Sub
Function Tof(a() As Integer)
Dim t#, i%
t=1
For i=2 To UBound(A)
t=t * a(i)
Next i
Tof=t
End Function
[2分]
、
t=18
、
t=24
、
t=30
、
t=32
答案:
32、【
单选题
】 单击按钮时,以下程序运行后的输出结果是
Private Sub Command1_Click()
Dim x As Integer, y As Integer, z As Integer
x=1: y=2: z=3
Call God(x, x, z)
Print x; x; z
Call God(x, y, y)
Print x; y; y
End Sub
Private Sub God(x As Integer, y As Integer, z As Integer)
x=3 * z + 1
y=2 * z
z=x + y
End Sub
[2分]
39、【
填空题
】 下列程序是判断一个整数(>=3) 是否为素数,请补充完整。
Dim n As Integer
n=InputBox("请输入一个整数(>=3) ")
k=Int(Sqr(n) )
i=2
swit=0
While i <=k And swit=0
If n Mod i=0 Then
Else
End If
Wend
If swit=0 Then
Print n; "是一个素数。"
Else
Print n; "不是一个素数。"
End If
[每空2分]
答案:["swit=0","swit=1"]
40、【
填空题
】 下面程序是用来打印九九乘法表的,请补充完整。
Dim i As Integer, j As Integer, Str1$
Str1=""
For i=1 To 9
For j=1 To 9
If
Then
Str1=Str1 + Str$(j) + "×" + Str$(i) + "=" + Str$(Val(i j) )
Else
Str1=Str1 & Chr(13)