下列语句中( )可以用来正确声明一个动态数组。
A. Private A(n) As Integer
B. Dim A(,) As Integer
C. Dim A() As Integer
Dim A(1 to n)
运行下列程序,当单击命令按钮Command1时,窗体第3行显示的内容是________。 Option Base 1 Private Sub Command1_Click() Dim a(4,4)As Integer For i = 1 To 4 For j = 1 To 4 If i >= j Then a(i,j)= k :k = k + 1 Else a(i,j)= 1 End If Next j Next i For i = 1 To 4 For j = 1 To 4 Print a(i,j); Next j Print Next i End Sub
A. 1 2 3 1
B. 1 1 7 8
C. 3 4 5 1
D. 1 1 1 2
在窗体上添加一个命令按钮,然后编写以下程序: Option Base 1 Private Sub Command1_Click() Dim a(9)As Integer,b(3,3)As Integer For i = 1 To 9 a(i)= i Next i For i = 1 To 3 For j = 1 To 3 b(i,j)= a(j +(i - 1)* 3) Next j Next i For i = 1 To 3 Step 2 For j = 1 To 3 Print b(i,j); Next j Print Next i End Sub 运行程序后,单击命令按钮,输出结果是________。
A. 4 5 6 7 8 9
B. 1 4 7 3 6 9
C. 1 2 3 7 8 9
D. 1 2 3 4 5 6
以下程序输出的结果是________。 Option Base 1 Private Sub Command1_Click() Dim a,b(3,3) a = Array(1,2,3,4,5,6,7,8,9) For i = 1 To 3 For j = 1 To 3 b(i,j)= a(i * j) If (j >= i)Then Print Tab(j * 3);Format(b(i,j),"###"); Next j Print Next i End Sub
A. 1 4 5 7 8 9
B. 1 2 3 4 6 9
C. 1 4 7 2 4 6 3 6 9
D. 1 2 3 4 5 6 7 8 9