首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
(32)在窗体上画一个名为Commandl的命令按钮,然后编写如下代码: Option Base 1 Private Sub Commandl_Click() Dim a a=Array(1,2,
(32)在窗体上画一个名为Commandl的命令按钮,然后编写如下代码: Option Base 1 Private Sub Commandl_Click() Dim a a=Array(1,2,
admin
2020-02-27
13
问题
(32)在窗体上画一个名为Commandl的命令按钮,然后编写如下代码:
Option Base 1
Private Sub Commandl_Click()
Dim a
a=Array(1,2,3,4)
j=1
For i=4 To 1 Step-l
S=s+a(i)*j
j=j*10
Next I
Print S
End Sub
运行上面的程序,其输出结果是( )。
选项
A、1234
B、12
C、34
D、4321
答案
A
解析
Array函数用来为数组元素赋值,即把一个数据集读入某个数组。其格式为:数组变量名=Array(数组元素值)。Dim a语句没有变量类型名,则a默认为Variant类型,这里它作为数组变量使用。现在已知数组a 中元素的值依次为1、2、3、4,则For循环中各变量值变化如下:
i=4时,s=s+a(4)*j=O+4*1=4,j=1*10=10
i=3时,s=s+a(3)*j=4+3*10=4十30=34,j=10*10=100
i=2时,s=s+a(2)*j=34+2*100=34+200=234,j=100*10=1000
i=1时,s=s+a(1)*j=234+1*1000=234+1000=1234。循环结束。s的值为1234。
转载请注明原文地址:https://kaotiyun.com/show/4PTp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
(1)在考生文件夹下有一个工程文件sjt3.vbp,窗体上已经有两个文件框,名称分别为Textl、Text2;还有一个命令按钮,名称为C1,标题为“确定”;请添加两个单选按钮,名称分别为Opl、Op2,标题分别为“男生”、“女生”,再添加两个复选框,名称分
下面有3个程序段可以正确判断,另一个不能正确判断的是
以下关于窗体的叙述中错误的是()。
以下不属于VisualBasic数据文件的是
软件测试的过程是()。a.验收测试b.集成测试c.单元测试d.系统测试
下列数组定义中错误的是( )。
下列叙述中正确的是
对软件系统总体结构图,下面描述中错误的是()。
窗体上有名称为Commandl的命令按钮和名称为Text1的文本框PrivateSubCommandl一Click()Text1.Text=“程序设计”Text1.SetFocusEndSubPriv
为了改变文本框中所显示文本的颜色,需设置的属性为
随机试题
“三个代表”重要思想的本质是()
_______是销售商根据消费者对服务水平的期望值的不同,采用的不同服务方式和服务标准。
16岁女性患者,尿少浮肿3个月,血压125/75mmHg,尿蛋白(++++),肾活检示“微小病变型肾病”,下列哪种治疗为首选
中国古代社会的死刑复奏制度是指奏请皇帝批准执行死刑判决的制度。关于这一制度,下列哪些选项是正确的?
某白酒生产企业为增值税一般纳税人,2014年6月业务如下:(1)向某烟酒专卖店销售粮食白酒30吨,开具普通发票,取得收)入350万元。(2)将外购价值6万元的黄酒委托乙企业加工散装药酒1000千克,收回时向乙企业支付不合增值税的加工费1万元,乙企业无同
在教育教学的细节中如何做到尊重学生的个别差异?()
纵观世界,新的垃圾处理时代正在到来。前不久,俄罗斯科学家已经可以利用等离子技术来处理垃圾焚烧过程中产生的有害气体,并对城市生活制造的“污泥浊水”进行无害化处理,使其转为腐殖酸肥料。德国科学家创造出“风拣技术”,令世界看到了垃圾处理的广阔未来。该技术终结了垃
关于动产抵押权的顺位,以下说法正确的是()
有以下程序#include<stdio-h>intfun(inta,intb){if(b==0)returna;elsereturn(fun(--a,--b));}main(){printf("%d\n",fun(4,2));}程序
Childrenmodelthemselveslargelyontheirparents.Theydoso【C1】______throughidentification.Childrenidentifywithaparent
最新回复
(
0
)