首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
在窗体上有一个命令按钮Command1,通用过程fun和命令按钮的事件过程如下: Private Function fun(ByVal m As Integer) If m Mod 2=0 Then fun=
在窗体上有一个命令按钮Command1,通用过程fun和命令按钮的事件过程如下: Private Function fun(ByVal m As Integer) If m Mod 2=0 Then fun=
admin
2013-01-23
23
问题
在窗体上有一个命令按钮Command1,通用过程fun和命令按钮的事件过程如下: Private Function fun(ByVal m As Integer) If m Mod 2=0 Then fun=2 Else fun=1 End If End Function Private Sub Command1_Click() Dim i As Integer,s As Integer s=0 For i=1 To 5 s=s+fun(i) Next Print s End Sub 程序运行后,单击命令按钮,则窗体上输出( )。
选项
A、6
B、7
C、8
D、9
答案
2
解析
本题比较简单,只要根据程序的执行条件和顺序就可以运算出该程序的最后输出结果。程序运算过程为:当i=1时,s=s+ fun(i)=1;当i=2时,s=s+fun(i)=3;当i=3时,s=s+fun(i)=4;当 i=4时,s=s+fun(i)=6;当i=5时,s=s+fun()=7。
转载请注明原文地址:https://kaotiyun.com/show/arhp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在窗体上画一个命令按钮,名称为Command1。然后编写如下程序:PnvateSubCommand1_Click()DimxAsInteger,yAsInteger,tAsIntegerx=10:y=2
在菜单编辑器中建立一个菜单,其主菜单项的名称为mnuEdit,Visible属性为False。程序运行后,如果用鼠标右键单击窗体,则弹出与mnuEdit对应的菜单。以下是实现上述功能的程序,请填空。PrivateSubForm【】(Bu
Sub过程与Function过程最根本的区别是
有如下程序:PrivateSubCommand1_Click()a$="AWORKERISOVERTHERE"x=Len(a$)Fori
下面叙述正确的是
在窗体上画一个文本框(Textl),然后编写如下事件过程:PrivateSubText1_KeyPress(KeyAsciiAsInteger)DimcharAsStringchar=Chr(KeyAsci
将窗体的KeyPreview属性设置为True,然后编写如下过程:PrivateSubFormKeyDown(KeyCodeAsInteger,ShiftAsInteger)PrintChr(KeyCode)E
在窗体上画两个命令按钮,然后编写以下代码:PrivateSubCommandl_Click()DimiAsLongDimiAsIntegerDimxFori=1
调试窗口中的()可显示当前过程所有局部变量的当前值。
软件开发环境是全面支持软件开发全过程的【】的集合。
随机试题
行政复议的举证责任,由申请人承担。()
牙龈渗血者宜选用下列哪种漱口水
现代人力资源管理在管理理念上更加突出地强调()。
在填写票据出票日期时,“10月20日”应填写()。
A、 B、 C、 D、 D
以下各项关于无线局域网标准的说法中,错误的是()。
将考生文件夹下文件SHOU.TXT移动到考生文件夹下MOVE文件夹中,并将该文件重命名为“YAN.TXT”。
3.75
THERISEOFMOSCOW(1)TheriseofMoscowduringmedievaltimeswasafundamentaldevelopmentinRussianhistory.Moscowbeg
A、Inahospital.B、Inaschool.C、Inanagency.D、Inahotel.A对话中,女士说她和十年前一样,仍然在那家医院工作。由此可见,女士十年前在一家医院工作。
最新回复
(
0
)