若要使变量x存放数值987654321,则下面空白处应填入()。 Dim i%, x% x = 0 For i = () x = x * 10 + i Next MsgBox(x)
A.9 To 1
B.1 To 9 Step -1
C.1 To 9
D.9 To 1 Step -1
第1题:
执行以下程序段 Dim i As Integer,X As Integer x=0 For i=20 To 1 Step -2 x=x+i\5 Next Print x 后,x的值为______。
A. 16
B.17
C.18
D.19
第2题:
执行以下程序段后,x的值为( )。 Dim x As Integer,i As Integer x=0 For i=20 To 0 Step -2 x=x+i\5 Next i
A.16
B.17
C.18
D.19
第3题:
执行下列程序段后,x的值为______。
Dim x As Integer, i As Integer
x=0
For i=20 To 1 Step -2
x=x +i\5
Next i
第4题:
执行下面的程序段,x的值为 Private Sub Commandl_Click() For i=1 To 5 a=a+i Next i x=Val(i) MsgBox x End Sub
A.5
B.6
C.7
D.8
第5题:
执行以下程序段后,x的值为______。
Dim x As Integer,i As Integer
x=0
For i=20 To 1 Step -2
x=x+i\5
Next i
第6题:
在窗体上绘制一个命令按钮,其名称为Command1,然后编写如下事件过程: Private Sub Command1_Click() Dim i As Integer,x As Integer For i_1 T0 6 If i=1 Then x=i If i<=4 Then x=x+1 Else x=x+2 End If Next i Print x End Sub 程序运行后,单击命令按钮,其输出结果为( )。
A.9
B.6
C.12
D.15
第7题:
单击一次命令按钮之后,下更程序代码的执行结果为______ 。 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 Sub
A.3 4 7 5 6
B.3 5 7 4 5
C.1 2 3 4 5
D.1 2 3 5 7
第8题:
以下程序输出1到1000之间所有的偶数之和,请补充完该程序。 Private Sub Cotmand1_Click() Dim x As Double For i=0 To 1000 If______ Then x=x+ i End If Next i Print x End Sub
A. i Mod 2= 0
B.x mod 2=0
C.I mod 2<>0
D.x mod 2<>0
第9题:
在窗体上画一个名称为Commandl的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim n As Integer For n = 0 To 9 Step 3 Print rel(n); Next n End Sub Private Function rel(ByVal i As Integer)As Integer Dim x As Integer x = 0 For j = 1 To i If i < 5 Then rel = i: EXit Function x = x + i Next i rel = x End Function 程序运行后,单击命令按钮,则窗体上显示的内容是
A.1 3 5 7
B.2 8 14 53
C.0 3 21 45
D.0 5 11 34
第10题:
下列的程序段执行后,x的值为______。Private Sub Command1_Ciick() x =0 for i =1 To 10 for j = i To 10 x=x+1 Next j Next i Print xEnd Sub
A.50
B.55
C.5
D.105
第11题:
下列程序段的执行结果为______。 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
第12题:
执行下面的程序段,x的值为 Private Sub Command1_Click( ) For i=1 To 5 a=a+i Next i x=Val(i) MsgBox x End Sub
A.5
B.6
C.7
D.8
第13题:
下列程序段的执行结果为 ______。 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 x
A.3
B.4
C.5
D.6
第14题:
下面程序段运行后,变量X的值为【 】。
Dim x AS Integer
Dim I AS Integer
x=0
for I=0 to 50 step 10
X=X+I。
next I
Print X
第15题:
下面程序段的运行结果是【 】。
Option Base 1
Private Sub Swap (a() As Integ
For I=1 to 10\2
t=a(I)
a(I)=a(10-I+1)
a(10-I+1)=t
Next I
End Sub
Private Sub Form_Click()
Dim x(10) As Integer
For I=1 to 10
x(I)=I*2
Next I
Swap x()
For I=1 to 10
Print x(I)
Next I
End Sub
第16题:
执行以下程序段
Dim x As Integer,i As Integer
x=0
For i=20 To 1 Step-2 x=x+i\5
Next i
后,x的值为
A.16
B.17
C.18
D.19
第17题:
执行以下程序段 Dim x As Integer, i As Integer x=0 For i=20 To Step -2 x=x+i\5 Next i 后,x的值为
A.16
B.17
C.18
D.19
第18题:
在窗体上画一个名称为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 5
B.0 1 2 3
C.3 2 4 5
D.0 5 8 3
第19题:
单击一次命令按钮后,下列程序的执行结果为
Private Sub Command1_Click()
Dim m As Integer,I As Integer,x(10) As Integer
For I=0 To 4:x(I)=I+1:Next I
For I=1 TO 2:Call Prioc(x):Next I
For I=0 TO 3:Print x(I);:Next I
End Sub
Private Sub Prioc(a()As Integer)
Static I As Integer
Do
a(I)=a(I)+a(I+1)
I=I+1
Loop While I<2
End Sub
A.3 4 7 5
B.3 5 7 4
C.1 2 3 4
D.1 2 3 5
第20题:
编写如下事件过程: 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.6
B.12
C.24
D.47
第21题:
运行以下程序后,显示的结果为 ______。 Dim x(5) x(0) =1 For i=1 To 5 x(i)=x(i-1)*i Print x(i) Next i End
A.1 2 3 4 5
B.1 2 6 24 120
C.1 2 6 12 20
D.1 1 2 3 4
第22题:
下面的程序段执行后,X的结果为______。 X=0 For I=1 to 5 For j=I to 5 X=X+1 Next j Next I Print x
A. 5
B.10
C.15
D.20
第23题:
下列程序段的执行结果为 ______。 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 x
A.3
B.4
C.5
D.6
第24题:
for(i=0;i<n/2;i++)
{
t=x[i];
x[i]=x[n-i-1];
x[n-i-1]=t;
}
for(i=0;i<n;i++)
{
t=x[i];
x[i]=x[n-i-1];
x[n-i-1]=t;
}
for(i=0;i<n/2;i++)
{
t=x[i];
x[i]=x[n-i+1];
x[n-i+1]=t;
}
for(i=0;i<n/2;i+=2)
{
t=x[i];
x[i]=x[n-i-1];
x[n-i-1]=t;
}