【计算机类职业资格】计算机二级JAVA-47及答案解析.doc

上传人:hopesteam270 文档编号:1338335 上传时间:2019-10-17 格式:DOC 页数:2 大小:28KB
下载 相关 举报
【计算机类职业资格】计算机二级JAVA-47及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】计算机二级JAVA-47及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、计算机二级 JAVA-47及答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.下列程序中定义了一个长度为 20的整数数组,然后将 120 分别赋给数组元素,计算该数组中所有元素的和。 public class exam_1 public static void main(String args) int sum; _; int arrayList=new int20; for(int i=0; i=19; i+) arrayListi=i+1; int pos=0; while(pos20) if(_) sum=sum+arrayLi

2、stpos; _; System.out.println(“sum=“+sum); (分数:30.00)_2.本程序的功能是判断年份 1990、2000 和 2008是否是闰年,并打印输出判断结果。 public class exam_2 public static void main(String args) yes_no(1990); yes_no(2000); yes_no(2008); public_yes_no(int year) if(_) System.out.print(year+“年是闰年。“); _ System.out.print(year+“年不是闰年。“); (分数:

3、30.00)_3.本程序使用分支语句来控制输出,已知初始状态字符变量 ch=A,整型变量 r=6,并且输出结果是:r=5。 public class exam_3 public static void main(_) char ch=A; int r=6; _(ch+1) case A: r=r+3; case B: r=r+5; case C: _ default : r=r*2; System.out.println(“r=“+r); (分数:40.00)_计算机二级 JAVA-47答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1

4、下列程序中定义了一个长度为 20的整数数组,然后将 120 分别赋给数组元素,计算该数组中所有元素的和。 public class exam_1 public static void main(String args) int sum; _; int arrayList=new int20; for(int i=0; i=19; i+) arrayListi=i+1; int pos=0; while(pos20) if(_) sum=sum+arrayListpos; _; System.out.println(“sum=“+sum); (分数:30.00)_正确答案:(sum=0 pos

5、2=1(或 pos%2!=0) pos+(或 pos=pos+1或 pos+=1)解析:2.本程序的功能是判断年份 1990、2000 和 2008是否是闰年,并打印输出判断结果。 public class exam_2 public static void main(String args) yes_no(1990); yes_no(2000); yes_no(2008); public_yes_no(int year) if(_) System.out.print(year+“年是闰年。“); _ System.out.print(year+“年不是闰年。“); (分数:30.00)_正确答案:(static void (year%4=0 int r=6; _(ch+1) case A: r=r+3; case B: r=r+5; case C: _ default : r=r*2; System.out.println(“r=“+r); (分数:40.00)_正确答案:(String args(或 String args)(注:args 为变量名,可为其他名称) switch r=r-6; break; (或 r-=6; break; )解析:

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 14106-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of free glycerol content German version EN 14106 2003《脂肪和油的衍生物 脂肪酸甲基酯(FAME) 游离甘油含量的测定》.pdf DIN EN 14106-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of free glycerol content German version EN 14106 2003《脂肪和油的衍生物 脂肪酸甲基酯(FAME) 游离甘油含量的测定》.pdf
  • DIN EN 14107-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of phosphorus content by inductively coupled plasma (ICP) emission spectrometry German ve.pdf DIN EN 14107-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of phosphorus content by inductively coupled plasma (ICP) emission spectrometry German ve.pdf
  • DIN EN 14108-2015 Fat and oil derivatives - Fatty Acid Methyl Esters (FAME) - Determination of sodium content by atomic absorption spectrometry German version EN 14108 2003《脂肪和油的衍生.pdf DIN EN 14108-2015 Fat and oil derivatives - Fatty Acid Methyl Esters (FAME) - Determination of sodium content by atomic absorption spectrometry German version EN 14108 2003《脂肪和油的衍生.pdf
  • DIN EN 14109-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of potassium content by atomic absorption spectrometry German version EN 14109 2003《脂肪和油的.pdf DIN EN 14109-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of potassium content by atomic absorption spectrometry German version EN 14109 2003《脂肪和油的.pdf
  • DIN EN 14110-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of methanol content German version EN 14110 2003《脂肪和油的衍生物 脂肪酸甲基酯(FAME) 测定甲醇含量》.pdf DIN EN 14110-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of methanol content German version EN 14110 2003《脂肪和油的衍生物 脂肪酸甲基酯(FAME) 测定甲醇含量》.pdf
  • DIN EN 14111-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of iodine value German version EN 14111 2003《脂肪和油的衍生物 脂肪酸甲基酯(FAME) 测定碘值》.pdf DIN EN 14111-2003 Fat and oil derivatives - Fatty acid methylesters (FAME) - Determination of iodine value German version EN 14111 2003《脂肪和油的衍生物 脂肪酸甲基酯(FAME) 测定碘值》.pdf
  • DIN EN 14112-2016 Fat and oil derivatives - Fatty Acid Methyl Esters (FAME) - Determination of oxidation stability (accelerated oxidation test) German version EN 14112 2016《脂肪和油的衍生.pdf DIN EN 14112-2016 Fat and oil derivatives - Fatty Acid Methyl Esters (FAME) - Determination of oxidation stability (accelerated oxidation test) German version EN 14112 2016《脂肪和油的衍生.pdf
  • DIN EN 14115-2002 Textiles - Burning behaviour of materials for marquees large tents and related products - Ease of ignition German version EN 14115 2001《织物 大帐篷和相关产品用材料的燃烧特性 易燃性 德文.pdf DIN EN 14115-2002 Textiles - Burning behaviour of materials for marquees large tents and related products - Ease of ignition German version EN 14115 2001《织物 大帐篷和相关产品用材料的燃烧特性 易燃性 德文.pdf
  • DIN EN 14116-2013 Tanks for transport of dangerous goods Digital interface for product recognition devices for liquid fuels German version EN 14116 2012《危险品运输用槽罐 液体燃料产品识别装置用数字接口 德文.pdf DIN EN 14116-2013 Tanks for transport of dangerous goods Digital interface for product recognition devices for liquid fuels German version EN 14116 2012《危险品运输用槽罐 液体燃料产品识别装置用数字接口 德文.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1