首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int[] a=new int[1
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int[] a=new int[1
admin
2010-07-28
24
问题
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int[] a=new int[11]; int[] p=new int[4]; int k=5; for (int i=1; i<=10; i++) a
=i; for(int i=1;i<=3;i++) p
=a[i*i]; for (int i=1; i<=3;i++) k=k+p
*2; System.out.println (k); } }
选项
A、33
B、28
C、35
D、37
答案
1
解析
本题考查对for循环语句和数组的理解。此题中共定义了两个数组,a[]p[]共用了3次for循环。第1个for语句对数组 a
赋值,a[1]...a[10]=1...10:第2个for语句,对数组p
赋值p[1]=1,p[2]=4,p[3]=9;第3个for语句,计算k的值。3次循环分别得到:5、15、33。故本题答案是A。
转载请注明原文地址:https://kaotiyun.com/show/u29p777K
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
软件生命周期中花费时间最多的阶段是
一个关系中属性个数为1时,称此关系为
索引属于
对建立良好的程序设计风格,下面描述正确的是
结构化程序设计中,下面对goto语句使用描述正确的是
以下描述中错误的是
在数据库设计中,将E-R图转换成关系数据模型的过程属于()。
在学生管理的关系数据库中,存取一个学生信息的数据单位是
以下选项中,不符合Python语言变量命名规则的是
Python语言中,以下表达式结果为False的选项是()。
随机试题
钢材的热加工温度一般在()以上。
路由选择
位于延髓的特殊内脏运动核是()
组成人体运动系统的主要有
男,40岁。晚餐后5小时开始上腹疼痛,向左肩、腰、背部放射及恶心、呕吐、腹胀,现已37个小时,曾有胆结石史。体检:R24次/分,T38.9℃,BP90/75mmHg。巩膜可疑黄染,全腹压痛,以上腹部显著伴肌紧张和反跳痛,移动性浊音阳性,血白细胞16×109
侯某和吕某大学毕业后同时进入甲房地产经纪机构(以下简称甲机构)工作。侯某特别喜欢这个工作,但吕某觉得房地产经纪是社会底层人干的活,对自己的职业前景缺乏信心。侯某一直开导和鼓励吕某,吕某才没有辞职。后来,两个人都取得了房地产经纪人资格。2010年,甲机构指派
纳税人欠缴的税款发生在纳税人以其财产设定抵押之后的,税收应当先于抵押权执行。()
A.化疗B.放疗C.根治性手术D.化疗和根治性手术E.放疗和根治性手术骨肉瘤采用的治疗方法是
Onceuponatimeapoorfarmertakingasackofwheattothemilldidnotknowwhattodowhenitslippedfromhishorseandfel
Nosooner________thanastudentcametovisither.
最新回复
(
0
)