运行下列程序:Private Sub Command1_Click( )Dim A(10) As IntegerFor i = 1 To 5A(i) = iA(i + 5) = iNext iFor i = 1 To 10s = s + A(i)Next iDebug.Print sEnd Sub单击按钮后,则在立即窗口内显示的结果是( )。A.5B.10C.30D.出错信息

运行下列程序:

Private Sub Command1_Click( )

Dim A(10) As Integer

For i = 1 To 5

A(i) = i

A(i + 5) = i

Next i

For i = 1 To 10

s = s + A(i)

Next i

Debug.Print s

End Sub

单击按钮后,则在立即窗口内显示的结果是( )。

A.5

B.10

C.30

D.出错信息


相关考题:

设有命令按钮Command1的单击事件过程,代码如下:Private Sub Command1_Click()Dim a(3,3)As IntegerFor i=1 To 3For j=1 To 3a(i,j)=i*j+iNext jNext iSum=0For i=1 To 3Sum=Sum+a(i,4-i)Next iPrint SumEnd Sub运行程序,单击命令按钮,输出结果是( )。A.20B.7C.16D.17

下面程序段的运行结果是【 】。Option Base 1Private Sub swap(a()As InteSer)For I=1 to 10\2t=a(i)a(i)=a(10-1+1)a(10-1+1)=tNext1End SubPrivate Sub Form_Click()Dim x(10)As IntegerFor I=1 to 10x(i)=I*2Next1Swap x()For1=1 to 10Print x (i)Next IEnd Sub

在窗体上画1个名称为Command1的命令按钮,然后编写如下事件过程Option Base 1Pribate Sub Command1_Click()Dim a(5.5) As IntegerFor i=1 To 5a(I,j)*5\10Next jNext iS=0For i=1 To 5S=s+a(i,i)Next iPrint sEnd Sub程序运行后,单击命令按钮,输出结果是( )。A.15B.13C.11D.9

( 22 )命令按钮 Command1 的单击事件过程的代码如下:Private Sub Command1_Click( )Dim a(3 , 3)As IntegerFor i=1 To 3For j=1 To 3a(i , j)=i*j+iNext jNext iSum=0For i=1 To 3Sum=Sum+a(i , 4-i)Next iPrint SumEnd Sub运行程序,单击命令按钮,输出结果是( )。A ) 20B ) 7C ) 16D ) 17

下列程序的输出结果是______。Private Sub Command1_Click()Dim arr(1To 10)For i=1 To 10arr(i)=iNext iFor Each i In arr()arr(i)=arr(i)*2+1Next iMsgBox arr(7)End Sub

在窗体上画一个命令按钮,然后编写如下事件过程:Sub BTC(oldCopy() As Integer, newCopy() As Integer)Dim i As IntegerFor i=LBound(oldCopy() ) To UBound(oldCopy() )newCopy(i) =oldCopy(i)Next iEnd SubPrivate Sub Command1_Click()Dim m(10) As Integer, n(10) As IntegerFor i=1 To 10m(i) =i  iNext iCall BTC(m, n)Print n(5)End Sub程序运行后,单击命令按钮输出结果为( )。A.0B.2C.10D.25

在窗体上有一个命令按钮,然后编写如下事件过程:Private Sub Command1_Click()Dim a(5) As StringFOR i=1 To 5a(i) =Chr(Asc("A") +(i-1))NextFor Each b In aPrint b;NextEnd Sub程序运行后,单击命令按钮,输出结果是A.ABCDEB.1 2 3 4 5C.abcdeD.出错信息

阅读程序: Sub p( b () As Integer)For i =1To 4 b(i) = 2(iNext i End Sub Private Sub Command1_Click()Dim a (1 To 4) As Integer a(1)=5 a(2)=6 a(3)=7 a(4)=8 call p (a) For i=1 To 4 Print a(i) Next iEnd Sub运行上面的程序,单击命令按钮,输出结果为。

以下程序的功能是将多维数组a(1 To m,1 To n)中的元素转移到一个名为b(1 To n*m)的一维数组中,完成该程序。OptionBase 1Private Sub Command1_Click(Index As Integer)Dima(1 To 20,1 To 10)Dim b()ReDimb(1 To 200)For i=1 To 20For j=1 To 10A(i,j)=i*jNext jNext iTran a,20,10bEnd SubSub Tran(a()an,n,b())Dim i As IntegerFor i=1 To mFor j=1 To n______=a(i,j)Next jNext iEnd Sub

下面运行程序后,单击命令按钮,输出的结果是 【 】 。Private Sub Command1_Click()Dim a%(1 To 5),i%, s#For i=1 To 5a(i)=iNexts=Fun(a)Print "s="; s;End SubFunction Fun(a() As Integer)Dim t#, i%t=1For i=LBound(a) To UBound(a)t=t  a(i)NextFun=tEnd Function

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

下列程序的输出结果是【 】Private Sub Command1_Click()Dim a(1 To 20)Dim iFor i=l To 20a(i)=iNext iFor Each i In a()a (i) =20Next i

下面程序段的运行结果是【 】。Option Base 1Private Sub Swap (a() As IntegFor I=1 to 10\2t=a(I)a(I)=a(10-I+1)a(10-I+1)=tNext IEnd SubPrivate Sub Form_Click()Dim x(10) As IntegerFor I=1 to 10x(I)=I*2Next ISwap x()For I=1 to 10Print x(I)Next IEnd Sub

设有如下程序:Private Sub Form. Click( )Dim ary(1 To 5)As IntegerDim i As IntegerDim sum As IntegerFor i=1 To 5ary(i)=i+lsum=sum+ary(i)Next iPrint sumEnd Sub程序运行后,单击窗体,则在窗体上显示的是( )。A.15B.16C.20D.25

下列程序段的运行结果是:Private Sub Command1_Click() Dim n AS Integer I =21: n = 3 do while I>n I=I- n Loop Print IEnd Sub在窗体上打印的结果是______。A.3B.5C.6D.8

在窗体中添加一个标签LblResult和一个命令按钮Command1,然后编写程序。程序的功能是单击命令按钮,计算1+2+3+4+5的值,并把结果转化为字符串显示在标签内,能够实现上述功能的程序段是, ( )A.Private Sub Command1_Click() Dim I,R As Integer For I=1 To 5 Step 1 R=R+I Next LblResult. Name=Str$ (R) End SubB.Private Sub Command1_ClickO Dim I,R As Integer For I=1 To 5 Step 1 R=R+I Next LblResult. Caption= Str$ (R) End SubC.Private Sub Command1_Click() Dim I,R As Integer Do While I<5 R=R+I I=I+1 Loop LblResult. Caption=Str$ (R) End SubD.Private Sub Command1_Click() Dim I,R As Integer Do R=R+I I=I+1 Loop While I<5 LblResult. Caption=Str$ (R) End Sub

下列程序的输出结果是【 】。Private Sub Command1_Click()Dim a(1 To 20)Dim iFor i=1 To 20a(i)=iNext iFor Each i In a()a(i)=20Next iPrint a(2)End Sub

一下程序的作用是生成一个10×10的矩阵.该矩阵主对角线上的数据为1,其余数据为0(程序运行结果如下图所示)。该程序不完整,请补充完改程序。Private Sub Command1_Click()Dim a(10,10)As IntegerFor i=1 To【 】For j=1 To 10If【 】Then【 】=1Elsea(i,j)=0End IfNext jNext iFor i =1 To 10For j=1 To 10Print a(i,j);Next jPrintNext iEnd Sub

下面运行程序后,单击命令按钮,输出出的结果是【 】。Private Sub Command1_Click( )Dim a% (1 To 5) ,i%, sFor i = 1 To 5a(i) =iNexts = Fun(a)Print"s="; s;End SubFunction Fun(a() As Integer)Dim t, i%t=1For i = LBound(A0To UBound(a)t=t * a(i)NextFun =tEnd Function

以下能够正确计算1+2+3+…+10的程序是A.Private Sub Command1_Click() Sum=0 ForI=1 To 10 Sum=Sum+I Next I Print Sum End SubB.Private Sub Command1_Click() Sum=0,I=1 Do While I<=10 Sum=Sum+I I=I+1 Print Sum End SubC.Private Sub Command1_Click() Sum=0: I=1 Do Sum=Sum+I I=I+1 Loop While I<10 Print Sum End SubD.Private Sub Command1_Click() Sum=0: I=1 Do Sum=Sum+I I=I+1 Loop Until I<10 Print Sum End Sub

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程序运行后,单击命令按钮,窗体上显示的是( )。

有程序如下: Sub subP(b() As Integer) For i=1 To 4 b(i)=2*i Next i End Sub Private Sub Command1_Click() Dim a(1 To 4) As Integer a(1)=5 a(2)=6 a(3)=7 a(4)=8 subP a() For i=1 To 4 Print a(i) Next i End Sub运行上面程序,单击命令按钮,输出结果为______ 。A. 2 4 6 8B.5 2 2 2C.10 12 14 16D.出错

在窗体上有文本框Text1和命令按钮Command1,并有下列事件过程:Private Sub Command1_Click()Dim i As Integer,n As IntegerFor i=0 To 50i=i+3n=n+1If i10 Then Exit ForNextText1.Text=Str(n)End Sub单击命令按钮,程序运行后,在文本框中显示的值是( )。A.2B.3C.4D.5

下列程序的输出结果是______。Private Sub Command1_Click()Dim arr(1 To 10)For i=l TO 10arr(i)=iNext iFor Each i In arr()art(i)=arr(i)*2+1Next iMsgBox arr(7)End Sub

下列程序的输出结果是( )。Private Sub Command1_Click()Dim arr(1 To 10)For i=1 To 10Next iFor Each i In arr()Next iEnd Sub

在窗体上面1个名称为Command1的命令按钮,然后编写下列事件过程Option Base 1Private Sub,Command1 Click( )Dim a(5,5)ks IntegerFor i=1 To jFor j=1 To 5a(i,j)=(i+j)*5\10Next jNext iS=0For i=1 To js=s+a(i,i)Next iPrint sEnd Sub程序运行后,单击命令按钮,输出结果是( )。A.15B.13C.11D.9

下面程序运行后,单击命令按钮,输出的结果是______。Private Sub Command1_Click()Dim a%(1 To 5),i%,sFor i=1 To 5a(i) =iNexts=Fun(A)Print "s=";s;End SubFunction Fun(a() As Integer)Dim t,i%t=1For i=LBound(A)To UBound(A)t=t*a(i)NextFun=tEnd Function