首页/ 题库 / [单选题]下列程序段的执行结果为 Dim A(3,的答案

下列程序段的执行结果为 Dim A(3,3) For M=1 To 3 For N=1 To 3 If N=M Or N=3-M+1 Then A(M,N)=1 Else A(M,N)=0 End If Next N Next M For M=1 To 3 For N=1 To 3 Print A(M,N) Next N Print Next M

单选题
2022-01-05 15:54
A、1 0 0 0 1 0 0 0 0
B、1 1 1 1 1 1 1 1 1
C、0 0 0 0 0 0 0 0 0
D、1 0 1 0 1 0 1 0 1
查看答案

正确答案
D

试题解析
解析:题中以嵌套For循环为数组A(3,3)赋值,此过程中,如果A(M,N)符合条件"N=M OR N=3-M+1"则此项赋1,否则赋0。以A(1,1)为例,由于M=N=1,故A(1,1)=1。  依次类推:  A(1,1)=1 A(2,1)=0 A(3,1)=1  A(1,2)=0 A(2,2)=1 A(3,2)=0  A(1,3)=1 A(2,3)=0 A(3,3)=1

标签:
感兴趣题目
程序代码如下,当单击窗体上的Command1控件时,在窗体上输出的结果是( )。 Private Sub Command1_Click() Dim aa(3,3)As Integer Dim i As Integer,j As Integer Dim s As Integer For i=0 To 3 For j=0 To 3 aa(i,j)=i*4+j+1 Next j Next i For i=0 To 3 s=s+aa(i,1) Next i Print s End Sub
下列程序段的执行结果为______。 Dim M(10), N(10) I=3 For T = 1 To 5 M(T) = T N(I) = 2 * I + T Next T Print N(I); M(I)
有如下程序,程序执行完后的结果是(). Dimension m(3) X="123456" for i=1 to 3 m(i)=SUBSTR(X,2*I,1) endfor ? M(1),M(2),M(3)
下列程序段的执行的结果是 Dim a(10),b(10) i=3 For j=1 To 5 a(j) =j b(i) =2 * i + j Next j Print b(i);a(i)
阅读程序: Option Base 1 Dim arr( )As Integer Private Sub Form_Click( ) Dim i AsInteger,j As Integer ReDim arr(3,2) For i=1 To 3 Forj=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim Preserve arr(3,4) For j=3 To 4 arr(3,j)=j+9 Nextj Print arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输出结果为
阅读程序: Option Base 1 Dim arr()As Integer Private Sub Form_Click() Dim i As Integer,j As Integer ReDim arr(3,2) For i=1 To 3 For j=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim Preserve arr(3,4) For j=3 To 4 arr(3,j)=j+9 Next j Print arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输入结果为______。
有以下程序: Option Base 1 Dim arr()As Integer Private Sub Form. Click() Dim i As Integer,j As Integer ReDim arr(3,2) For i=1 To 3 For j=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim Preserve arr(3,4) For j=3 To 4 arr(3,j)=j+9 Next j Print arr(3,2);arr(3,4) End Sub 程序运行后,单击窗体,输出结果为______。
下列程序段的执行结果为 n=0 For i=1 To 3 For j=5 To 1 Step-1 n=n+1 Next j,i Print n;j;i
编写以下程序段: DIM I, J, K, A A=0 FOR I = 1 TO 3 FOR J = 1 TO I FOR K=-J TO 3 A=A+1 NEXT K NEXT J NEXT I 执行上面的三重循环后,变量A的值为( )。
下列程序段的执行结果为 a=3 b=1 For I=1 To 3 f=a + b a=b b=f Print f Next I
下列程序段的执行结果为 a=1 b=2 For I=1 To 3 f=a * b a=b b=f Print f Next I
下列程序段的执行结果为( )。 a=1 b=1 For I=1 To 3 f=a+b a=b b=f Print f: Next I
相关题目
下面程序运行后,输出的结果是 Dim arr(3,3) For j=1 To 3 For k=1 To 3 Arr(j,k)=(j-1)*3+k Next k Next j For j=2 To 3 For j=2 To 3 Print art(k,j); Next k Print Next j
下列程序段的执行结果为 ______。 I=0 For G=10 To 19 Step 3 I=I+1 Next G Print I
下列程序段的执行结果为______。 I=0 For G=10 To 19 Step 3 I=I+1 Next G Print I
下列程序执行后,执行的结果是______ 。 Dim M(2) For i = 1 To 2 M(i) = 0 Next i k=2 For i = 1 To k For j = 1 To k M(j) = M(i) + 1 Print M(k): Next j Next I
下列程序段的执行结果为( )。 Dim m(10),n(10) I=3 For I=1 to 5 M(t)=t N(I)=2*I+t Next t Print n(I);m(I)
以下程序的输出结果是D)9 12 Option Base 1 Private Sub Command1_Click() Dim s(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 Print k End sub
以下程序运行后,消息框的输出结果是( )。 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 MSGBOX K END SUB
下面程序:________Option Base 1Private Sub Command1_Click() Dim a(10),p(3)As Integer Dim i,k As Integer k=5 For i=1 To 10 a(i)=i Next For i=1 To 3 p(i)=a(i*i) Next For i=1 To 3 k=k+p(i)*2 Next Print kEnd Sub运行后的输出结果为________。
下列程序段的执行结果为______。 K=0 For J = 1 To 2 For I = 1 To 3 K=I+1 Next I For I = 1 To 7 K=K+1 Next I Next J Print K
以下程序的输出结果是( )。 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 j=1 to 3 p(i)=a(I*j) Next j For I=1 to 3 k=k+p(I)*2 Next I Print k End Sub
阅读下面的程序段: a==0 For i=1 To 3 For j=1 To i For k=j To 3 a=a+l Next k Next j Next i 执行上面的程序段后,a的值为( )。
下列程序段的执行结果为_______。 N=0 For I=1 To 3 For J=5 To 1 Step -1 N=N+1 Next J Next I Print N;J;I
有如下程序,运行时输出的结果是 ______。 Option Base 1 Private Sub Command1_Click() Dim a(3,3) As Integer For m=1 To 3 For n=1 To 3 a(m-1,n-1)=m+n+1 Next n Next m For m=0 To 2 For n=0 To 2 Print a(n,m); Next n Print Next m End Sub
假定有以下程序段 n=0 for i=1 to 3 for j=-3 to 1 n=n+1 next j next i 运行完毕后,n的值是( )。
下列程序段的执行结果为( )。 Dim A(3,3) For M=1 To 3 For N=1 To 3 If N=M Or N=3-M+1 Then A(M,N)=1 Else A(M,N)=0 End If Next N Next M For M=1 To 3 For N=1 To 3 Print A(M,N) Next N Print Next M
下列程序段的执行结果为 Dim A(3,3) For M=1 To 3 For N=1 To 3 If N=M Or N=3-M+1 Then A(M,N)=1 Else A(M,N)=0 End If Next N Next M For M=1 To 3 For N=1 To 3 Print A(M,N) Next N Print Next M
下列程序段的执行结果为______。 Dim A(3,3) For M=1 To 3 For N=1 To 3 If N=M 0r N=3-M+1 Then A(M,N)=1 Else A(M,N)=0 End If Next N Next M For M=1 To 3 For N=1 To 3 Print A(M, N); Next N Print Next M
下列程序段的执行结果为( )。 Dim A(3,3) For M=1 To 3 For N=1 To 3 If N=M Or N=3-M+1 Then A(M, N)=1 Else A(M,N)=0 End If Next N Next M For M=1 To 3 For N=1 To 3 Print A(M,N) Next N Print Next M
有下列程序段: For i=1 To 4 x=4 For J=1 To 3 x=3 For k=1 To 2 x=x+6 Next k Next j Next i ? x 该程序段的执行结果为______。
下列程序的输出结果是( )。 Dim a a=Array(1,2,3,4,5,6,7,8) i=0 For k=100 To 90 Step-2 s=a(i)^2 If a(i)>3 Then Exit For i=i+1 Next k Print k;i;s
广告位招租WX:84302438

免费的网站请分享给朋友吧