首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
窗体中有命令按钮Command1,事件过程如下: Public Function f(x As Integer) As Integer Dim y As Integer x = 20 y = 2 f = x * y End Function
窗体中有命令按钮Command1,事件过程如下: Public Function f(x As Integer) As Integer Dim y As Integer x = 20 y = 2 f = x * y End Function
admin
2015-07-01
30
问题
窗体中有命令按钮Command1,事件过程如下:
Public Function f(x As Integer) As Integer
Dim y As Integer
x = 20
y = 2
f = x * y
End Function
Private Sub Command1_Click()
Dim y As Integer
Static x As Integer
x = 10
y = 5
y = f(x)
Debug.Print x; y
End Sub
运行程序,单击命令按钮,则立即窗口中显示的内容是( )。
选项
A、10 5
B、10 40
C、20 5
D、20 40
答案
D
解析
本题考查的是变量的作用域,程序中命令按钮中的x是用static定义的局部静态变量,只在模块的内部使用,过程执行时才可见。当调用f函数时,所求的f函数的值是f函数中x和y的值乘积,即f函数的值是2*20=40,调用f函数后,原命令按钮中x的值被f函数的值覆盖,即x=20,。最后输出x=20,y=40,故答案为D)。
转载请注明原文地址:https://kaotiyun.com/show/v1gp777K
本试题收录于:
二级Access题库NCRE全国计算机二级分类
0
二级Access
NCRE全国计算机二级
相关试题推荐
设有如下代码:x=0Dox=x+1LoopWhilex>=______运行程序,要求循环体执行4次后结束循环,请在空白处填入适当语句使程序完整。
某文本型字段的值只能是字母且不允许超过4个,则可将该字段的输入掩码属性定义为()。
对长度为n的线性表进行顺序查找,在最坏情况下需要比较的次数为()。
在面向对象方法中,类之间共享属性和操作的机制称为【】。
用于执行指定的外部应用程序的宏命令是
直接将命令发送ODBC数据,它使用服务器能接受的命令,利用它可以检索或更改记录的是
下图所示的数据模型属于
设有如下代码:x=0Dox=x+1LoopWhilex>=______运行程序,要求循环体执行4次后结束循环,请在空白处填入适当语句使程序完整。
以下程序段运行结束后,变量x的值为()。x=1y=2Dox=x*yy=y+1LoopWhiley<2
随机试题
易引起电光性眼炎这种职业病的是()
【背景资料】A施工单位于2009年5月承接某科研单位办公楼机电安装项目,合同约定保修期为一年。工程内容包括:给排水、电气、消防、通风空调、建筑智能系统。其中:办公楼实验中心采用一组(5台)模块式水冷机组作为冷热源,计算机中心采用10%余热回收水冷
A公司投标该工程,投标时钢筋价格为4500元/t,合同约定市场价在投标价上下浮动10%内不予调整;上下浮动超过10%时,对超出部分按月进行调整。市场价以当地造价信息中心公布的价格为准。该公司现有的钻孔机械为回旋钻机、冲击钻机、长螺旋杆钻机各若干台提供本工程
通常可疑类贷款的关键特征表现为()。
在按当月发放工资进行费用分配情况下,如果企业期末“应付工资”账户出现贷方余额时,它对当期生产成本的影响是()。
某公司上年的每股收益为4元,将净利润的30%作为股利支付,预计从今年开始净利润和股利长期保持6%的增长率,该公司的β值为1.2。若同期无风险报酬率为5%,市场平均报酬率为10%,采用市盈率模型计算的公司股票价值为()元。
甲上市公司(以下简称“甲公司”)经批准于2×16年1月1日以5010万元的价格(不考虑相关税费)发行面值总额为5000万元的可转换公司债券,筹集资金专门用于某工程项目。(1)该可转换公司债券期限为3年,票面年利率为5%,实际年利率为6%。自2×17年起,
()是亚洲重要的湿地自然保护区,有“中国鹤湖”之称。
设函数y(x)具有二阶导数,且曲线l:y=y(x)与直线y=x相切于原点,记α为曲线l在点(x,y)处切线的倾角,若,求y(x)的表达式。
Whatdoesthemanwanttoorder?
最新回复
(
0
)