运行程序,单击窗体后输出结果是( )。 Private Sub f(ByVal x%, ByRef y%) x = x + y y = y + x End Sub Private Sub Form_Click() Dim x%, y% x = 8: y = 4 Call f(x, y) Print x; y End Sub
A. 8 16
B. 12 20
C. 8 4
D. 12 16
查看答案
窗体上画一个名称为Picture1的图片框,一个名称为Label1的标签控件,然后编写如下程序: Public Sub display(x As Control) If TypeOf x Is Label Then x.Caption = "Visual Basic" Else x.Picture = LoadPicture("pic.jpg") End If End Sub Private Sub Label1_Click() Call display(Label1) End Sub Private Sub Picture1_Click() Call display(Picture1) End Sub 对以上程序,下列叙述中错误的是( )。
A. 程序运行时会出错
B. 过程中的x是控件变量
C. 单击标签,在标签中显示一串文字
D. 单击图片框,在图片框中显示一幅图片
有一子程序定义为Public Sub p(a As Integer, b As Integer),正确的调用语句是( )。
A. sub 2, 3.5
B. Call p 2, 3.5
C. p 2, 3.5
D. Call sub(2, 3.5)
运行程序,单击窗体后输出结果是( )。 Sub test(x%, y%, z%) x = 7: y = 5: z = 9 End Sub Private Sub Form_Click() Dim a%, b% a = 3: b = 8 Call test(a - 1, a, (b)) Print a; b End Sub
A. 3 8
B. 5 8
C. 6 8
D. 5 9
设窗体上有一个Command1命令按钮,还有以下程序代码: Private Sub Command1_Click() Static x As Integer x = x + 1 Call proc(x) Print x, End Sub Private Sub proc(a As Integer) Static x As Integer x = x + a a = x End Sub 程序运行后,3次单击命令按钮,则产生的输出结果是( )
A. 1 2 3
B. 1 3 7
C. 2 4 6
D. 1 3 5