首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的执行结果是( )。 Private Sub Form Activate() Dim score(3)As Integer,total As Integer Dim aa scoreAs Variant score(1)=50:score(2
下列程序的执行结果是( )。 Private Sub Form Activate() Dim score(3)As Integer,total As Integer Dim aa scoreAs Variant score(1)=50:score(2
admin
2018-07-11
18
问题
下列程序的执行结果是( )。
Private Sub Form Activate()
Dim score(3)As Integer,total As Integer
Dim aa scoreAs Variant
score(1)=50:score(2)=14:score(3)=36
total=0:i=0
For Each aa—score In score
i=i+1
total=total+aa—score
Print i,aa_score,total
Next
End Sub
选项
A、1 0 0
2 50 50
3 14 64
4 36 100
B、11 50 50
2 14 64
3 36 100
C、114 64
2 36 100
3 36 100
D、0 0 0
1 50 50
2 14 64
3 36 100
答案
A
解析
本题考查For Each In语句。该语句的使用形式为:ForEach成员In数组…Next,适用于不关心数组中的元素个数或者不清楚有多少个元素,使用时要求成员为变体类型变量。当激活窗体时,对score数组中的每个元素进行求和,同时i记下当前计算数组元素的个数。默认数组下标从0开始,题中score数组中含有4个元素,输出4行。
转载请注明原文地址:https://kaotiyun.com/show/a7Gp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
以下变量名中合法的是
窗体上有一个名称为Text1的文本框,一个名称为Command1的命令按钮。命令按钮的单击事件过程如下:PrivateSubCommand1_Click()Dimx1AsInteger,x2AsInteger,x3AsInte
窗体上有两个名称分别为Text1、Text2的文本框。Text1的KeyUp事件过程如下:PrivateSubText1-KeyUp(KeyCodeAsInteger,ShiftAsInteger)DimcAsStringc
编写如下程序:PrivateSubForm_Click()Print"Welcome!"EndSubPrivateSubF…orm_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSin
VB中有3个键盘事件:KeyPress、KeyDown、KeyUp,若光标在Text1文本框中,则每输入一个字母
下面关于命令按钮的叙述中错误的是
(1)在考生文件夹下有一个工程文件sjt3.vbp。程序的功能是通过键盘向文本框中输人大、小写字母和数字。单击标题为“统计”的命令按钮,分别统计输入字符串中大写字母、小写字母及数字字符的个数,并将统计结果分别在标签控件数组x中显示,如图所示。在给
设栈的顺序存储空间为S(1:50),初始状态为top=0。现经过一系列入栈与退栈运算后,top=20,则当前栈中的元素个数为
软件生命周期中的活动不包括( )。
设循环队列的存储空间为Q(1:35),初始状态为front=rear=35。现经过一系列入队与退队运算后,front=15,rear=15,则循环队列中的元素个数为
随机试题
公差一般为正值,但在个别情况下,也可以是负值或零。
两偏振片堆叠在一起,一束自然光垂直入射其上时没有光线通过,当其中一偏振片慢慢转动180°时透射光强度发生的变化为( )。
对于大型复杂的产品,应用价值工程的重点应在产品的()阶段。
基金职业道德修养,是指基金从业人员通过主动自觉的自我学习、()、自我完善,将基金职业道德外在的职业行为规范内化为内在的职业道德情感、认知和信念,使自己形成良好的职业道德品质和达到一定的职业道德境界。
针对晕车的游客,以下做法错误的是()。
下列各句中划横线字活用现象与其他各项不同的是()。
在官制中实行差遣制的朝代是( )。
Beforediscussingtheeffectofdeflationandinflationonthedistributionofincome,itwillbeusefulto【C1】______theseterm
Thebenefitstocitizensofmodernindustrialsocietymayhave【C1】______sometimeinrecentdecades,andincreasingly,wearepa
A、HethoughtArtwasuseless.B、Hewasofferedajobinabigaccountingfirm.C、HewantedtogotoLondontostudyArt.D、Hewa
最新回复
(
0
)