23、【
单选题
】 下列程序段的执行结果为
I=4
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=7x=11
答案:
24、【
单选题
】 下列程序段的执行结果为
a=1
b=5
Do
a=a + b
b=b + 1
Loop While a < 10
Print a; b
[2分]
、
1 5
、
12 7
、
a b
、
10 25
答案:
25、【
单选题
】 有如下事件过程:
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,输出结果为
[2分]
、
6000
、
-10
、
200
、
-6000
答案:
26、【
单选题
】 下面程序段执行结果为
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
[2分]
28、【
单选题
】 单击命令按钮时,下列程序的执行结果为
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
[2分]
、
08
、
5078
、
450
、
7850
答案:
29、【
单选题
】 单击按钮时,以下程序运行后的输出结果是
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
[2分]
、
6 6 12
6 10 10
、
9 5 10
5 10 10
、
9 6 12
9 10 15
、
9 10 10
5 4 10
答案:
30、【
单选题
】 单击命令按钮时,下列程序的运行结果为
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
[2分]
37、【
填空题
】 执行下面的程序段,x的值为
。
Private Sub Command1_Click()
For i=1 To 9
a=a + i
Next i
x=Val(i)
MsgBox x
End Sub
[每空2分]
答案:["10"]
38、【
填空题
】 以下程序的功能是从键盘输入若干个学生的考试成绩,统计并输出最高分和最低分,当输入负数时结束输入,输出结果。请补充完整下列程序段。
Dim x, amax, amin As Single
x=InputBox("Enter a score")
amax=x
amin=x
Do While
If x > amax Then
amax=x
End If
If
Then
amin=x
End If
x=InputBox("enter a score")
Loop
Print "max="; amax, "min="; amin
[每空2分]
答案:["x>0","x"]
39、【
填空题
】 下列程序的输出结果为
。
num=2
While num <=3
num=num + 1
Print num
Wend
[每空2分]
答案:["(3 4)"]
40、【
填空题
】 以下是一个计算矩形面积的程序,调用过程计算矩形面积,请将程序补充完整。
Sub RecArea(L, W)
Dim S As Double
S=L * W
MsgBox "Total Area is " & Str(S)
End Sub
Private Sub Command1_Click()
Dim M, N
M=InputBox("What is the L?")
M=Val(M)
N=Val(N)
End Sub
[每空2分]
答案:["N = InputBox("What is the W?")","Call RecArea(M, N)/RecArea(M, N)"]