单选题 VB
题号 #485039

在窗体上画一个命令按钮,其名称为Command1,然后编写如下程序:
Function Func(ByVal x As Integer,Y As Integer)
Y=X * v
If Y>0 Then
Func=x
Else
Func=Y
End If
End Function
Private Sub Command i Click()
Dim a As Integer,b As Integer
a=3
b=4
C=Func(a,B.
Print“a=”:a
Print“b=”:b
Print“c=”:c
End Sub
程序运行后,单击命令按钮,其输出结果是 (  )

进入在线模考

参考答案

A

答案解析

a是以传值方式传给函数过程Func,而b是以传地址方式传给函数过程Func,所以,Func不能修改a的值,但可以修改b的值。调用Func(a,B.后,a的值仍为3,b的值为12。函数返回x的值,即3。所以,答案是A。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考