下列程序段运行后,其运行结果是( )。Dim a(3) As Integer, b(3) As IntegerFor k = 0 To 3a(k) = k*k +kb(k) = a(k)-kNext kPrint a(2) + b(1)A. 5B. 6C. 7D. 8

下列程序段运行后,其运行结果是( )。

Dim a(3) As Integer, b(3) As Integer

For k = 0 To 3

a(k) = k*k +k

b(k) = a(k)-k

Next k

Print a(2) + b(1)

A. 5

B. 6

C. 7

D. 8


相关考题:

在窗体上画一个命令按钮,名称为 Command1, 然后编写如下代码:Option Base 0Private Sub Command1_Click()Dim A (4)As Integer,B(4) As IntegerFor k=0 To 2A(k+1)=InputBox(“ 请输入一个整数 ”)B(3-k)=A(k+1)Next kPrint B(k)End Sub程序运行后,单击命令按钮,在输入对话框中分别输入2、4、6,输入结果为( )。 A.0B.2C.3D.4

阅读下列程序:Private Sub Command1_Click()Dim i As Integer, k As Integerk=2For i=1 To 3Print H(k) ;Next iEnd SubFunction H(j As Integer)a=0Static ba=a + 1b=b + 1H=a*b + jEnd Function程序运行后,单击命令按钮输出结果是( )。A.2 3 4B.3 4 5C.5 6 7D.3 5 6

( 25 )在窗体上面画一个命令按钮,名称为 Command1 ,然后编写如下代码:Option Base 0Private Sub Command1_Click()Dim A1(4) As Integer,A2(4) As IntegerFor k=0 To 2A1(k+1)=InputBox( “ 请输入一个整数 ” )A2(3-k)=A1(k+1)Next kPrint A2(k)End Sub程序运行后,单击命令按钮,在输入对话框中依次输入 2 、 4 、 6 ,则输出结果为A ) 0B ) 1C ) 2D ) 3

(27)下列函数过程 Function Func(a As Integer,b As Integer)As Integer Static m As Integer,i As Integer M=0 i=2 A=i+m+1 b=i+a+b Func2=m End Function Private Sub Command1_Click() Dim p As Integer,k As Integer,m As Integer k=4 m=1 P=Func2(k,m) Print k;m End Sub程序运行后,单击命令按钮,输出结果是 A.3 6CR3 6 B.3 6CR3 11C.3 11CR3 6 D.3 11CR3 11

(28)阅读下列程序: Private Sub Commandl_Click() Dim i As Integer,k As Integer k=2 For i=1 To 3 PrintH(K); Next i End Sub Function H(j As Integer) Static b a=0 a=a+1 b=b+1 H=a*b+jEnd Function 单击命令按钮,执行程序,输出结果是A.2 3 4 B.3 4 5 C.5 6 7 D.3 5 6

下面程序:________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

设执行以下程序段时依次输入2,4,6执行结果为 Dim a(4) As Integer,b(4) As Integer For k =0 To 2 a(k + 1) = Val(InputBox( "Enter data:" ) ) b(3 - k) =a(k + 1) Next Print b(k)A.2B.4C.6D.0

有如下程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim p As Integer k=4:m=1 p=PC(k,m):Print p; p=PC(k,m):Print p End Sub Private Function PC(a As Integer,b As Integer) Static m As Integer,i As Integer m=0:i=2 i=i + m + 1 m=i + a + b PC=m End Function 程序运行后,输出的结果为A.4 6B.6 6C.8 8D.10 12

有下列函数过程:Function Func2(a As Integer,b As Integer)As IntegerStaticm As Integer,i As Integerm=0i=2a=i+m+1b=i+a+bFunc2=mEnd Function在窗体上画一个命令按钮,然后编写下列事件过程:Private Sub Command1_Click()Dim p As Integer,k As Inmger,m As Integerk=4m=1p=Func2(k,m)Prim k;mp=Func2(k,m)Print k;mEnd Sub程序运行后,单击命令按钮,输出结果是( )。A.3 6<CR>3 6B.3 6<CR>3 11C.3 11<CR>3 6D.3 11<CR>3 11

下列程序的运行结果是includevoid fun(int * a,int * b){int * k; k=a; a=b; b=k;} 下列程序的运行结果是 #include<iostream.h> void fun(int * a,int * b) { int * k; k=a; a=b; b=k; } void main( ) { int a=3,b=6, * x=a, * y=b; fun(x, y) ; cout < < a < < " " < < b; }A.6 3B.3 6C.编译出错D.0 0

有如下程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim op As Integer k=4:m=1 p=PPC(k,m):Print op; p=PPC(k.m):Print op End Sub Private Function PPC(a As Integer,b As Integer) Static m As Integer,i As Integer m=0:i=2 i=i+m+1 m=i+a+b PPC=m End Function 程序运行后,输出的结果为A.4 6B.6 6C.8 8D.10 12

阅读下列程序: Private Sub Command1_Click( ) Dim i As Integer,k As Integer k=2 For i=1 To 3 Print H(k); Next i End Sub Function H(j As Integer) a=0 Static b a=a+1 b=b+1 H=a*b+j End Function 程序运行后,单击命令按钮输出结果是A.234B.345C.567D.356

下列程序的运行结果是 Private Sub Form_Click() Dim k As Integer n=5 m=1 k=1 Do m=m+2 k=k+1 Loop Until k>n Print m End SubA.1B.12C.11D.32

在窗体上一个名为Commandl的命令按钮,然后编写以下程序:Private Sub Commandl一Click()Dim a(10)As IntegerFor k=10 To 1 Step-1a(k)=20—2*kNext kk=k+7Print a(k—a(k))运行程序.单击命令按钮,输出结果是A.1 8B.12C.BD.6

阅读下列程序:PrivateSubCommand1_Click()Dim i As Integer,k As Integerk=2For i=1 To 3Print Fun(k);NextEnd SubFunction Fun(j As Integer)Static ba=0a=a+1b=b+1Fun=a*b+jEnd Function 程序运行后,单击命令按钮输出结果是A.234B.345C.567D.356

下列程序运行后的输出结果是 ______。 include void main(){ int s=0,k for(k=7;k>=0 下列程序运行后的输出结果是 ______。include<iostream.h>void main(){int s=0,kfor(k=7;k>=0;k--){switch(k){case 1:case 4:case 7:s+ +;break:case 2:case 3:case 6:break;case 0:case 5:s+=2;break;}

在窗体上画一个名称为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

23 有如下程序段,该程序段循环的次数是______。 Dim i As Integer Dim j As Integer Dim k As Integer k=0 For i = 0 To 10 Step 3 For j = 1 To 5 If j > 3 Then k = k + 4: Exit For k=k+1 Print k Next j If i > 8 Then Exit For Next iA.9B.10C.11D.12

Private Sub Commandl Click()Dim i As Integer, j As IntegerDim a (10,10)As IntegerFor i=1 To 3For j= i To 3a(i,j)=(i-1)*3+jPrint a (i,j);Next jPrintNext iEnd Sub程序运行后,单击命令按钮,窗体上显示的是( )。

有如下程序段void fun(int *a, int *b){ int *k; k=a; a=b; b=k;}main(){ int a=3, b=6, *x= fun(x,y); printf("%d %d", a, b);} 程序运行后输出的结果是A.6 3 B.3 6 C.编译出错 D.0 0

有如下的函数过程: Function Func2(a As Integer, b As Integer)'As Integer Static m As Integer, i As Integer m=0 i=2 a=i+m+1 b=i+a+b Func2=m End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim p As Integer, k As Integer, m As Integer k=4 m=1 p=Fune2(k, m) Print k; m p = Func2(k, m) Print k; m End Sub 程序运行后,单击命令按钮,输出结果为( )。A.3 6<CR>3 6B.3 6<CR>3 11C.3 11<CR>3 6D.3 11<CR>3 11

设执行以下程序段时依次输入1、3、5,执行结果为______ 。 Dim a(4)As Integer Dim b(4) As Integer For K=0 To 2 a(K+1)=Val(1nputBox(“请输入数据:”)) b(3-K)=a(K+1) Next K Print b(K)A.1B.3C.5D.0

下面程序运行后的结果是( )。 Private Sub Form_Click() Dim s As Integer,k As Integer,i As Integer,n As Integer s=1 fori=1 to 3 forj=i to 3 for k=j to istep-1 s=s*k nextk,J,i print s End SubA.6B.72C.144D.432

阅读下列程序。Private Sub Command1_Click()Dim i As Integer, k As Integerk=2For i=1 To 3Print Fun(k) ;NextEnd SubFunction Fun(j As Integer)Static ba=0a=a + 1b=b + 1Fun=a  b + jEnd Function程序运行后,单击命令按钮输出结果是A.2 3 4B.3 4 5C.5 6 7D.3 5 6

设执行以下程序段时依次输入2,4,6,执行结果为Dim a(4)As IntegerDim b(4)AS IntegerFor k=0 To 2a(k+1)=Val(InputBox("Enter data:"))b(3 - k) =a(k + 1)Next kPrint b(k)A.2B.4C.6D.0

以下程序运行后,消息框的输出结果是( )。 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 SUBA.33B.28C.35D.37

下列程序段的执行结果为 ______。 Dim m(3,3)As Integer Dim i As Integer Dim j As Integer Dim K As Integer For i=1 To 3 m(i,i)=i Next For i=0 To 3 For j=0 To 3 x=x+m(i,j) Next Next Print xA.3B.4C.5D.6