下面程序片段中有错误:Sub pric() Public x As Integer x = Array(1, 2, 3, 4, 5) ……End Sub为了避免出错,正确的修改方案是_______________。
A: 把Public x As Integer 改为Public x As Variant
B: 把Public x As Integer 改为Dim x(5)
C: 把Public x As Integer 改为Static x
D: 把x = Array(1, 2, 3, 4, 5)改为x = Array(0, 1, 2, 3, 4)
A: 把Public x As Integer 改为Public x As Variant
B: 把Public x As Integer 改为Dim x(5)
C: 把Public x As Integer 改为Static x
D: 把x = Array(1, 2, 3, 4, 5)改为x = Array(0, 1, 2, 3, 4)
举一反三
- 中国大学MOOC: 下面程序片段中有错误:Sub pric() Public x As Integer x = Array(1, 2, 3, 4, 5) ……End Sub为了避免出错,正确的修改方案是_______________。
- 假定有一个模块,在其中定义一个公共变量,正确的是________。 A: Dim x as Integer B: Public Dim x as Integer C: Dim Public x as Integer D: Public x as Integer
- 以下定义数组或给数组元素赋值的语句中,正确的是 A: Dim x%(2) x(1)="等级考试" B: Dim x(3), y(3)As Integer x(0)=1:y=x C: Dim x x=Array(0,1,2) D: Dim x(3)As Integer x=Array(0,1,2)
- 如下程序的运行结果是【1】. Private Sub Command1_Click() Dim x As Integer x = 12 f2 x Print x End Sub Public Sub f2(n As Integer) n = n Mod 10 End Sub
- 设窗体上有一个Command1命令按钮,还有以下程序代码: Private Sub Command1_Click() Static x As Integer x=x+1 Call proc(x) Print x, End Sub Private Sub proc(a As Integer) Static x As Integer x=x+a:a=x End Sub 程序运行后,3次单击命令按钮,则产生的输出是 A: 1 2 3 B: 1 3 5 C: 1 3 7 D: 2 4 6