[单项选择题] 有如下的函数过程: Function Func2(a As Integer,b As Integer) ’As Integer Static m As Integer,i As I

13 查阅

[单项选择题] 有如下的函数过程: Function Func2(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 Integerk=4m=1p=Func2(k,m)Print k; mp=Func2(k,m)Print k; m End Sub 程序运行后,单击命令按钮,输出结果为( )。

A.3 6<CR>3 6

B.3 6<CR>3 11

C.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。

计算机考试