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

下列程序段的执行结果为______。 Dim m(3,3)As Integer Dim i As Integer Dim j As Integer Dim x As Integer For i=1 To 3 m(i,i)=i Next For i=0 T0 3 For j=0 To 3 x=x+m(i, j) Next Next Print x

A.3

B.4

C.5

D.6


相关考题:

在窗体上画1个命令按钮,其名称为Command1,然后编写如下程序:Private Sub Command1_Click()Dim a(10)As IntegerDim x As IntegerFor i=1 To 10a(i)=8+iNextx=2Print a(f(x)+x)End SubFunction f(x As Integer)x=x+3f=xEnd Function程序运行后,单击命令按钮,输出结果为( )。A.12B.15C.17D.18

下面的程序代码实现将一个一维数组中元素向右循环移动,移位次数由文本框Text输入。例如数组各元素的值依次为0,1,2,3,4,5,6,7,8,9,10;移动三次后,各元素的值依次为8,9,10,0,1,2,3,4,5,6,7。Private Sub Moveright(x()As Integer)Dim i As IntegerDim j As IntegerDim k As Integeri=UBound(x)j=x(i)For k=i To ______ Step-1_______Next kx(LBound(x))=jEnd SubPrivate Sub Command1_Click()Dim a(10)As IntegerDim i As IntegerDim j As IntegerDim k As IntegerFor i=0 To 10a(i)=iNext ij=Val(Text1.Text)k=0Dok=k+1Call MoveRight(a)Loop Until k=jFor i=0 To 10Print a(i);Next iEnd Sub

( 25 )在窗体上画 1 个命令按钮,其名称为 Command1 ,然后编写下列程序:Private Sub Command1_Click( )Dim a ( 10 ) As IntegerDim x As IntegerFor i=1 To 10a(i)=8+iNextx=2Print a(f(x)+x)End SubFunction f(x As Integer)x=x+3f=xEnd Function程序运行后,单击命令按钮,输出结果为( )。A ) 12B ) 15C ) 17D ) 18

以下程序的功能是:将一维组 A 中的 100 个元素分别赋给二维数组 B 的每个元素并打印出来,要求把 A ( 1 )到 A ( 10 )依次赋给 B ( 1 , 1 )到 B ( 1 , 10 ),把 A ( 11 )到 A ( 20 )依次赋给 B ( 2 , 1 )到 B ( 2 , 10 ),……,把 A ( 91 )到 A ( 100 )依次赋给 B ( 10 , 1 )到 B ( 10 , 10 )。请填空。Option Base 1Private Sub Form_Click()Dim i As Integer,j As IntegerDim A(1 To 100) As IntegerDim B(1 To 10,1 To 10) As IntegerFor i=1 To 100A(i)=Int(Rnd * 100)Next iFor i=1 To ________For j=1 To ________B(i,j)= ________Print B(i,j);Next jPrintNext iEnd Sub

下面程序段运行后,变量x的值为上 【 】 。Dim x As IntegerDim i As Integerx=Ofor i=0 to 50 step 10X=X+inext i

设有一个10个元素的数组,下列程序将该数组的第一个元素与第十个元素交换,第二个元素与第九个元素交换……,第五个元素与第六个元素交换,请补充完该程序。Private Sub Commnd1_Click()Dim a(1 To 10)As IntegerDim i As IntegerDim p As IntegerDim t As IntegerDim j As IntegerFor i=1 To 10a(i)=iNext iFor j=1 To 5【 】【 】【 】Next jFor i=1 To 10Print a(i)Next iEnd Sub

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

下列程序段的执行结果为 ______。 Dim m(3,3)As Integer Dim i As Integer Dim j As Integer Dim x 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

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

阅读程序:Function fac(ByVal n As Integer)As IntegerDim temp As Integertemp=1For i%=1 To ntemp=temp*i%Next i%fac=tempEnd FunctionPrivate Sub Form_Click()Dim nsum As Integernsum=1For i%=2 To 4nsum=nsum+fac(i%)Next i%print nsumEnd Sub程序运行后,单击窗体,输出结果是A.35B.31C.33D.37

有如下的程序:Private Sub Command1_Click()Dim k As Integer,m AB IntegerDim P As Integerk=4:m=1P=Fun(k,m) =Print P;P=Fun(k,m) :Print PEnd SubPrivate Function Fun(a As Integer,b As Integer)Static m As Integer,i As Integerm=5:i=2i=i+m+1m=i+a+bFun=m\2End Function单击命令按钮后,输出结果为A. 2 2B.4 4C.5 5D.6 6

在窗体上画一个命令按钮,其名称为Command1,然后编写如下程序:Private Sub Command1_Click()Dim a(10)As IntegerDim x As IntegerFor i=1 To 10a(i)=iNext ix=1MsgBoxa(f(x)+x)End SubFunction f(y As Integer)y=y+2f=yEnd Function程序运行后,单击命令按钮,消息框的输出结果为______。

下面程序段运行后,变量X的值为【 】。Dim x AS IntegerDim I AS Integerx=0for I=0 to 50 step 10X=X+I。next IPrint X

在窗体上画一个命令按钮,其名称为Command1,然后编写如卞程序:Private Sub Command1-Click()Dim a(10) As IntegerDim x As IntegerFor i=1 To 10a(i)=iNext ix=1MsgBox a(f(x)+x)End SubFunction f(y As Integer)y=y+2f=yEnd Function程序运行后,单击命令按钮,消息框的输出结果为______。

设有如下程序: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

阅读以下说明及Visual Basic程序代码,将应填入(n)上处的字句写在对应栏内。[说明]字符组合:程序界面如图示,在文本框Text1中输入若干个任意字符,单击“颠倒”按钮,将这些字符按相反的顺序显示在标签Lable1 中,并在标签Labs1 2处显示字符的个数。例如:输入abcabc2,显示为 2cbabca,组成字符数为4。[Visual Basic 代码]Private Sub cmdshow_ Click (Dim n As IntegerDim I As IntegerDim str1 As StringN=Len ( Text1.Text )For I=n To Step- 1Str1=(1)Next ILabe11. Caption=Str1End SubPrivate Sub cmdcount_ Click ( )Dim n As IntegerDim in As IntegerDim i As IntegerDim j As IntegerDim flag As IntegerDim str1 As IntegerDim str2 As IntegerN=(2)Str1 =Mid$ ( Text1.Text, i. 1For I =2 To nStr2=mid$ ( Text1,Text,I,1M=Len (str1)(3)For j=1 To mIf (4) Then flag= 1; Exit ForNext jIf flag<>1 then str1=str1 str2Next ILable2.Caption=(5)End Sub

阅读以下说明及Visual Basic程序代码,将应填入(n)处的字句写在对应栏内。【说明】以下程序为求行列式X(5,5)的值S。【Visual Basic代码】Private Function col ( byval x ( 5,5 ) as integer ) as longdim fesult as longdim temp as longdim I as integerdim j as integerdim k as imegerresult = 0for I = to 5(1)for j = 1 to 5if I+j>6 thenk= ( 1+j ) mod 5elsek=1endiftemp=temp*x ( k,j )(2)result=(3)(4)(5)End function

有如下事件过程:Private Sub Form. Active ( )Dim Score (1 to 3) As IntegerDim i As IntegerDim t As VariantFori=3 To 1 step-1Score (i) = 2 * iNextFor Each t In ScorePrint tNextEnd Sub程序运行后窗体上显示的值为【 】。

以下程序用于求s=1+(1+2)+(1+2+3)+……(1+2+……100)的和,请补充完该程序。Dim n As IntegerDim i As IntegerDim j As LongDim s As Longn=100j=0s=0For i=1 To【 】J=【 】s=【 】Next iPrint s

以下程序的功能是:将一维数组A中的100个元素分别赋给二维数组B的每个元素并打印出来,要求把A(i)到A(10)依次赋给B(1,1)到B(1,10),把A(11)到A(20)依次赋给B(2,1)到B(2,10),……,把A(91)到A(100)依次赋给B(10,1)到B(10,10)。请填空。Option Base 1Private Sub Form_Click()Dim i As Integer,j As IntegerDim A(1 To 100)As IntegerDim B(1 To 10,1 To 10)As IntegerFor i=1 To 100A(i)=Int(Rnd*100)Next iFor i=1 To【 】For j=1 To【 】B(i,j)=【 】Print B(i,j);Next jPrintNext iEnd Sub

下列程序段执行后,执行的结果是______ 。 Dim M(10) Dim N(10) i=3 For j = 1 To 5 M(j) = j N(i) = 2 * i + j Next j Print N(i); M(i)A.12 4B.11 3C.3 11D.10 2

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

有如下的程序。Private Sub Command1_Click()Dim k As Integer, m As IntegerDim P As Integerk=4: m=1P=Fun(k, m) : Print P;P=Fun(k, m) : Print PEnd SubPrivate Function Fun(a As Integer, b As Integer)Static m As Integer, i As Integerm=5: i=2i=i + m + 1m=i + a + bFun=m \ 2End Function单击命令按钮后,输出结果为A.2 2B.4 4C.5 5D.6 6

以下程序段运行的结果是______。Dim a(-1 To 5) As BooleanDim flag As Booleanflag = FalseDim i As IntegerDim j As IntegerDo Until flag = True For i=-1 To 5 j=j+1 If a(i)= False Then a(i)= True Exit For End If If i = 5 Then flag = True End If NextLoopPrint jA.20B.7C.35D.8

设执行以下程序段时依次输入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

下列程序段的执行结果为 ______。 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

以下是一个竞赛评分程序。8位评委,去掉一个最高分和一个最低分,计算平均分(设满分为10分)。请填空补充完整。Private Sub Form_Click()Dim Max As Integer,Min As IntegerDim i As Integer,x As Integer,s As IntegerDim p As SingleMax=0Min=10For i=1 To 8x=Val(InputBox("请输入分数:"))If【 】Then Max=xIf【 】 Then Min=xs=s+xNext is=【 】p=s/6MsgBox"最后得分:"pEnd Sub