niusouti.com

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

题目

单击命令按钮时,下列程序代码的执行结果为( )。 Private Function FirProc(x As Integer,y As Integer,z As Integer) FirProc=2*x+y+3*z End Funcfion Private Function SecProc(x As Integer,y As Integer,z As Integer) SecProc=FirProc(z,x,y)+x End Funcfion Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim c As Integer a=2 b=3 c=4 Printf SecProc(c,b,a) End Sub

A.21

B.19

C.17

D.34


相似考题
参考答案和解析
正确答案:A
更多“单击命令按钮时,下列程序代码的执行结果为()。Private Function FirProc(x As Integer,y As Integ ”相关问题
  • 第1题:

    单击命令按钮时,下列程序的执行结果是 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输出的是SecProc(c,b,a)的返回值,调用过程SecProc时,主调过程分别把实参c、b、a地址传给形参x、y、z,此时在过程SecProc中,SecProc=FirProc(a,c,b)+c。由此看出,程序段执行此语句时,将调用过程FirProc。把实参a、c、b的地址分别传给形参x、y、z,此时在过程FirProc中,FirProc=2*x+y+3*z,所以FirProc(a,c,b)=6+4+15=25,SecProc(a,c,b)=25+3=28。

  • 第2题:

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

    A. 21

    B.19

    C.17

    D.34


    正确答案:A

  • 第3题:

    单击命令按钮时,下列程序的执行结果是 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 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

  • 第4题:

    单击命令按钮时,下列程序的执行结果是

    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


    正确答案:C
    解析:此题程序代码中用了嵌套调用,我们对这样的问题要多加小心,不能掉以轻心,千万不要把实参和相对应的形参弄混淆。主调过程Command1_Click输出的是SecProc(c,b,a)的返回值,调用过程SecProc时,主调过程分别把实参数c,b,a地址传给形参想,x,y,z,此时在过程SecProc中,SecProc=FirProc(a,c,b)+7。由此看出,程序段执行此语句时,将调用过程FirProc。把实参啊,a,b,c地址分别传给形参x,y,z,此时在过程FirProc中,FirProc=2*x+y+3*z=2,所以FirProc(a,c,b)=6+4+15+2=27,SecProc(a,c,b)=27+3+7=37。

  • 第5题:

    单击命令按钮时,下列程序的执行结果是 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 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输出的是SecProc(c,b,a)的返回值,调用过程SecProc时,主调过程分别把实参c、b、a地址传给形参x、y、z,此时在过程SecProc中,SecProc=FirProc(a,c,b)+c。由此看出,程序段执行此语句时,将调用过程FirProc。把实参a、c、b的地址分别传给形参x、y、z,此时在过程FirProc中,FirProc=2*x+y+3*z,所以FirProc(a,c,b)=6+4+15=25,SecProc(a,c,b)=25+3=28,所以选项C)是正确的。