窗体上有一个名称为Command1的命令按钮,其单击事件过程如下: Private Sub Command1_Click() Dim x As Integer, y As Integer Static z As Integer x

admin2020-06-30  26

问题 窗体上有一个名称为Command1的命令按钮,其单击事件过程如下:
Private Sub Command1_Click()
    Dim x As Integer, y As Integer
    Static z As Integer
    x = 3: y = 5: z = y
    Call f(x, y, z)
    Print x; y; z
End Sub
Private Sub f(ByVal a As Integer, ByRef b As Integer, c As Integer)
    a = a + a: b = b + b: c = c + c
End Sub
运行程序,单击命令按钮时,3个标签中显示的内容分别是

选项 A、3  5  5
B、3  5  10
C、3  10  5
D、3  10  10

答案D

解析 f(ByVal a As Integer, ByRef b As Integer, c As Integer)函数中a是值传递,b地址传递,c缺省为地址传递。值传递使用两个存储单元,地址传递使用同一个存储单元,会改变变量的值。选D)。
转载请注明原文地址:https://kaotiyun.com/show/5UHp777K
0

随机试题
最新回复(0)