首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
阅读下列程序: Dim SW As Boolean Function func(X As Integer)As Integer If X<20 Then Y=X Else Y=20+X
阅读下列程序: Dim SW As Boolean Function func(X As Integer)As Integer If X<20 Then Y=X Else Y=20+X
admin
2009-02-13
19
问题
阅读下列程序: Dim SW As Boolean Function func(X As Integer)As Integer If X<20 Then Y=X Else Y=20+X End If func=Y End Function Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single, Y As Single) SW=False End Sub Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single, Y As Single) SW=True End Sub Private Sub Command1_Click() Dim intNum As Integer intNum=InputBox(" ") If SW Then Print func(intNum) End If End Sub 程序运行后,单击一次窗体,再单击命令按钮,将显示一个输入对话框,如果在对话框中输入20,则程序的输出结果为
选项
A、0
B、20
C、40
D、无任何输出
答案
4
解析
上述程序由一个通用过程和3个事件过程组成,在命令按钮事件过程中调用通用过程,并将一个参数传送给通用过程。这里要注意,只有在一定的条件下,才能调用通用过程,这个条件就是,窗体的Boolean变量SW的值必须为 True,否则不能调用。而为了使SW的值为True,必须执行Form MouseUp事件过程,这只能通过单击窗体来实现。单击窗体时,按下鼠标左键执行FormMouseDown事件过程,使得SW=False,松开鼠标后执行Form MouseUp事件过程,使得 =True。程序运行后,由于单击了一次窗体,执行了Form_Mouseup事件过程,再单击命令按钮,因而SW的值为True,调用通用过程后,在窗体上显示的内容是40。若没有事先单击窗体,而直接单击按钮,窗体上就没有任何内容输出。
转载请注明原文地址:https://kaotiyun.com/show/Ys1p777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
为了向一个Applet传递参数,可以在HTML文件的APPLET标志中使用PAPAM选项。在Applet程序中获取参数时,应使用的方法是
下列关于构造方法说法正确的是
Java设计有______功能,这不仅防止了内存地址计算出错的问题,也省去了编程时对内存进行分配的烦恼。
抛出异常的程序代码可以是()。
关系操作的特点是______操作。
Java语言中,boolean型常量只有true和______两个值。
只能用在循环语句中的是()。
若有循环:intx=5,y=20;do{y-=x; x++;}while(++x<--y);则循环体将被执行()。
功能用来终止当前循环体语句的执行语句是()。
随机试题
《我与地坛》中“她一个人在园子里走,走过我的身旁,走过我经常呆的一些地方,步履茫然又急迫”。这里使用的人物描写方法是()
脊髓灰质炎病毒的传播方式下述哪项是不可能的:()
CSA方法是
A.fss=1-e-ktB.Css=k0/kVC.X0=CssVD.dXu/dt=keXE.lg(AXu/△t)=-(k/2.303)t+lg(ke.X0)为使静脉滴注的血药浓度立即达到稳态浓度所需静脉注射的负荷剂量()。
甲于1990年与乙结婚,1991年以个人名义向其弟借款10万元购买商品房一套,夫妻共同居住。2003年,甲乙离婚。甲向其弟所借的钱,离婚时应如何处理?
竖直矩形闸门一边与水面平齐,下面有轴,已知水的密度ρ,重力加速度g,闸门高2H,闸门宽B。为阻止闸门转动需要加多大的推力F?()
背景资料:某装机容量50万kW的水电站工程建于山区河流上,拦河大坝为2级建筑物,采用碾压式混凝土重力坝,坝高为60m,坝体浇筑施工期近2年,施工导流采取全段围堰、隧洞导流的方式。施工导流相关作业内容包括:①围堰填筑;②围堰拆除;③导流隧洞开挖;④
某企业有A、B两个投资项目,计划投资额均为1000万元,其净现值的概率分布如下表所示:要求:分别计算A、B两个项目期望值的标准离差。
家住农村的小谢,父母省吃俭用供其上大学。小谢毕业后有了一份待遇不错的工作,父母年岁大了,因劳累身体也有劳损,小谢对老人悉心照顾,满足老人衣食住行等各方面的需要,看到老人腿脚不方便就买来按摩椅给老人使用。在这里,老年人享有的权益是()。
关于Kerberos和PKI两种认证协议的叙述中正确的是(58)。在使用Kerberos认证时,首先向密钥分发中心发送初始票据(59)来请求会话票据,以便获取服务器提供的服务。(59)
最新回复
(
0
)