26.设一个工程由两个窗体组成,其名称分别为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
A B C D
27.在窗体上画一个名称为Comman1的命令按钮,并编写如下程序: 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(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
A B C D
28.设有如下程序 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,则窗体上不显示任何信息
A B C D
29.在窗体上画一个名称为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
A B C D
30.阅读程序 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 Print Sum End Sub 程序运行后,单击窗体,输出结果为 A、13 B、14 C、27 D、15