下列程序代码的运行结果为( )。Private Sub Command1_Click() For m = 1 To 10 Step 2 a = 10 For n = 1 To 20 Step 2 a = a + 2 Next n Next m Print aEnd Sub
A: 60
B: 50
C: 30
D: 20
A: 60
B: 50
C: 30
D: 20
举一反三
- 下列程序代码的运行结果为( )。 Private Sub Command1_Click() For m = 1 To 10 Step 2 a = 10 For n = 1 To 20 Step 2 a = a + 2 Next n Next m Print a End Sub
- 运行下列程序,单击窗体,在窗体上显示的结果为( )。Private Sub Form_Click() a = 0 n = 10 For i = 1 To n Step 2 a = a + 1 n = n + 5 Next i Print aEnd Sub A: 20 B: 10 C: 5 D: 出错
- 编写如下程序: Private Sub Command1_Click; Dim m As Integer, n As Integer m = 2 : n = 1 Select Case m Case 1 Select Case n Case 1 Print "AAA" Case 2 Print "BBB" End Select Case 2 Print "CCC" End Select End Sub 程序运行后,单击命令按钮Command1,输出结果为 A: BBB B: CCC C: AAA D: 1
- 下列程序段的运行结果是______。 Private Sub Form_Click() Dim d d = Array(1, 2, 3, 4, 5) n = 1 For k = 4 To 2 Step -1 s = s + d(k) * n n = n * 10 Next Print sEnd Sub A: 123 B: 234 C: 345 D: 112
- 在窗体中有一个命令按钮(名为Command1),其事件代码如下: Private Sub Command1_Click() Dim a(5, 5) For m = 2 To 3 For n = 1 To 2 a(m, n) = m * n Next n Next m MsgBox a(2, 1) + a(3, 2) End Sub 运行该窗体后,单击命令按钮,则消息框的输出结果为( )。 A: 8 B: 6 C: 2 D: 16