单击命令按钮时,下列程序代码的执行结果为 ( ) Function FirProc(x As Integer, y As Integer, z As Integer) FirProc=2*x+y+3*z End Fu

admin2010-03-30  20

问题 单击命令按钮时,下列程序代码的执行结果为    (    )    Function FirProc(x As Integer, y As Integer, z As Integer)         FirProc=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    Private Sub Commandl Click()        Dim a As Integer, b As Integer, c As Integer        a=2 :b=3 :c=4        Print SecProc(c, b,A)End Sub

选项 A、21
B、19
C、17
D、34

答案1

解析 执行语句Print SecProc (c,b,a)时,调用SecProc函数,此时将实参c, b,a的值对应传递给形参x,y,z。得SecProc =FirProc(a,c,b)+c,此时又需要调用Fir- Proc函数将a,c,b的值传递给对应形参x,y, z。在FirProc函数中执行语句FirProc=2*x +y+3*z即执行语句FirProe=2*a+c+3 *b其结果值为2*2+4+3*3即17。故 FirProe(a,c,b)的返回值为17。再与c相加即得SecProc函数的返回值结果21。选项A正确。
转载请注明原文地址:https://jikaoti.com/ti/1qg0FFFM
0

随机试题
最新回复(0)