问题 单项选择题

单击命令按钮执行下列程序,其输出结果是( )。 Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer a=3 b=4 c=5 Prim 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过程中调用SecProc函数,而在SecProc函数中又调用了FirPmc函数。函数调用时,实参和形参要一一对应传递。程序运行过程是:①Ptint SecProc(c,b,s)→Print SecProc(5,4,3);②Sec Proc=FinProc(z,x,y)+x→SecProc=FirProc(3,5,4)+5;③FirProc=2*x+y+3*z→FirProz=3*3+5+3*4=23;④SecProc=28→Print SeProc(c,b,a)→Print28。形参是在被调用的Sub、Function过程中定义的参数名;实参则是在调用的Sub或Function过程中定义的参数名。

单项选择题
单项选择题