在窗体上画一个命令按钮,其名称为Command1,然后编写如下程序:Function Func(ByVal x As Integer, y As Integer) y=x*y If y >0 Then Func = x El

admin2013-04-11  15

问题 在窗体上画一个命令按钮,其名称为Command1,然后编写如下程序:Function Func(ByVal x As Integer, y As Integer)    y=x*y    If y >0 Then        Func = x    Else        Func = y    End IfEnd FunctionPrivate Sub Command1_ Click( )    Dim a As Integer, b As Integer    a=3    b=4    c = Func(a, B )    Print "a="; a    Print "b="; b    Print "c="; cEnd Sub程序运行后,单击命令按钮,其输出结果为______。

选项 A、a=3  b=12  c=3
B、a=3  b=4  c=3
C、a=3    b=4    c=12
D、a=13  b=12  c=12

答案A

解析 函数Func(3,4)的返回值为3,故c的值为3。由于参数x是按值传递的,a的值仍为3;而参数y是按地址传递的,b的值变为3*4。
转载请注明原文地址:https://kaotiyun.com/show/WBQp777K
0

相关试题推荐
最新回复(0)