问题 单项选择题

单击命令按钮时,下列程序的执行结果是
Private Sub Command1_Click( )
Dim a As Integer,b As Integer,c As Integer
a=3
b=4
C=5
Print SecProc(c,b,a)
End Sub
Function Fir Proc(x As Integer,y As Integer,z As Integer)
Fir Proc=2*x+y+3*z
End Function
Function SecProc(x As Integer,y As Integer,z As Integer)
SecProc=FirProc(z,x,y)+x
End Function

A.20

B.22

C.28

D.30

答案

参考答案:C

解析: 主调过程Command1_Click输出的是Sec Proc(c,b,a)的返回值,调用过程Sec Proc时,主调过程分别把实参c、b、a地址传给形参x、y、z,此时在过程Sec Proc中,
Sec Proc=Fir Proc(a,c,b)+c。由此看出,程序段执行此语句时,将调用过程Fir Proc。把实参a、c、b的地址分别传给形参x、y、z,此时在过程Fir Proc中,Fir Proc=2*x+y+3*z,所以Fir Proc(a,c,b)=6+4+15=25,SecProc(a,c,b)=25+3=28。

单项选择题
多项选择题