试题与答案

在窗体上画一个按钮,然后编写如下事件代码。单击按钮,输出为 ______。 Pr

题型:单项选择题

题目:

在窗体上画一个按钮,然后编写如下事件代码。单击按钮,输出为 ______。 Private Function fun3(x As Integer)Static t As Integer t = t + 3 t = t + x fun3 = t End Function Private Sub Commandl Click() Dim a As Integer, b As Integer, c As Integer a = 2 : b = 1 c = fun3 (a) c = fun3 (b) Print cEnd Sub

A.6

B.8

C.9

D.12

答案:

参考答案:C

解析: 当单击按钮时,首先调用fun3函数过程,把a的值按地址传递给形参x,在fun3函数中首先定义了一个静态变量t,通过两条赋值语句使t的值变为5,5作为函数的返回值并赋值给c;再一次调用fun3函数,此时需注意,静态变量依旧保持上次退出时的5,所以执行下面的两条语句后,a的值是9,把9作为函数的返回值并赋值给c,因此c的输出值为9。

试题推荐
题型:听力题

Kate: Can you tell me more about your school life, Amy?

Amy: S   小题1:    . I go to school at a q  小题2:  past seven. Our classes s 小题3:   at 8 a.m.

Kate: What is your f 小题4:   subject?

Amy: I’m good at G  小题5:  . I like to learn about the w   小题6: .

Kate: Do you have many friends at school?

Amy: Yes! I have a lot of friends. We always have f   小题7: in the playground after c 小题8:   .

Kate: Do you get a lot of h  小题9:  ?

Amy: Yes, but I don’t mind. It’s good for us to p 小题10:   !

查看答案
微信公众账号搜索答案