设有数组声明:Dim s(2, 3),下面错误的程序段是

admin2015-09-23  27

问题 设有数组声明:Dim s(2, 3),下面错误的程序段是

选项 A、For i = 1 To 3
For j = 1 To 2
s(i, j) = 0
Next j
Next I
B、For i = 1 To 2
For j = 1 To 3
s(i, j) = 0
Next j
Next I
C、For i = 1 To 3
For j = 1 To 2
s(j, i) = 0
Next j
Next I
D、For i = 0 To 2
For j = 0 To 3
s(i, j) = 0
Next j
Next I

答案A

解析 本题考查二维数组的初始化,题中定义了3行4列的二维数组, i代表第一维下标上界为3,j代表第二维下标上界为4。本题中s(2,3)有3行(0-2)、4列(0-3),共12个数组元素,A选项中数组元素s(3,2)超出了数组界限,故正确答案为选项A。
转载请注明原文地址:https://kaotiyun.com/show/jGLp777K
0

相关试题推荐
最新回复(0)