首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
窗体中有命令按钮Command1,事件过程如下: Public Function f(x As Integer)As Integer Dim y As Integer x=20 y=2 f=x*y End Function Private Sub Comm
窗体中有命令按钮Command1,事件过程如下: Public Function f(x As Integer)As Integer Dim y As Integer x=20 y=2 f=x*y End Function Private Sub Comm
admin
2018-12-22
45
问题
窗体中有命令按钮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。
转载请注明原文地址:https://kaotiyun.com/show/2vMp777K
本试题收录于:
二级Access题库NCRE全国计算机二级分类
0
二级Access
NCRE全国计算机二级
相关试题推荐
在一个宏的操作序列中,如果既包含带条件的操作,又包含无条件的操作,则带条件的操作是否执行取决于条件表达式的真假,而没有指定条件的操作则会()。
设计数据库的存储结构属于()。
Access中,文本框分为三种类型:结合型、非结合型与【】。
通过宏打开某个数据表的宏命令是【】。
对待排序文件的初始状态不作任何要求的排序方法有()。
在创建报表的过程中,可以控制数据输出的内容、输出对象的显示或打印格式,还可以在报表制作的过程中,进行数据的【】。
设栈S和队列Q的初始状态为空,元素e1、e2、e3、e4、e5和e6依次通过栈S,一个元素出栈后即进入队列Q,若6个元素出队的顺序是e2、e4、e3、e6、e5、e1则栈S的容量至少应是【】。
可设置分组字段显示分组统计数据的报表是()。
假设学生表中有一个“姓名”字段,查找姓“李”的记录的准则是()。
下列叙述中错误的是()。
随机试题
下列对典故的解释错误的是【】
A.镇心安神,清热解毒B.镇惊安神,纳气定喘C.平肝潜阳,收敛固涩D.清热化痰,宽胸散结E.养心安神,润肠通便柏子仁的功效是
A.药物按正常用法用量使用时,出现的与治疗目的无关的不适反应B.在药物剂量过大或体内蓄积过多时发生的危害机体的反应C.在停药后血药浓度已降低至最低有效浓度以下时仍残存的药理效应D.一些患者在初服某种药物时,由于机体对药物作用尚未适应而引起不可耐受的强
肾的______失司时,则可见______,故说肾开窍于______。
墙体的稳定性要求,除采取必要的加固措施外,必须控制墙体的:()
利益相关者之间的信息双向交流,例如在政府和受益者或受项目影响群体之问的信息交流属于利益相关者的参与机制中的()环节。
某个人或经济组织的行为活动影响了他人或经济组织。却没有为之承担相应的成本或没有获得相应的收益,这种情况称为()。
地上权属于()。
金融资本形成的主要途径包括()
双腿瘫痪以后,我的脾气变得暴躁无常,听着录音机里甜美的歌声,我会猛地把手边的东西摔向四周的墙壁。母亲这时就悄悄地躲出去,在我看不见的地方偷偷地听着我的动静。当一切恢复沉寂,她又悄悄地进来,眼圈红红的,看着我。“听说北海的花儿都开了,我推着你去走走。”她总是
最新回复
(
0
)