单击命令按钮时,下列程序的执行结果是 Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a=3:b :4:c =5

admin2010-03-30  25

问题 单击命令按钮时,下列程序的执行结果是    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 FirProc(x As Integer, y As Integer, z As Integer)           FirProc:2 * x + y + 3 * z+2       End Function       Function SecProc( x As Integer, y As Integer, z As Integer)           SecProc = FirProc ( z, x, y) + x + 7       End Function

选项 A、20
B、25
C、37
D、32

答案4

解析 此题程序代码中用了嵌套调用,我们对这样的问题要多加小心,不能掉以轻心,千万不要把实参和相对应的形参弄混淆。主调过程Command1_ Click输出的是SecProc(c,b,a)的返回值,调用过程 SecProc时,主调过程分别把实参c、b、a地址传给形参 x、y、z,此时在过程SecProc中,SecProc;FirProc(a,c,B)+7。由此看出,程序段执行此语句时,将调用过程Fir Proc。把实参a,c,b的地址分别传给形参x、y、z,此时在过程FirProc中,FirProc=2*x+y+3*z+2,所以FirProe(a,c,b)=6+4+15+2=27,SecProc(a,c, b)=27+3+7=37。
转载请注明原文地址:https://kaotiyun.com/show/Ei1p777K
0

最新回复(0)