2011年2级计算机VB考试选择题及答案 下载本文

Print \ Next End Sub

A 31 31 32 32 B 4 31 5 32 C 31 31 32 32 D 4 31 5 32 31604 执行下列程序段后输出的结果是(D )。 s = 1

For i = 1 To 3 For j = 0 To i-1 s = s + s * j Next j ? s; Next i

A 1 2 B 2 1C 2 2 12D 1 2 12 31605 阅读下列程序段: m = 0

For i = 1 To 3 For j = 1 To i m = m + j Next j, i

执行以上的循环后,i和m的值分别为( D)。 A 3 6B 3 10C 4 6D 4 10

31606 运行下列程序段,其中“n=n+1”语句被执行的次数是(B )。 Dim m%, n% For m = 1 To 3

For n = 1 To 6 Step 2 n = n + 1 Print n Next Next

A 3 B 6 C 9D 18

31607 窗体上有两个文本框(Text1、Text2)和一个命令按钮Command1,编写如下事件过程:

Private Sub Command1_Click() x = 0

Do While x < 50

x = (x + 2)* (x + 4) n = n + 1 Loop

Text1.Text = CStr(n) Text2.Text = CStr(x) End Sub

运行时,单击按钮,Text1和Text2将分别显示(C )。 A 0 和 0 B 1 和 8C 2 和 120

33

D 3 和 15180

31608 窗体上有一个命令按钮Command1,编写如下事件过程: Private Sub Command1_Click() For i = 1 To 4 For j = 4 To 8 Sum = Sum + 1 Next j Next i Print Sum End Sub

运行时,单击按钮,输出结果是(C )。 A 4 B 8 C 20D 32

31609 窗体上有一个命令按钮Command1,编写如下事件过程: Private Sub Command1_Click() a = 0

For m = 1 To 3 a = a + 1 b = 0

For j = 1 To 3 a = a + 1 b = b + 2 Next j Next m Print a, b End Sub

运行时,单击按钮,输出结果是(C )。 A 6 6 B 6 18C 12 6D 12 18

31610 窗体上有一个命令按钮Command1,编写如下事件过程: Private Sub Command1_Click() Dim i As Integer Dim sum As Integer sum = 0

For i = 1 To 200 sum = sum + i

If i Mod 19 = 18 Then Exit For End If Next i Print sum End Sub

运行时,单击按钮,输出结果是( D)。 A 20100 B 0 C 190 D 171

31611 如下程序段的功能是计算 1/2+1/4+1/6 +...+1/50,并显示结果。 Private Sub Command1_Click()

34

Dim i As Integer Dim sum As Double i = 2 sum = 0

Do While (i <= 【1】) sum = sum + 1 / 【2】 i = i + 2 Loop

Print sum End Sub

程序的空缺处【1】和【2】应分别填写( B)。 A 50,sum B 50,I C 100,sum D 100,i

31612 窗体上有一个命令按钮Command1,编写如下事件过程: Private Sub Command1_Click() Dim i As Integer Dim sum As Integer For i = 1 To i + 99 sum = sum + i i = i + 1 Next i Print sum End Sub

运行时,单击按钮,输出结果是( C)。

A 编译错误 B 2401 C 2500D 变量sum溢出 31613 运行下列程序,单击窗体后输出结果是( )。 B Private Sub Form_Click() Dim i%, j%, k% i = 1: j = 1: k = 10 Do While i <= k j = j + 2 i = i + 2 Loop Print j End Sub

A 9 B 11 C 13 D 21

31614 窗体上有一个命令按钮Command1,编写如下事件过程: Private Sub Command1_Click() Dim i%, j% For i = 1 To 3 For j = 0 To i

Print Chr$(48 + i); Next j Print Next i

35

End Sub

运行时,单击按钮,输出结果是( )。 C A 123 B 1 22 333

C 11 222 3333 D 0 11 222 3333

31615 窗体上有文本框Text1和命令按钮Command1,编写如下事件过程: Private Sub Command1_Click() Dim i%, x% For i = 1 To 100 i = i + 2 x = x + 2

If i > 10 Then Exit For Next i

Text1.Text = Str$(x) End Sub

运行后,单击按钮,Text1显示( )。 B A 6 B 8 C 10 D 100

31616 以下程序段的输出结果是( C )。 M = 24:N = 18 A = M:B = N R = M Mod N Do While R <> 0 M = N N = R

R = M Mod N Loop

Print A * B / N

A 6 B 24 C 72 D 432

31617 运行下列程序,单击窗体后输出的结果是( C )。 Private Sub Form_Click() s = 1

For i = 1 To 2 For j = 0 To i s = s + s * j Print s; Spc(2); Next j Print Next i

End Sub

A 1 2 4 12 B 1 2 2 4 C 1 2 2 4 12 D 1 21 2 6

31618 窗体上有一个命令按钮Command1,编写如下事件过程: Private Sub Command1_Click() a = 1

36