P>(21)设一个工程由两个窗体组成,其名称分别为Form1和Form2,在Form1上有一个名称为Command1的命令按钮。窗体Form1的程序代码如下:
Private Sub Command1_Click()
Dim a As Integer
a=10
Call g(Form2,a)
End Sub
Private Sub g(f As Form,x As Integer)
y=IIf(x>10,100,-100)
f,Show
f.Caption=y
End Sub
运行以上程序,正确的结果是
A.Form1的Caption属性值为100
B.Form2的Caption属性值为-100
C.Form1的Caption属性值为-100
D.Form2的Caption属性值为100
(22)在窗体上画一个名称为Command1的命令按钮,并编写如下程序:
Private Sub Command1_Click()
Dim x As Integer
Static y As Integer
x=10
y=5
Call f1(x,y)
Print x,y
End Sub
Private Sub f1(ByRef x1 As Integer, y1 As Integer)
x1=x1+2
y1=y1+2
End Sub
程序运行后,单击命令按钮,在窗体上显示的内容是
A.10 5
B.12 5
C.10 7
D.12 7
(23)设有如下程序
Option Base 1
Private Sub Command1_Click()
Dim a(10)As Integer
Dim n As Integer
n=InputBox("输入数据")
If n<10 Then
Call GetArray(a,n)
End If
End Sub
Private Sub GetArray(b()As Integer,n As Integer)
Dim c(10)As Integer
j=0
For i=1 To n
b(i)=CInt(Rnd()*100)
If b(i)/2=b(i)\2 Then
j=j+1
c(j)=b(i)
End If
Next
Print j
End Sub
以下叙述中错误的是
A.数组b中的偶数被保存在数组c中
B.程序运行结束后,在窗体上显示的是c数组中元素的个数
C.GetArray过程的参数n是按值传送的
D.如果输入的数据大于10,则窗体上不显示任何显示
(24)在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:
Option Base 1
Private Sub Command1_Click()
Dim a
a= Array(1,2,3,4,5)
For i=1 To UBound(a)
a(i)= a(i)+i-1
Next
Print a(3)
End Sub
程序运行后,单击命令按钮,则在窗体上显示的内容是
A.4
B.5
C.6
D.7
(25)阅读程序
Option Base 1
Private Sub Form_Click()
Dim arr,Sum
Sum = 0
arr = Array(1,3,5,7,9,11,13,15,17,19)
For i=1 To 10
If arr(i)/3 = arr(i)\3 Then
Sum = Sum + arr(i)
End If
Next i <
上一页 [1] [2] [3] [4] [5] [6] 下一页
责任编辑:小草