首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
阅读下列程序: 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
20
问题
阅读下列程序: 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://jikaoti.com/ti/pZq0FFFM
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
要在一个单一的类文件中创建既可用作JavaApplet,又可用作Java应用程序的Java软件代码。下列说法错误的是()。
在文件类提供的方法中,用于创建目录的方法是
关于文件名的处理中,测试当前文件是否目录用【】函数。
正确生成RandomAccessFile对象的语句的是
下列数组array_test中,能在程序运行时动态调整大小的是
顺序执行下列程序语句后,则b的值是()Stringa="Hello";Stringb=a.substring(0,2);
变量属性是描述变量的作用域,按作用域分类,变量有局部变量、_______、方法参数和异常处理参数。
程序中使用了字符串函数(如strlen),则必须包含的头文件名为______。
Java语言的循环语句包括for语句、do-while语句和do-while语句,先循环后判断,循环至少被执行一次的是 【】 。
设x,y,max均为int型变量,x,y已赋值。用三目条件运算符求x,y的最大值,这个赋值语句应是max=【】。
随机试题
男性,33岁,咳嗽、发热1周,体温38.5℃,皮肤有大块淤斑,血红蛋白85g/L,白细胞总数3×109/L,中性0.32,淋巴0.64,未见幼稚细胞,血小板3.2×109/L,凝血酶原时间15秒(对照12秒),3P试验弱阳性。最可能诊断是
公司的最佳资本结构应是()。
按照企业规模对公司信贷客户市场进行细分,中型工业企业必须满足的条件是()。
某外贸公司(增值税一般纳税人)2017年l0月份发生以下业务:(1)进口A牌手表5000只,海关审定的完税价格为140万元;进口B牌手表1000只,海关审定的完税价格为1000万元,进口关税税率为30%。(2)进口高尔夫球具,海关审定的完税价格
如图所示,轻质弹簧竖直固定在水平地面上,一质量为m的小球在外力F的作用下静止于图示位置,弹簧处于压缩状态。现撤去外力F,小球最终可以离开弹簧而上升一定的高度,则小球从静止开始到离开弹簧的过程中(不计空气阻力)()。
自我实现作为一种最高级的需要,包括()需要。
下列西周分封国属于商族后裔的是()
习近平新时代中国特色社会主义思想是马克思主义中国化的最新成果。其中,最重要、最核心的内容就是党的十九大报告概括出的“八个明确”和“十四个坚持”。“八个明确”和“十四个坚持”要回答的问题是
设函数f(x)可导且0≤f’(x)≤,对任意的xn,作xn+1=f(xn)(n=0,1,2,…)证明:存在且满足方程f(x)=x.
Thequestioningoftheroleofthepublicgalleryisnotanewphenomenon.Itissomethingthathasbeenarguedoversinceitsv
最新回复
(
0
)