下面程序段是利用For语句给数组a赋值,使a(1)=1,a(2)=3,a(3)=5,……,a(50)=99,则划线处的语句应该是( )。 Dim a(1 to 50) As Integer For i=1 To 50 ______Next iA、a(i)=2*i+1B、a(i)=2*(i+1)C、a(i)=i+2D、a(i)=2*i-1

下面程序段是利用For语句给数组a赋值,使a(1)=1,a(2)=3,a(3)=5,……,a(50)=99,则划线处的语句应该是( )。 Dim a(1 to 50) As Integer For i=1 To 50 ______Next i

  • A、a(i)=2*i+1
  • B、a(i)=2*(i+1)
  • C、a(i)=i+2
  • D、a(i)=2*i-1

相关考题:

有如下程序#includeusing namespace std;int i=1;class Fun{public;static int i;int value(){return i-1}int value ()const{return i+1;}};int Fun;;i=2;int main(){int i=3;Fun Fun1const Fun fun2;return 0;}若程序的输出结果是:123则程序中下划线处遗漏的语句是______。A.coutB.coutC.coutD.cout

在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Private Sub Command1 Click() Dim i As Integer,j As Integer Dim a(10,10)As Integer For i=1 To 3 For j=1 To 3 a(i,j)=(i-1)*3+j Print a(i,j); Next j Print Next i End Sub 程序运行后,单击命令按钮,窗体上显示的是______。A.1 2 3 2 4 6 3 6 9B.2 3 4 3 4 5 4 5 6C.1 4 7 2 5 8 3 6 9D.1 2 3 4 5 6 7 8 9

下面程序:________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运行后的输出结果为________。A.33B.28C.35D.37

设有数组说明语句:Dim c(-1To1,1To5),则下列表示数组c的元素选项中( )是正确的。 A、c(i+j)B、 c(i)(j)C、c(i-1, i+1)D、 c(1,0)

定义如下变量和数组:int i;int y[2][3]={2,4,6,8,10,12};则下面语句的输出结果是【 】。for(i=0;i<2;i++)cout<<y[1-i)[i+1]<<",";

当Form1_Click事件发生时,窗体上显示的第三行是( )。 Option Base 1 Private Sub Form_Click() Dim i As Integer,j As Integer Dim k As Integer,a(5,5)As Integer For i=1 To 5 k=1 For j=1 To 5 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 5 For j=1 To 5 Print a(i,j); Next j Print Next i End SubA.1 2 3 4 5B.1 1 2 3 4C.1 1 1 2 3D.1 1 1 1 2

下列程序的执行结果是( )。 Privaae Sub Form_Activate Dim score(3)As Integer,total As Integer Dim aa_score As Variant score(1)=50:score(2)=14:score(3)=36 total=0:i=0 For Each aa_score In score i=i+1 total=total+aa_score Print i,aa_score,total Next End SubA.1 0 0 2 50 50 3 14 64 4 36 100B.1 50 50 2 14 64 3 36 100C.0 50 50 1 14 64 2 36 100 3 36 100D.0 0 0 1 50 50 2 14 64

以下程序的输出结果是( )。 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 to3 p(i)=a(I*j) Next j For I=l to 3 k=k+ p (I)*2 Next I Print k End SubA.33B.28C.35D.37

执行下列程序后,变量a的值为 ( ) Dim i As Integer Dim a As Integer a=0 For i=l To 100 Step 2 a=a+l Next iA.1B.10C.50D.100

在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Private Sub Command1_Click( ) Dim i As Integer,j As Integer Dim a(10,10)As Integer For i=1 To 3 For j=1 To 3 a(i,j)=(i-1)*3+j Print a(i,j); Nextj Print Next i End Sub 程序运行后,单击命令按钮,窗体上显示的是A.1 2 3 24 6 3 6 9B.2 3 4 3 4 5 4 5 6C.1 4 7 2 5 8 3 6 9D.1 2 3 4 5 6 7 8 9

下列程序运行时输出的结果是 Option Base 1 Private Sub Form_Click() Dim x(10) As Integer,y(5) As Integer For i=1 to 10 x(i)=10-i+1 Next For i=1 to 5 y(i)=x(2*i-1)+x(2*i) Next For i=1 to 5 Print y(i) Next End SubA.3 7 11 45 19B.19 15 11 7 3C.1 3 5 7 9D.不确定的值

有下面的程序段,其功能是按图1所示的规律输出数据: Dim a(3,5)As Integer For i=1 To 3 For j=1 To 5 a(i,j)=i+j Print a(i,j); Next Print Next若要按图2所示的规律继续输出数据,则接在上述程序段后面的程序段应该是( )。A.For i=1 To 5 For j=1 To 3 Print a(j,i); Next Print NextB.For i=1 T0 3 For j=1 To 5 Print a(j,i); Next Print NextC.For j=l To 5 For i=1 To 3 Print a(j,i); Next Print NextD.For i=1 To 5 For=1 To 3 Print a(i,j): Next Print Next

在窗体上画一个名称为Comlnalld1的命令按钮,然后编写如下程序: Private Sub Command1 Click() Dim i As Integer,j As Integer Dim a(10,10)As Integer For i=1 TO 3 For j=1 TO 3 a(i,j)=(i-1)*3+j Print a(i,j); Next j Print Next i End Sub 程序运行后,单击命令按钮,窗体上显示的是( )。A.1 2 3 2 4 6 3 6 9B.2 3 4 2 4 5 4 5 6C.1 4 7 2 5 8 3 6 9D.1 2 3 4 5 6 7 8 9

在窗体上画一个名称为Commandl的命令按钮,然后编写如下程序: Private Sub Command1_Click() Dim i As Integer,j As Integer Dim a(10, 10)As Integer For i=1 To 3 For i=1 To 3 a(i,j)=(i-1) *3+j Print a(i,j); Next i Print Next i End Sub 程序运行后,单击命令按钮,窗体上显示的是A.1 2 3 246 3 69B.2 3 4 3 4 5 4 5 6C.1 4 7 2 5 8 3 6 9D.1 2 3 4 5 6 7 8 9

在窗体上画一个名称为CoilTlilandl的命令按钮,然后编写如下事件过程: Private Sub command1 Click() Dim m As Integer, i As Integer, x(3)As Integer For i=0 To 3:x(i)=i:Next i For i = 1 To 2: Call sub1(x,i):Next i For i = 0 To 3: Print x(i);: Next i End Sub Private Sub sub1(a()As Integer,k As Integer) Dim i As Integer Do a(k)=a(k)+a(k+1) j = j + 1 Loop While j < 2 End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是A.0 3 7 5B.0 1 2 3C.3 2 4 5D.0 5 8 3

执行下列程序段时,分别在输入框中输入2、4、6,则执行结果是______。 Dim A(4) As Integer Dim B(4) As Integer For i = 0 To 2 A(i + 1) = Val (InputBox (“请输入数据”)) B(3 - i) = A(i + 1) Next i Print B(i)A.2B.4C.6D.8

单击一次命令按钮之后,下更程序代码的执行结果为______ 。 Public Sub Proc(a() As Integer) Static i As Integer Do a(i) = a(i) + a(i + 1) i=i+1 Loop While i < 2 End Sub Private Sub Command1_Cliek() Dim m As Integer Dim i As Integer Dim x(10) As Integer For i = 0 To 4 x(i) = i + 1 Next i For i = 1 To 2 Call Proc (x) Next i For i = 0 To 4 Print x(i); Next i End SubA.3 4 7 5 6B.3 5 7 4 5C.1 2 3 4 5D.1 2 3 5 7

单击一次命令按钮后,下列程序的执行结果为Private Sub Command1_Click()Dim m As Integer,I As Integer,x(10) As IntegerFor I=0 To 4:x(I)=I+1:Next IFor I=1 TO 2:Call Prioc(x):Next IFor I=0 TO 3:Print x(I);:Next IEnd SubPrivate Sub Prioc(a()As Integer)Static I As IntegerDoa(I)=a(I)+a(I+1)I=I+1Loop While I<2End SubA.3 4 7 5B.3 5 7 4C.1 2 3 4D.1 2 3 5

在窗体上画一个名称为Conunand1的命令按钮,然后编写如下程序: Private Sub Command1 Click() Dim i As Integer,j Aa Integer Dim a(10,10)As Integer For i=1 To 3 For j=1 To 3 a(i,j)=(i-1)*3+j Print a(i,j); Next j Print Next i End Sub 程序运行后,单击命令按钮,窗体上显示的是( )。A.1 2 3 2 4 6 3 6 9B.2 3 4 2 4 5 4 5 6C.1 4 7 2 5 8 3 6 9D.1 2 3 4 5 6 7 8 9

运行程序段后输出______个“*”号。 For i=1 To 2 For j=0 To i-1 Print"*" Next j Next iA.1B.2C.3D.4

编写如下事件过程: Option Base 1 Private Sub Form Click() Dim x1()As Integer Dim i As Integer Dim s As Integer ReDim x1(3) For i = 1 To UBound(x1) x1(i)=i + 1 Next i Call sub1(x1) For i = 1 To UBound(x1) s = s + x1(i) Next i Print s End Sub Private Sub sub1(n()As Integer) Dim i As Integer ReDim Preserve n(5) For i = 3 To 5 n(i)=n(i-1)*2 Next i End Sub 程序运行后,单击窗体,则窗体上显示的内容是A.6B.12C.24D.47

阅读程序: Option Base 1 Dim arr() As Integer Private Sub Form. Click() Dim i As Integer,i 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 arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输出结果为A.21B.13C.8D.25

在窗体上画一个命令按钮,然后编写如下程序: Option Base 1 Private Sub Command1 Click() Dim Arr1(12)As Integer, Arr2(3)As Integer Dim Sum As Integer Sum = 2 For i=1 To 12 Arrl(i)= i Next i For i=1 To 3 Arr2(i)= Arrl(i*i) Next i For i = 1 To 3 Sum = Sum + Arr2(i) Next i Print Sum End Sub 程序运行后,单击命令按钮,在窗体上的输出结果为A.16B.24C.32D.36

当发生Form_Click事件时,窗体上显示的第三行是( )。 Option Base 1 Private Sub Form_Click() Dim i As Integer,j As Integer,k As Integer Dim a(5,5)As Integer For i=1 To 5 k=1 For i=1 To 5 If(i<=j)Then a(i,j)=k k=k+2 Else a(i,j)=k+1 End If Next j Next i For i=1 To 5 For j=1 To 5 Print a(i,j); Next j Print Next i End SubA.1 3 5 7 9B.2 1 3 5 7C.2 2 2 1 3D.2 2 1 3 5

int a[10]; 给数组a的所有元素分别赋值为1、2、3、„„的语句是().A、for(i=1;i<11;i++)a[i]=i;B、for(i=1;i<11;i++)a[i-1]=i;C、for(i=1;i<11;i++)a[i+1]=i;D、for(i=1;i<11;i++)a[0]=1;

执行下面的程序,窗体上第二行显示的内容是()。 Dim a(3,3)As Integer,i As Integer,j As Integer For i=1 To 3 For j=1 To 3 a(i,j)=(i-1)*2+j Print a(i,j); Nextj Print Next iA、123B、567C、345D、456

单选题下面程序段是利用For语句给数组a赋值,使a(1)=1,a(2)=3,a(3)=5,……,a(50)=99,则划线处的语句应该是( )。 Dim a(1 to 50) As Integer For i=1 To 50 ______Next iAa(i)=2*i+1Ba(i)=2*(i+1)Ca(i)=i+2Da(i)=2*i-1