设有如下程序: Private Sub Form. Click( ) Dim ary(1 To 5)As Integer Dim i As Integer Dim sum As Integer For i=1 To 5 ary(i)=i+l sum=sum+ary(i) Next i Print sum End Sub 程序运行后,单击窗体,则在窗体上显示的是( )。
A.15
B.16
C.20
D.25
第1题:
有如下程序: 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 6
B.6 6
C.8 8
D.10 12
第2题:
设有如下程序: Private Static Function Fac(n As Integer)As Integer Dim f As Integer f=f+n Fac=f End Function Private Sub Form_Click( ) Dim I As Integer For 1=2 To 3 Print"#";I&“=”&Fac(1) Next I End Sub 程序运行后,单击窗体,在窗体上显示的是
A.#2=2 #3=3
B.#2=2 #3=5
C.#;2=2 #;3=3
D.#;2=2 #3;=5
第3题:
以下有关数组定义的语句序列中,错误的是
A.Static arrl(3) arr1(1)=100 arrl(2)="Hello" arrl(3)=123.45
B.Dim arr2()As Integer Dim size As Integer Private Sub Command2_Click() size=InputBOX(“输入:”) ReDim arr2(size) ┄ End Sub
C.Option Base 1 Private Sub Command3_Click() Dim arr3(3)As Integer ┄ End Sub
D.Dim n As Integer Private Sub Command4_Click() Dim arr4(n)As Integer ┄ End Sub
第4题:
有如下程序: 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 6
B.6 6
C.8 8
D.10 12
第5题:
有如下的程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim P As Integer k=4:m=1 P=Fun(k,m):Print P; P=Fun(k,m):Print P End Sub Private Function Fun(a As Integer,b As Integer) Static m As Integer,i As Integer in=5:i=2 i=i+m+1 m=i+a+b Fun=m\2 End Function 单击命令按钮后,输出结果为
A.2 2
B.4 4
C.5 5
D.6 6
第6题:
在窗体上画一个名称为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
第7题:
有如下程序:: Private Sub Form. Click() Dim i As Integer,sum As Integer sum=0 For i=2 To 10 If i Mod 2 <>0 And i Mod 3=0 Then sum=sum+i End If Next i Print sum End Sub 程序运行后,单击窗体,输出结果为______。
A. 12
B.30
C.24
D.18
第8题:
阅读程序: Function fac(ByVal As Integer)As Integer Dim temp As Integer temp=1 For i%=1 To n temp=temp*i% Next i% fac=temp End Function Private Sub Form. Click( ) Dim nsum As Integer nsum=1 For i%=2 T0 4 nsum=nsum+fac(i%) Next i% Print nsum End Sub 程序运行后,单击窗体,输出结果是( )。
A.35
B.31
C.33
D.37
第9题:
编写如下事件过程: 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
第10题:
设有如下程序:
Private Sub Form. Click( )
Dim s As Long,f As Long
Dim n As Integer,i As Integer
f=1
n=4
For i=1 To n
f=f*i
s=s+f
Next i
Print s
End Sub
程序运行后,单击窗体,输出结果是( )。
A.32
B.33
C.34
D.35
第11题:
设有如下程序: Private Sub Form_ Click() Dim a Dim i As Integer, j As Integer a = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) For i = 0 To 3 Print a(5 - i) Next End Sub程序运行后,单击窗体,则在窗体上显示的是______。。
A.4 3 2 1
B.5 4 3 2
C.6 5 4 3
D.7 6 5 4
第12题:
下列程序打印结果为 ______。Private Sub Command1_ Click() Dim a(5)As String Dim b As Integer Dim i As Integer for i = 0 To 5 a(i)= i +1 Print a(i); Next iEnd Sub
A.12345
B.6
C.1 2 3 4 5 6
D.0
第13题:
设有如下程序: Private Sub Form. Click( ) Dim i As Integer,x As String,y As String x="ABCDEFG" For i=4 To 1Step-1 y=Mid(X,i,i)+y Next i Print y End Sub 程序运行后,单击窗体,输出结果为( )。
A.ABCCDEDEFG
B.AABBCDEFG
C.ABCDEFG
D.AABBCCDDEEFFGG
第14题:
下列程序共执行了______次循环。Private Sub Command1_ Click () Dim intsum As Integer Dim i AS Integer Dim j As Integer i = 1 j = 1 do do intsum = intsum + j =j+2 Print j; Loop until j >3 i = i+1 Loop until i>17 Print Print intsumEnd Sub
A.14
B.15
C.14
D.13
第15题:
以下有关数组定义的语句序列中,错误的是 ______。
A.Static arrl(3) arrl(1)=100 arrl(2)="Hello" arrl(3)123.45
B.Dim arr2()As Integer Dim size As Integer Private Sub Command2_click() size=InputBox("输入:") ReDimarr2(size) End Sub
C.Option Base1 Private Sub Command3_click() Dim arr3(3)As Integer End Sub
D.Dim n As Integer Private Sub Command4_Click() Dim arr4(n)As Integer End Sub
第16题:
以下有关数组定义的语句序列中,错误的是 ______。
A.Static arr1(3) arr1(1)=100 arr1(2)="Hello" arr1(3)=12345
B.Dim arr2()As Integer Dim size As Integer Private Sub Command2_Click() size=Input Box("输入:") ReDimarr2(size) ... End Sub
C.Option Base 1 Private Sub Command3_Click() Dim arr3(3)As Integer ... End Sub
D.Dim n As Integer Private Sub Command4_Click() Dim arr4(n)As Integer ... End Sub
第17题:
在窗体上画一个名称为Text1的文本框,然后编写如下代码: Option Base 1 Private Sub Form. Click() Dim arr Dim Start As Integer, Finish As Integer Dim Sum As Integer arr = Array(12, 4, 8, 16) Start = LBound (arr) Finish = UBound (arr) Sun = 0 For i = Start To Finish Sum = Sum + arr(i) Next i c = Sum/Finish Text1.Text = c End Sub程序运行后,单击窗体,则在文本框中显示的内容是______。
A.40
B.10
C.12
D.16
第18题:
有过程如下:Sub fact (m As Integer, total As Long) Dim i As Integer total = 1 for i = 1 To m total = total*i Next iEnd Sub调用它的事件过程如下:Private Sub Command1_ Click () Dim tot As Long Dim a As Integer a = Val InputBox (“请输入数据”)) Call fact (a, tot) Print totEnd Sub则输入数据5,运行结果为 ______。
A.100
B.120
C.200
D.50
第19题:
有如下的程序。 Private Sub Commandl_Click( ) Dim k As Integer, m As Integer Dim P As Integer k=4: m=1 P=Fun(k, m) : Print P; P = Fun ( k, m) : Print P End Sub Private Function Fun( a As Integer, b As Integer) Static m As Integer, i As Integer m=5:i=2 i=i+m+1 m=i + a + b Fun=m\2 End Function 单击命令按钮后,输出结果为
A.2 2
B.4 4
C.5 5
D.6
第20题:
有如下的程序:Private Sub Command1_Click( ) Dim k As Integer,m As Integer Dim P As Integer k=4:m=1 P=Pid(k,m) :Print P; P=Pid(k,m) :Print PEnd SubPrivate Function Pid(a As Integer,b As Integer) Static m As Integer,i As Integer m=5:i=2 i=i + m + 1 m=i + a + b Pid=m\2End Function单击命令按钮后,输出结果为
A.2 2
B.4 4
C.5 5
D.6 6
第21题:
阅读程序: Option Base 1 Dim arr() As Integer Private Sub Form. Click() Dim i As Integer,i As Integer ReDim arr(3,2) For i=1 To 3 For j=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输出结果为
A.21
B.13
C.8
D.25
第22题:
以下有关数组定义的语句序列中,错误的是______。
A.Static arrl(3) arrl(1)=100 arrl(2)="Hello" arrl(3)=123.45
B.Dim arr2()As Integer Dim size As Integer Private Sub Command2 Click() size=InputBox("输入:") ReDimarr2(size) End Sub
C.Option Basel Private Sub Command3 Click() Dim arr3(3)As Integer End Sub
D.Dim n As Integer Private Sub Command4 Click() Dim arr4(n) As Integer End Sub
第23题:
设有如下程序:
Private Sub Form. Click( )
Dim i As Integer,x As String,y As String
x="ABCDEFG"
For i=4 To 1Step-1
y=Mid(X,i,i)+y
Next i
Print y
End Sub
程序运行后,单击窗体,输出结果为( )。
A.ABCCDEDEFG
B.AABBCDEFG
C.ABCDEFG
D.AABBCCDDEEFFGG