首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
窗体中有命令按钮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
35
问题
窗体中有命令按钮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://jikaoti.com/ti/9q20FFFM
本试题收录于:
二级Access题库NCRE全国计算机二级分类
0
二级Access
NCRE全国计算机二级
相关试题推荐
在名为“Form1”的窗体上添加三个文本框和一个命令按钮,其名称分别为“txt1”、“txt2”、“txt3”和“Command1”,然后编写如下两个事件过程:PrivateSubCommand1_Click()txt3=txt1+tx
设有如下程序:PrivateSubCommand1_Click()DimsumAsDouble,xAsDoublesum=0n=0Fori=1To5x=n/in=n
设计程序时,应采纳的原则之一是()。
下列叙述中正确的是()。
若要在子过程Proc1调用后返回两个变量的结果,下列过程定义语句中有效的是()。
为窗体中的命令按钮设置单击鼠标时发生的动作,,应选择设置其属性对话框的()。
设Student为学生关系,SC为学生选课关系,Sno为学生号,Sname为学生姓名,Cno为课程号,执行下面SQL语句的查询结果是()。SelectStudent.SnameFromStudent,SCWhereSt
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:PrivateSubCommand1_Click()a=0Fori=1TO2Forj=1To4Ifj
在结构化设计方法中,数据流图表达了问题中的数据流与加工间的关系,并且每一个______实际上对应一个处理模块。
随机试题
男,48岁。右上第一磨牙残冠,拔除术中发生折断。若患者术后感觉创口不适、疼痛。检查见创口肉芽组织充血、炎性肉芽增生。则可能发生了
A.含乌头类药物的中成药B.含生天南星的中成药C.含马钱子的中成药D.含蟾酥的中成药E.含生半夏的中成药梅花点舌丸是
药物的临床研究包括了
生产经营单位进行爆破、吊装等危险作业,应当安排()进行现场安全管理,确保操作规程的遵守和安全措施的落实。
对不使用政府资金的企业投资建设的项目,政府主要从()等方面进行核准。
作业分为主要作业和次要作业,所依据的分类标准是()。
旅游被投诉者的义务()
左边给定的是纸盒的外表面,下面哪一项不能由它折叠而成?()
若FTP地址写为ftp://test:123@222.18.8.241:8901,则该地址中的“test”的含义是FTP服务器的(42)。若FTP地址为ftp://222.18.8.241,则该地址对应连接的FTP服务器用户名字为(43)。
下列关于Windows2000操作系统说法不正确的是
最新回复
(
0
)