首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int[] a=new int[11];
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int[] a=new int[11];
admin
2010-02-22
25
问题
下面程序的输出结果是( )。 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/Gqnp777K
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
假设查询文件(myquery.qpr)已经创建,要显示查询结果,可使用命令
要将显示日期值时所用的分隔符设置为竖杠“|”错误的设置命令是
有三个关系R、S和T如下:其中关系T由关系R和S通过某种操作得到,该操作为
在关系模型中,每一个二维表称为一个
让隐藏的MeForm表单显示在屏幕上的命令是
基于VisualFoxPro基类生成一个表单对象的语句是
下面属于黑盒测试方法的是
在VisualFoxPro中,报表的数据源不包括
在考生文件夹下完成如下操作:(1)打开表单one,如图1所示,通过设置控件的相关属性,使得表单开始运行时焦点在“打开”命令按钮上,并且接下来的焦点的移动顺序是“关闭”和“退出”。(2)打开表单two,如图2所示,使用“布局”工具栏的“
在E—R图中,用来表示实体联系的图形是
随机试题
下列文学常识表述正确的是()。
中外合作经营企业的中方合作者不可以是
我国法律规定,复核死刑案件的合议庭的组成是
根据我国《招标投标法》的规定,招标的方式包括()。
均质杆AB长为l,重W,受到如图所示的约束,绳索ED处于铅垂位置,A、B两处为光滑接触,杆的倾角为α,又CD=l/4,则A、B两处对杆作用的约束力关系为()。
移动模架逐孔施工桥梁上部结构,其主要特点为()。[2013年真题]
根据地质、地形条件,平原河流上的()宜建在封堵汊道的中、下段,并与主流向正交。
会计工作交接完毕后,必须在移交清单上签字或盖章的人有()。
人们以一定方式的共同活动为基础而结合起来的联合体是()
在ASCII代码表中每一个大写字母比它相应的小写字母的ASCII码()。
最新回复
(
0
)