[单项选择题] 有如下函数过程。 Function Fun( By Val x As Integer,By Val y As Integer) As Integer Do While y <>

13 查阅

[单项选择题] 有如下函数过程。

Function Fun( By Val x As Integer,By Val y As Integer) As Integer

Do While y <> 0

reminder = x Mod y

xmy

y = reminder

Loop

Fun = x

End Function

以下调用函数的事件过程,该程序的运行结果是

Private Sub CommandT_Click( )

Dim a As Integer,b As Integer

a = 100:b =25

x =Fun(a,B)

Print x

End Sub

A.0

B.25

C.50

D.100

参考答案:

B

函数的参数传递分为按值传递和按地址传递。按值传递是指,实参直接将值传递给形参,形参不改变实参的值;按地址传递是指,实参将变量的地址传递给形参。在调用函数时要注意参数的传递方式,不同的传递方式,语句执行结果不同。

计算机考试