若有如下Sub过程: Sub sfun(x As Single,y As Single) t=x x=t/y y=tMod y End Sub 在窗体中添加一个命令按钮Command33,对应的事件过程如下: Ptivate Sub Command33_C

admin2021-09-06  24

问题 若有如下Sub过程:
Sub sfun(x As Single,y As Single)
t=x
x=t/y
y=tMod y
End Sub
在窗体中添加一个命令按钮Command33,对应的事件过程如下:
Ptivate Sub Command33_Click()
Dim a As Single
Dim b As Single
a=5:b=4
sfun(a,b)
MsgBox a&chr(10)+chr(13)&b
End Sub
打开窗体运行后,单击命令按钮,消息框中有两行输出,内容分别为(     )。

选项 A、l和1
B、1.25和1
C、1.25和4
D、5和4

答案B

解析 此题中设定了一个sfun()函数,进行除法运算和求模运算。命令按钮的单击事件中,定义两变量a=5,b=4,调用sfun函数传递a,b的值给x,y进行运算,t=x=5,y=4;x=t/y=5/4=1.25(除法运算);y=tMody=5mod4=1(求模运算)。Sfun函数参数没有指明参数传递方式,则默认以传址方式传递,因此a的值为1.25,b的值为1。
转载请注明原文地址:https://kaotiyun.com/show/jWvp777K
0

最新回复(0)