(27)下列函数过程 Function Func(a As Integer,b As Integer)As Integer Static m As Integer,i

19 查阅

(27)下列函数过程 Function Func(a As Integer,b As Integer)As Integer Static m As Integer,i As Integer M=0 i=2 A=i+m+1 b=i+a+b Func2=m End Function Private Sub Command1_Click() Dim p As Integer,k As Integer,m As Integer k=4 m=1 P=Func2(k,m) Print k;m End Sub程序运行后,单击命令按钮,输出结果是 A.3 6<CR>3 6 B.3 6<CR>3 11C.3 11<CR>3 6 D.3 11<CR>3 11

参考答案:

B【解析】本题意在考查调用Func2时,参数是按地址传递的,所以两次调用Func2时,实参k、m的值都改变了。程序运行过程如下:第一次调用Func2(k,m),k被行参a改变为3,m被行参改变为6;第二次调用函数后,a为3,m为11。

计算机二级