单选题
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。
你可能感兴趣的试题
A.a=30 b=10
B.a=30 b=30
C.a=10 b=30
D.a=10 b:10
A.在Sub过程中可以调用Function过程
B.在用Call调用Sub过程时必须把参数放在括号里
C.在Sub过程中可以嵌套定义Function过程
D.用Static声明的过程中的局部变量都是Static类型
A.ABCD和10
B.1234和100
C.ABCD和100
D.1234和10