首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Option Base 1 Private Sub Command1_Click() Dim a As Variant Dim i As Integer, m As Integ
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Option Base 1 Private Sub Command1_Click() Dim a As Variant Dim i As Integer, m As Integ
admin
2015-06-30
21
问题
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:
Option Base 1
Private Sub Command1_Click()
Dim a As Variant
Dim i As Integer, m As Integer, index As Integer
a = Array(-10, 23, -50, 90)
m = a(LBound(A))
index = LBound(A)
For i = LBound(A) To UBound(A)
If a(i) < m Then
m = a(i)
index = i
End If
Next i
Print index
End Sub
程序运行时,单击Command1,则在窗体上输出的结果是
选项
A、0
B、1
C、2
D、3
答案
D
解析
UBound函数返回为指定的数组维可用的最大下标,LBound函数返回为指定的数组维可用的最小下标。程序开头定义了Option Base 1这时定义一维数组下标从1开始;故LBound(A)=1,Ubound(A)=4;m = a(LBound(A))=a(1)=-10,index=LBound(A)=1。If 条件 Then部分,如果选择的条件为真,则执行then部分;For i=1 To 4,当i=1时,if条件a(i)=a(1)=-10<-10为假,不执行then部分;当i=2时,if条件a(i)=a(2)=23<-10为假,不执行then部分;当i=3时,if条件a(i)=a(3)=-50<-10为真,执行then部分,m=a(3)=-50,接着执行index=i=3;当i=4时,if条件a(i)=a(4)=90<-10为假,不执行then部分;外层for循环结束,故index=3。本题正确选项为D。
转载请注明原文地址:https://kaotiyun.com/show/vVQp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
下列可作为VisualBasic变量名的是______。
设a=5,b=6,c=7,d=8,则执行下列语句后,x的值为______。x=IIF((a>B)And(c<d),10,20)
在窗体上画两个标签和一个命令按钮,其名称分别为Labell、Label2和Command1,然后编写如下程序:PrivateSubfunc(LAsLabel,ByValaAsInteger)L.Caption="1234
下面程序段的输出结果是【】。ForX=1.5To5Step1.5PrintX;NextX
结构化分析方法的基本思想是采用【】方法,分析整个系统,有效的控制系统开发的复杂性。
下列叙述中正确的是
一个项目具有一个项目主管,一个项目主管可管理多个项目,则实体“项目主管”与实体“项目”的联系属于【】的联系。
下列数据结构中,能用二分法进行查找的是()。
随机试题
最早使用“组织行为学”这一名称的是()
简述抽样调查的基本程序。
最终消费占国内生产总值的比重是
A.卵巢良性肿瘤B.卵巢恶性肿瘤C.卵巢肿瘤感染D.卵巢肿瘤蒂扭转E.卵巢肿瘤破裂
男性,15岁,近日有乏力、头痛、咽痛、发冷、发热、肌肉酸痛等,体温达39℃。于发病第三天出现明显的阵发性刺激性咳嗽,咳少量黏痰。检查X线胸片:肺纹理增多,肺下叶呈斑点状模糊阴影。青霉素类药物治疗效果不好,考虑为支原体肺炎,血清学检查也给予支持,应首选
秦皮伪品来源于
以下房地产价格中,属于政府定价的是()。
项目范围说明书说明了________。
中国梦就是国家富强,民族振兴,人民幸福,要实现中国梦就必须走中国道路。必须弘扬中国精神,必须凝聚()。
WhichofthefollowingstatementsaboutORACLEis(are)correct? Ⅰ.ORACLEfollowsSQLstandard Ⅱ.ORACLEdatabasedefinest
最新回复
(
0
)