第1题:
有以下程序: 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(i)=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 8
B.5 6 7 8
C.10 12 14 6
D.出错
第2题:
有以下程序: 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 subPa() For i=1 To 4 Print a(i) Next i End Sub 运行上面的程序,单击命令按钮,输出结果为( )
A.2 4 6 8
B.5 6 7 8
C.10 12 14 16
D.出错
第3题:
下面程序段的运行结果是【 】。
Option Base 1
Private Sub swap(a()As InteSer)
For I=1 to 10\2
t=a(i)
a(i)=a(10-1+1)
a(10-1+1)=t
Next1
End Sub
Private Sub Form_Click()
Dim x(10)As Integer
For I=1 to 10
x(i)=I*2
Next1
Swap x()
For1=1 to 10
Print x (i)
Next I
End Sub
第4题:
有如下程序: Private Sub Commandl_Click( ) Dim i As Integer For i=1 To 2 DS Next i End Sub Sub DS( ) Dim x As Integer,m As String Static y,n X=X + 1 y=y + 1 m=m &"*”:n=n&"#" Print x,y,m,n End Sub 程序运行后,输出的结果是
A.1 1 * #
B.1 1 * #
C.1 1 * # 1 1 * # 1 2 * #
D.1 1 * # 1 1 * ## 1 2 * ##
第5题:
下面程序段的运行结果是【 】。
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
第6题:
程序执行结果s的值是【 】.
Private Sub Command l-Click ()
I =0
Do
S= I +S
I = I + l
Loop Until I >=4
End Sub
第7题:
阅读程序: 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运行上面的程序,单击命令按钮,输出结果为。
第8题:
下列程序的输出结果是______。
Private Sub Command1_Click()
Dim arr(1To 10)
For i=1 To 10
arr(i)=i
Next i
For Each i In arr()
arr(i)=arr(i)*2+1
Next i
MsgBox arr(7)
End Sub
第9题:
下面程序的输出结果是【 】。
Private Sub Commandl_Click( )
Dim a(1 To 20)
Dim i
Fori = 1 To 20
a(i) = i
Next i
For Each i In a( )
a(i) = 20
Next i
Print a(2)
End Sub
第10题:
以下程序的运行结果是( ) #define MAX 10 int a[MAX],i; main() { printf("\n");sub1();sub3(A) ,sub2(),sub3(A) ; } sub2() { int a[MAX],i,max; max=5; for(i=0;i<max;i++)a[i]=i; } sub1() {for(i=0;i<MAX;i++)a[i]=i+i; } sub3(int a[]) { int i; for(i=0;i<MAX,i++)printf("%d",a[i]); printf("\n"); }
A.0 2 4 6 8 10 12 14 16 18 0 1 2 3 4
B.0 1 2 3 4 0 2 4 6 8 10 12 14 16 18
C.0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
D.0 2 4 6 8 10 12 14 16 18 0 2 4 6 8 10 12 14 16 18