二级VB参考书第8章自测题
分类: 计算机
时间: 2019-01-23 14:15:19
作者: 全国等级考试资料网
一、选择题:
1.用下面的语句所定义的数组的元素个数是
Dim A(-3 To 5) As Integer
A.6
B.7
C.8
D.9
2. 用下面的语句所定义的数组的元素个数是
Dim arr(3 To 5, -2 To 2)
A.20
B.12
C.15
D.24
3. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Private Sub Command1_Click()
Dim Arr1(10), arr2(10) As Integer
n=3
For i = 1 To 5
Arr1(i) = i
arr2(n) = 2 * n + i
Next i
Print arr2(n); Arr1(n)
End Sub
程序运行后,单击命令按钮,输出结果是
A.11 3
B.3 11
C.13 3
D.3 13
4. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Option Base 1
Private Sub Command1_Click()
Dim a(10), p(3) As Integer
k=5
For i= 1 To 10
a(i)= i
Next i
For i= 1 To 3
p(i) = a(i * i)
Next i
For i = 1 To 3
k = k + p(i) * 2
Next i
Prim k
End Sub
程序运行后,单击命令按钮,输出结果是
A.35
B.28
C.33
D.37
5. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Option Base 1
Private Sub Command1_Click()
Dim a
a = Array(1, 2, 3, 4)
j=1
For i = 4 To 1 Step -1
s = s + a(i)*j
j =j * 10
Next i
Print s
End Sub
运行上面的程序,单击命令按钮,其输出结果是
A.4321
B.12
C.34
D.1234
6. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Option Base 1
Private Sub Command1_Click()
Dim Arr(3) As Integer
For i = 1 To 3
For j = 1 To 3
Arr(j) = Arr(i) + 1
Next j
Next i
Print Arr(3)
End Sub
程序运行后,单击命令按钮,其输出结果为
A.7
B.6
C.5
D.4 首页 1 2 3 尾页
1.用下面的语句所定义的数组的元素个数是
Dim A(-3 To 5) As Integer
A.6
B.7
C.8
D.9
2. 用下面的语句所定义的数组的元素个数是
Dim arr(3 To 5, -2 To 2)
A.20
B.12
C.15
D.24
3. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Private Sub Command1_Click()
Dim Arr1(10), arr2(10) As Integer
n=3
For i = 1 To 5
Arr1(i) = i
arr2(n) = 2 * n + i
Next i
Print arr2(n); Arr1(n)
End Sub
程序运行后,单击命令按钮,输出结果是
A.11 3
B.3 11
C.13 3
D.3 13
4. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Option Base 1
Private Sub Command1_Click()
Dim a(10), p(3) As Integer
k=5
For i= 1 To 10
a(i)= i
Next i
For i= 1 To 3
p(i) = a(i * i)
Next i
For i = 1 To 3
k = k + p(i) * 2
Next i
Prim k
End Sub
程序运行后,单击命令按钮,输出结果是
A.35
B.28
C.33
D.37
5. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Option Base 1
Private Sub Command1_Click()
Dim a
a = Array(1, 2, 3, 4)
j=1
For i = 4 To 1 Step -1
s = s + a(i)*j
j =j * 10
Next i
Print s
End Sub
运行上面的程序,单击命令按钮,其输出结果是
A.4321
B.12
C.34
D.1234
6. 在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码:
Option Base 1
Private Sub Command1_Click()
Dim Arr(3) As Integer
For i = 1 To 3
For j = 1 To 3
Arr(j) = Arr(i) + 1
Next j
Next i
Print Arr(3)
End Sub
程序运行后,单击命令按钮,其输出结果为
A.7
B.6
C.5
D.4 首页 1 2 3 尾页