设程序中有如下数组定义和过程调用语句: Dim a(10) As Integer …… Call p(a) 以下过程定义中,正确的是( )。
A. Private Sub p(a(10) As Integer)
B. Private Sub p(a As Integer)
C. Private Sub p(a(n) As Integer)
D. Private Sub p(a() As Integer)
查看答案
有如下的Sub子过程定义: Sub P(a%, b%) … End Sub 下面调用该过程正确的语句是( )。
A. P(10,20)
B. Call P 10,20
Call P
D. P 10,20
在窗体上画一个名称为Command1的命令按钮,然后编写如下代码: Public Sub S(x As Integer, y As Integer) Static z As Integer y = x * x + z z = y End Sub Private Sub Command1_Click() Dim i As Integer, y As Integer m = 0: y = 0 For i = 1 To 3 S i, y m = m + y Next Print m End Sub 程序运行后,单击命令按钮,在窗体上输出的内容是( )。
A. 7
B. 14
C. 50
D. 20
运行程序,单击命令按钮Command1后窗体上输出结果为( )。 Public Sub Fun(a(), ByVal x%) For i = 1 To 5 x = x + a(i) Next End Sub Private Sub Command1_Click() Dim arr(5), n% For i = 1 To 5 arr(i) = i Next n = 15 Call Fun(arr(), n) Print n End Sub
A. 20
B. 25
C. 15
D. 30
在窗体上画一个名称为Command1的命令按钮,编写以下程序: Private Sub Command1_Click() Dim n As Integer n = 2 sub1 n End Sub Private Sub sub1(x As Integer) x = x * 2 + 1 If x < 10 Then sub1 (x) End If x = x * 2 + 1 Print x, End Sub 程序运行后,单击该命令按钮,窗体上显示的是( )。
A. 23 47
B. 47
C. 23 11
D. 11