程序阅读(80题)
1、在窗体上画一个名称为Command1的命令按钮,并编写如下程序:
Private Sub Command1_Click()
Dim x As Integer
Static y As Integer
x=10
y=5
Call f1(x,y)
Print x,y
End Sub
Private Sub f1(ByRef x1 As Integer, y1 As Integer)
x1=x1+2
y1=y1+2
End Sub
程序运行后,单击命令按钮,在窗体上显示的内容是
A) 10 5 B) 12 5 C) 10 7 D) 12 7
2、 在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:
Private Sub Command1_Click()
x=InputBox("Input")
Select Case x
Case 1,3
Print "分支 1"
Case Is >4
Print "分支 2"
Case Else
Print "Else 分支 "
End Select
End Sub
程序运行后,如果在输入对话框中输入2,则窗体上显示的是
A) 分支1 B) 分支2 C) Else分支 D) 程序出错
3、执行下列程序段后,输出的结果是
For k1=0 To 4
y=20
For k2=0 To 3
y=10
For k3=0 To 2
y=y + 10
Next k3
Next k2
Next k1
Print y
A) 90
B) 60
C) 40
D) 10
4、设有如下过程:
Sub ff(x,y,z,)
x=y+z
End Sub
以下所有参数的虚实结合都是传址方式的调用语句是
A) Call ff(5,7,z)
B) Call ff(x,y,z)
C) Call ff(3+x,5+y,z)
D) Call ff(x+y,x-y,z)
5、下列程序段的执行结果为
a=1
b=0
Select Case a
Case 1
Select Case b
Case 0
Print "* *0* *"
Case 1
Print "* *1* *"
End Select
Case 2
Print "* *2* *"
End Select
A) * *0* *
B) * * 1* *
C) * *2* *
D) 0
6、下面程序段执行结果为
x=Int(Rnd() + 4)
Select Case x
Case 5
Print "excellent"
Case 4
Print "good"
Case 3
Print "pass"
Case Else
Print "fail"
End Select
A)
excellent
B) good
C)
pass
D) fail
7、下列程序段的执行结果为
a=6
For k=1 To 0
a=a + k
Next k
Print k; a
A) -1 6
B) -1 16
C) 1 6
D) 11 21
8、下列程序段的执行结果为
a=1
b=1
For I=1 To 3
f=a + b
a=b
b=f
Print f;
Next I
A) 2 3 6
B) 2 3 5
C) 2 3 4
D) 2 2 8
9、单击命令按钮时,下列程序的执行结果为
Private Sub Command1_Click()
Dim x As Integer, y As Integer
x=12: y=32
Call PCS(x, y)
Print x; y
End Sub
Public Sub PCS(ByVal n As Integer, ByVal m As Integer)
n=n Mod 10
m=m Mod 10
End Sub
A) 12
32
B) 2
32
C) 2
3
D) 12
3
10、单击一次命令按钮后,下列程序的执行结果是
Private Sub Command1_Click()
s=P(1) + P(2) + P(3) + P(4)
Print s
End Sub
Public Function P(N As Integer)
Static Sum
For i=1 To N
Sum=Sum + i
Next i
P=Sum
End Function
A)
15
B) 25
C)
35
D) 45
11、下列程序的执行结果为
Private Sub Command1_Click()
Dim s1 As String, s2 As String
s1="abcdef"
Call Invert(s1, s2)
Print s2
End Sub
Private Sub Invert(ByVal xstr As String, ystr As String)
Dim tempstr As String
i=Len(xstr)
Do While i >=1
tempstr=tempstr + Mid(xstr, i, 1)
i=i - 1
Loop
ystr=tempstr
End Sub
A)
fedcba
B) abcdef
C)
afbecd
D) defabc
12、阅读下列程序:
Private Sub Command1_Click()
Dim i As Integer, k As Integer
k=2
For i=1 To 3
Print H(k) ;
Next i
End Sub
Function H(j As Integer)
a=0
Static b
a=a + 1
b=b + 1
H=a*b + j
End Function
程序运行后,单击命令按钮输出结果是
A) 2
3
4
B) 3
4
5
C) 5
6
7
D) 3
5
6
13、执行下列程序段后,输出的结果是
For k1=0 To 4
y=20
For k2=0 To 3
y=10
For k3=0 To 2
y=y + 10
Next k3
Next k2
Next k1
Print y
A) 90
B) 60
C) 40
D) 10
14、下列程序段的执行结果为
a=6
For k=1 To 0
a=a + k
Next k
Print k; a
A) -1 6
B) -1 16
C) 1 6
D) 11 21
15、下列程序段的执行结果为
a=1
b=1
For I=1 To 3
f=a + b
a=b
b=f
Print f;
Next I
A) 2 3 6
B) 2 3 5
C) 2 3 4
D) 2 2 8
16、单击命令按钮时,下列程序的执行结果为
Private Sub Command1_Click()
Dim x As Integer, y As Integer
x=12: y=32
Call PCS(x, y)
Print x; y
End Sub
Public Sub PCS(ByVal n As Integer, ByVal m As Integer)
n=n Mod 10
m=m Mod 10
End Sub
A) 12
32
B) 2
32
C) 2
3
D) 12
3
17、单击一次命令按钮后,下列程序的执行结果是
Private Sub Command1_Click()
s=P(1) + P(2) + P(3) + P(4)
Print s
End Sub
Public Function P(N As Integer)
Static Sum
For i=1 To N
Sum=Sum + i
Next i
P=Sum
End Function
A)
15
B) 25
C)
35
D) 45
18、下列程序的执行结果为
Private Sub Command1_Click()
Dim s1 As String, s2 As String
s1="abcdef"
Call Invert(s1, s2)
Print s2
End Sub
Private Sub Invert(ByVal xstr As String, ystr As String)
Dim tempstr As String
i=Len(xstr)
Do While i >=1
tempstr=tempstr + Mid(xstr, i, 1)
i=i - 1
Loop
ystr=tempstr
End Sub
A)
fedcba
B) abcdef
C)
afbecd
D) defabc
19、 在窗体上画一个名称为Commandl的命令按钮,再画两个名称分别为Labell、Label2 的标签,然后编写如下程序代码:
Private x As Integer
Private Sub Commandl_Click()
x=5:y=3
Call proc(x,y)
LabeL1.Caption=x
LabeL2.Caption=y
End Sub
Private Sub proc(ByVal a As Integer,ByVal b As Integer)
x=a* a
y=b十b
End Sub
程序运行后,单击命令按钮,则两个标签中显示的内容分别是( )。
A)25 3
B)25 9
C)5 3 D)5 9
20 、在窗体上画一个命令按钮,然后编写如下事件过程:
Private Sub Command1_Click()
x=0
Do Until x=-1
a=InputBox("请输入第一个数字a的值")
a=Val(A)
b=InputBox("请输入第二个数字b的值")
b=Val(b)
x=InputBox("请输入第三个数字x的值")
x=Val(x)
a=a + b + x
Loop
Print a
End Sub
21、下列程序段的执行结果为
I=4
x=5
Do
I=I + 1
x=x + 2
Loop Until I>=7
Print "I="; I;
Print "x="; x
A) I=4 x=5
B) I=7 x=15
C) I=6 x=8
D) I=7 x=11
22、下列程序段的执行结果为
a=1
b=5
Do
a=a + b
b=b + 1
Loop While a < 10
Print a; b
A) 1 5
B) 12 7
C) a b
D) 10 25
23、下列程序段的执行结果为
a=75
If a > 60 Then I=1
If a > 70 Then I=2
If a > 80 Then I=3
If a < 90 Then I=4
Print "I="; I
A) I=1
B) I=2
C) I=3
D) I=4
24、有如下事件过程:
Private Sub Command1_Click()
b=10
Do Until b=-1
a=InputBox("请输入a的值")
a=Val(A)
b=InputBox("请输入b的值")
b=Val(b)
a=a * b
Loop
Print a
End Sub
程序运行后,依次输入数值30,20,10,-1,输出结果为
A) 6000
B) -10
C) 200
D) -6000
25、下面程序段执行结果为
x=Int(Rnd() + 3)
Select Case x
Case 5
Print "excellent"
Case 4
Print "good"
Case 3
Print "pass"
Case Else
Print "fail"
End Select
A) excellent
B) good
C) pass
D) fail
26、定义过程的格式中,Static关键字的作用是指定过程中的局部变量在内存中的存储方式。若使用了Static关键字,则
A) 每次调用此过程,该过程中的局部变量都会被重新初始化
B) 在本过程中使用到的,在其他过程中定义的变量也为Statci型
C) 每次调用此过程时,该过程中的局部变量的值保持在上一次调用后的值
D) 定义了该过程中定义的局部变量为"自动"变量
27、单击命令按钮时,下列程序的执行结果为
Private Sub Command1_Click()
Dim x As Integer, y As Integer
x=50: y=78
Call PPP(x, y)
Print x; y
End Sub
Public Sub PPP(ByVal n As Integer, ByVal m As Integer)
n=n \ 10
m=m \ 10
End Sub
A) 0 8
B) 50 78
C) 4 50
D) 78 50
28、单击按钮时,以下程序运行后的输出结果是
Private Sub proc1(x As Integer, y As Integer, z As Integer)
x=3 * z
y=2 * z
z=x + y
End Sub
Private Sub Command1_Click()
Dim x As Integer, y As Integer, z As Integer
x=1: y=2: z=3
Call proc1(x, x, z)
Print x; x; z
Call proc1(x, y, y)
Print x; y; y
End Sub
A) 6 6 12
6 10 10
B) 9 5 10
5 10 10
C) 9 6 12
9 10 15
D) 9 10 10
5 4 10
29、单击命令按钮时,下列程序的运行结果为
Private Sub Command1_Click()
Print MyFund(20, 18)
End Sub
Public Function MyFund(m As Integer, n As Integer) As Integer
Do While m <> n
Do While m > n: m=m - n: Loop
Do While m < n: n=n - m: Loop
Loop
MyFund=m
End Function
A) 0
B) 2
C) 4
D) 6
30、在窗体上画一个命令按钮,然后编写如下程序
Private Sub Command1_Click()
Dim a As Integer, b As Integer
a=1
b=2
Print N(a, b)
End Sub
Function N(x As Integer, y As Integer) As Integer
N=IIf(x > y, x, y)
End Function
程序运行后,单击命令按钮,输出结果为
A) 1
B) 2
C) 5
D) 8
31、执行下面的程序段,x的值为 【7】 。10
Private Sub Command1_Click()
For i=1 To 9
a=a + i
Next i
x=Val(i)
MsgBox x
End Sub
32、下列程序段的执行结果为
a=5
For k=1 To 0
a=a + k
Next k
Print k; a
A) -1 6
B) -1 16
C) 1 5
D) 11 21
33、下列程序段的执行结果为
a=3
b=1
For I=1 To 3
f=a + b
a=b
b=f
Print f;
Next I
A) 4 3 6
B) 4 5 9
C) 6 3 4
D) 7 2 8
34、下列程序段的执行结果为
I=9
x=5
Do
I=I + 1
x=x + 2
Loop Until I >=7
Print "I="; I,
Print "x="; x
A) I=4 x=5
B) I=7 x=15
C) I=6 x=8
D) I=10 x=7
35、以下程序段运行时从键盘上输入字符"-",则输出结果为
op$=InputBox("op=")
If op$="+" Then a=a + 2
If op$="-" Then a=a - 2
Print a
A) 2
B) -2
C) 0
D) +2
36、以下程序段的输出结果为
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
A) 20
B) 21
C) 45
D) 32
37、下列程序的执行结果为
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
A) 20 12
20 15
B) 12 20
12 25
C) 24 15
12 20
D) 24 12
12 15
38、在窗体上画一个命令按钮,然后编写下列程序
Private Sub Command1_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
程序运行后,单击命令按钮,输出结果为
A) 2 3 4
B) 2 5 9
C) 3 5 4
D) 2 4 3
39、下面程序段,运行后的结果是Private Sub Command1_Click()
Dim b%(1 To 4) , i%, t#
Private Sub Command1_Click()
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
A) t=18
B) t=24
C) t=30
D) t=32
40、单击按钮时,以下程序运行后的输出结果是
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
A) 6 6 12
7 11 11
B) 8 5 10
5 11 11
C) 9 6 12
9 10 15
D) 8 10 10
5 9 10
41、下列程序段的执行结果为
X=2
Y=5
If X * Y < 1 Then Y=Y - 1 Else Y=-1
Print Y - X > 0
A) True
B) False
C) -1
D) 1
42、执行下列程序后,鼠标单击窗体,输出结果为 。
Private Sub Form_Click()
Print "Click";
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift _
As Integer, X As Single, Y As Single)
Print "Donw";
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift _
As Integer, X As Single, Y As Single)
Print "Up";
End Sub
A) DownUpClick
B) ClickDownUp
C) DownClickUp
D) UpDownClick
43、下面程序段的运行结果是
a=1
b=1
Do
a=a + 1
b=b + 1
Loop Until b > 5
Print "k="; a; Spc(4) ; "b="; b + a
A) k=7 b=14
B) k=6 b=6
C) k=4 b=8
D) k=6 b=12
44、下列程序段,在运行时最后输出的内容是
a=2
c=1
c=c + a
If c < 10 Then
Print c
Else
Print "10以内的奇数显示完毕"
End If
A) 3
B) 7
C) 9
D) 10以内的奇数显示完毕
45、单击命令按钮时,下列程序的执行结果为
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a=2: b=3: c=4
Print P2(c, b, A)
End Sub
Private Function P1(x As Integer, y As Integer, z As Integer)
P1=2 * x + y + 3 * z
End Function
Private Function P2(x As Integer, y As Integer, z As Integer)
P2=P1(z, x, y) + x
End Function
A) 21
B) 19
C) 17
D) 34
46、单击命令按钮时,下列程序的执行结果是
Private Sub Book(x As Integer)
x=x * 2 + 1
If x < 6 Then
Call Book(x)
End If
x=x * 2 + 1
Print x;
End Sub
Private Sub Command1_Click()
Book 2
End Sub
A) 23 47
B) 10 36
C) 22 44
D) 24 50
47、有如下程序:
Private Sub Command1_Click()
Dim k As Integer, m As Integer
Dim p As Integer
k=4: m=1
p=PC(k, m) : Print p;
p=PC(k, m) : Print p
End Sub
Private Function PC(a As Integer, b As Integer)
Static m As Integer, i As Integer
m=0: i=2
i=i + m + 1
m=i + a + b
PC=m
End Function
程序运行后,输出的结果为
A) 4 6
B) 6 6
C) 8 8
D) 10 12
48、有如下程序:
Private Sub Command1_Click()
Dim a As Single
Dim b As Single
a=5: b=4
Call S(a, b)
? a,b
End Sub
Sub S(x As Single, y As Single)
t=x
x=t \ y
y=t Mod y
End Sub
在调用运行上述程序后,a和b的值分别为
A) 0 0
B) 1 1
C) 2 2
D) 1 2
49、在窗体上画一个命令按钮,然后编写下列程序:
Private Sub Command1_Click()
Tt 3
End Sub
Sub Tt(a As Integer)
Static x As Integer
x=x * a + 1
Print x;
End Sub
连续三次单击命令按钮,输出的结果是
A) 1 5 8
B) 1 4 13
C) 3 7 4
D) 2 4 8
50、阅读下面的程序段:
For a=1 To 2
For b=1 To a
I=I + 1
Next
Next
Print I
执行上面的三重循环后,I的值为
A) 2
B) 3
C) 4
D) 5
51、假定一个
工程
路基工程安全技术交底工程项目施工成本控制工程量增项单年度零星工程技术标正投影法基本原理
由一个窗体文件Form1和两个标准模块文件Modell及Model2组成。
Modell代码如下:
Public x As Integer
Public y As Integer
Sub S1()
x=1
S2
End Sub
Sub S2()
y=10
Form1.Show
End Sub
Model2的代码如下:
Sub Main()
S1
End Sub
其中Sub Main被设置为启动过程。程序运行后,各模块的执行顺序是
A)Form1→Model1→Model2
B)Model1→Model2→Form1
C)Model2→Model1→Form1
D)Model2→Form1→Model1
52、设有下面的循环:
i=1
Do
i=i + 3
Print i
Loop Until I>
程序运行后要执行3次循环体,则条件中I的最小值为
A) 6
B) 7
C) 8
D) 9
53、执行以下语句过程,在窗体上显示的内容是
Option Base 0
Private Sub Command1_Click()
Dim d
d=Array("a", "b", "c", "d")
Print d(1) ; d(3)
End Sub
A)
ab
B) bd
C)
ac
D) 出错
54、运行下面程序,并单击窗体后,在窗体显示的结果是( )。
Private Sub Form_Click()
Dim S As Single
S=0
For I=1 To 5
S=S+2*I
Next I
Print “S=”;S
End Sub
A)S=15
B)S=20
C)S=25
D)S=30
55、运行下列程序,单击命令按钮,在窗体显示的变量i的值为( )。
Private Sub Command1_Click()
i=0:s=0
While i<50
i=i+1:s=s+i
Wend
Print “i的值是:”;i
End Sub
A)0
B)49
C)50
D)51
56、单击命令按钮时,下列程序的运行结果为
Private Sub Command1_Click()
Print MyBM(23, 18)
End Sub
Public Function MyBM(m As Integer, n As Integer) As Integer
Do While m <> n
Do While m > n: m=m - n: Loop
Do While m < n: n=n - m: Loop
Loop
MyBM=m
End Function
A) 0
B) 1
C) 3
D) 5
57、有如下的程序:
Private Sub Command1_Click()
Dim k As Integer, m As Integer
Dim P As Integer
k=4: m=1
P=Pid(k, m) : Print P;
P=Pid(k, m) : Print P
End Sub
Private Function Pid(a As Integer, b As Integer)
Static m As Integer, i As Integer
m=5: i=2
i=i + m + 1
m=i + a + b
Pid=m \ 2
End Function
单击命令按钮后,输出结果为
A) 2 2
B) 4 4
C) 55
D) 6 6
58、在窗体上画一个命令按钮,然后编写如下事件过程:
Private Sub Command1_Click()
Dim m As Integer, n As Integer, p As Integer
m=3: n=5: p=0
Call Y(m, n, p)
Print Str(p)
End Sub
Sub Y(ByVal i As Integer, ByVal j As Integer, k As Integer)
k=i + j
End Sub
程序运行后,如果单击命令按钮,则在窗体上显示的内容是
A) 4
B) 6
C) 8
D) 10
59、下面运行程序后,单击命令按钮,输出的结果是 【11】 。
Private Sub Command1_Click()
Dim a%(1 To 4) , b%(3 To 6) , i%, s1#, s2#
For i=1 To 4
a(i) =i
Next i
For i=3 To 6
b(i) =i
Next i
s1=YAS(A)
s2=YAS(b)
Print "s1="; s1; "s2="; s2
End Sub
Function YAS(a() As Integer)
Dim t#, i%
t=1
For i=LBound(A) To UBound(A)
t=t * a(i)
Next i
YAS=t
End Function
S1=24 s2=360
60、运行下列程序段后,显示的结果为
J1=63
J2=36
If J1 < J2 Then Print J2 Else Print J1
A) 63
B) 36
C) 55
D) 2332
61、下列程序段的执行结果为
a=95
If a > 60 Then degree=1
If a > 70 Then degree=2
If a > 80 Then degree=3
If a > 90 Then degree=4
Print "degree="; degree
A) degree= 1
B) degree= 2
C) degree= 3
D) degree= 4
62、下列程序段的执行结果为
I=4
x=5
Do
I=I + 1
x=x^ 2
Loop Until I>=7
Print "I="; I
Print "x="; x
A) I=4
x=258694
B) I=7
x=256987
C) I=6
x=365840
D) I=7
x=390625
63、下列程序段的执行结果为
a=5
For k=1 To 0
a=a * k
Next k
Print k; a
A) -1 6
B) -1 16
C) 1 5
D) 11 21
64、运行下面的程序后,输出的结果为
Cls
Dim t(5, 5) as Integer
For i=1 To 5: t(i, i) =1: Next
For i=1 To 5
For j=1 To 5
Print t(i, j) ,
Next j
Print
Next I
A)1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
B) 1
1
1
1
1
C)1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
D) 1 1 1 1 1
65、单击命令按钮时,下列程序的执行结果是
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a=3
b=4
c=5
Print SecProc(c, b, A)
End Sub
Function FirProc(x As Integer, y As Integer, z As Integer)
FirProc=2 * x + y + 3 * z+2
End Function
Function SecProc(x As Integer, y As Integer, z As Integer)
SecProc=FirProc(z, x, y) + x+7
End Function
A) 20
B) 25
C) 37
D) 32
66、有如下事件过程:
Function UNC (ByVal x As Integer, ByVal y As Integer) As Integer
Do While y <> 0
sic=x / y
x=y
y=sic
Loop
UNC=x
End Function
以下是该函数的调用过程,该程序的运行结果是
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a=12
b=2
x=UNC (a, b)
Print x
End Sub
A) 0
B) 6
C) 2
D) 80
67、程序运行时,单击命令按钮Command1,标签框1显示( )。
Private Sub Command1_Click()
Dim i As Integer, n As Integer
For i = 0 To 50
i = i + 3
n = n + 1
If i > 20 Then Exit For
Next i
Label1.Caption = Str(n)
End Sub
A)4
B)5
C)6
D)7
68、编写如下事件过程:
Private Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
Print Chr(KeyCode)
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Print Chr(KeyAscii)
End Sub
在一般情况下(即不按住Shift键和锁定大写键时) 运行程序,若按"T"键,则程序输出的结果是
A)T
T
B) t
T
C) T
t
D) t
t
69、下列程序段的执行结果为
m=2
n=3
Do
m=m + n
n=n + 1
Loop While m < 10
Print m; n
A) 1 5
B) 14 6
C) a b
D) 10 25
70、 有如下的程序段,该程序段执行完后,共执行的循环次数是
total=0
Counter=1
Do
Print Counter
total=total * Counter+1
Print total
Counter=Counter + 1
If total > 10 Then
Exit Do
End If
Loop While Counter <=10
A) 4
B) 10
C) 15
D) 20
71、下列程序的运行结果为
Dim a(-1 To 6)
For i=LBound(a, 1) To UBound(a, 1)
a(i) =i
Next i
Print a(LBound(a, 1) ) ; a(UBound(a, 1) )
A) 0 0
B) -5 0
C) -1 6
D) 0 6
72、单击命令按钮时,下列的执行结果为
Private Sub Command1_Click()
Dim x As Integer, y As Integer
x=86: y=29
Call Proc(x, y)
Print x; y
End Sub
Public Sub Proc(n As Integer, ByVal m As Integer)
n=n Mod 10
m=m Mod 10
End Sub
A) 12 32
B) 6 29
C) 2 3
D) 12 3
73、设一个工程由两个窗体组成,其名称分别为Form1和Form2,在Form1上有一个名称为Command1的命令按钮。窗体Form1的程序代码如下:
Private Sub Command1_Click()
Dim a As Integer
a=10
Call g(Form2,a)
End Sub
Private Sub g(f As Form, x As Integer)
y=IIf(x>10,000,-100)
f.Show
f.Caption=y
End Sub
运行以上程序,正确的结果是
A)Form1的Caption属性值为100
B)Form2的Caption属性值为-100
C)Form1的Caption属性值为-100
D)Form2的Caption属性值为100
74、在窗体上画一个名称为Command1的命令按钮,并编写如下程序:
Private Sub Command1_Click()
Dim x As Integer
Static y As Integer
x=10
y=5
Call fl(x,y)
Print x,y
End Sub
Private Sub f1(ByRef x1 As Integer,y1 As Integer)
x1=x1+2
y1=y1+2
End Sub
程序运行后,单击命令按钮,在窗体上显示的内容是
A)10 5
B)12 5
C)10 7
D)12 7
75、 在窗体上画两个名称分别为Text1、Texte2的文本框和一个名称为Command1的命令按钮,然后编写如下事件过程:
Private Sub Command1_Click()
Dim x As Integer,n As Integer
x=1
n=0
Do While x<20
x=x*2
n=n+1
Loop
Text1.Text=Str(x)
Text2.Text=Str(n)
End Sub
程序运行后,单击命令按钮,在两个文本框中显示的值分别是( )。
A)2 2
B)8 2
C)32 5
D)16 4
76、在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:
Option Base 1
Private Sub Command1_Click()
Dim a
a=Array(1,2,3,4,5)
For i=1 To UBound(a)
a(i)=a(i)+i-1
Next
Print a(3)
End Sub
程序运行后,单击命令按钮,则在窗体上显示的内容是
A)4
B)5
C)6
D)7
77、阅读程序:
Option Base 1
Private Sub Form_Click()
Dim arr, Sum
Sum=0
arr=Array(1,3,5,7,9,11,13,15,17,19)
For i=1 To 10
If arr(i)/3=arr(i)\3 Then
Sum=Sum+arr(i)
End If
Next i
Print Sum
End Sub
程序运行后,单击窗体,输出结果为