设有一个命令按钮Command1的事件过程以及一个函数过程。程序如下:Private Sub Command1 Click( ) Static x A S Integer x=f(x+5) Cls Print XEnd Sub Private Function f(x As Integer)As Integer f=x+xEnd F
2023-04-24
Private Sub Command1 Click( )
Static x A S Integer
x=f(x+5)
Cls
Print X
End Sub
Private Function f(x As Integer)As Integer
f=x+x
End Function
连续单击命令按钮3次,第3次单击命令按钮后,窗体显示的计算结果是( )。
A . 10
B . 30
C . 60
D . 70
参考答案:D
参考解析:
D。【解析】本题考查静态变量,静态变量能将执行后的值储存到变量中。所以当第一次单击按钮
时,x=5,x=f(x+5)=5+5=10,所以x=10,第二次单击按钮时,x=f(x+5)=15+15=30,此时x=30,当第三次单击按钮时,x=f(x+5)=35+35=70,所以答案为D。
使用如下( )保留字可以使只有在定义该类的包中的其他类才能访问该类。
2023-04-24 计算机考级
JScrollPane面板的滚动条是通过哪个对象来实现?( )
2023-04-24 计算机考级
下列命令中用于激活系统守候进程以便能够在Java虚拟机上注册和激活对象的是( )。
2023-04-24 计算机考级
结构化分析方法是面向( )的自顶向下逐步求精进行需求分析的方法。
2023-04-24 计算机考级
当-个应用程序的所有非守护线程终止运行时,但仍然有守护线程在运行,应用程序将( )。
2023-04-24 计算机考级
2023-04-24 计算机考级
2023-04-24 计算机考级
热门标签