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(\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 55、运行下列程序,单击命令按钮,在窗体显示的变量i的值为(Private Sub Command1_Click()
)S=30)。 D 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 \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