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

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

1、计算机二级 JAVA-48及答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序提示输入年份,然后判断该年份是否为闰年。 import Java.io.*; public class exam_13 public static void main(String args) InputStreamReader ir; BufferedReader in; ir=new InputStreamReader(System.in); in=new BufferedReader(ir); int year=1900; System.out.

2、print(“请输入年份:“); try String s=in.readLine(); _; _(Exception e) if(_) System.out.println(year+“是闰年“); else System.out.println(year+“不是闰年“); (分数:30.00)_2.本程序提示输入月份,然后判断该月份的天数,如果输入的是 2月份,则天数按 28天计。 import java.io.*; public class exam_14 public static void main(String args) InputStreamReader ir; Buffere

3、dReader in; ir=new InputStreamReader(System.in); in=new BufferedReader(ir); int month=1; int day=0; System.out.print(“请输入月份:“); try _; month=Integer.parseInt(s); catch(Exception e) switch(month) case 1: case 3: case 5: case 7: case 8: case 10: case 12: _; case 4: case 6: case 9: case 11: _; case 2:

4、day=28; System.out.println(month+“月有“+day+“天“); (分数:30.00)_3.本程序定义了一个长度为 50的一维数组,并且分别将 150 赋给数组中的各个元素,最后输出数组元素对应的值。 public class exam_15 public static void main(String args) _; arr=_; for(int i=0; iarr.length; i+) _; for(int i=0; iarr.length; i+) System.out.print(arri+“ “); (分数:40.00)_计算机二级 JAVA-48答

5、案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序提示输入年份,然后判断该年份是否为闰年。 import Java.io.*; public class exam_13 public static void main(String args) InputStreamReader ir; BufferedReader in; ir=new InputStreamReader(System.in); in=new BufferedReader(ir); int year=1900; System.out.print(“请输入年份:“)

6、 try String s=in.readLine(); _; _(Exception e) if(_) System.out.println(year+“是闰年“); else System.out.println(year+“不是闰年“); (分数:30.00)_正确答案:(year=Integer.parseInt(s) catch year%4=0 public class exam_14 public static void main(String args) InputStreamReader ir; BufferedReader in; ir=new InputStreamRe

7、ader(System.in); in=new BufferedReader(ir); int month=1; int day=0; System.out.print(“请输入月份:“); try _; month=Integer.parseInt(s); catch(Exception e) switch(month) case 1: case 3: case 5: case 7: case 8: case 10: case 12: _; case 4: case 6: case 9: case 11: _; case 2: day=28; System.out.println(month

8、月有“+day+“天“); (分数:30.00)_正确答案:(String s=in.readLine() day=31; break day=30; break)解析:3.本程序定义了一个长度为 50的一维数组,并且分别将 150 赋给数组中的各个元素,最后输出数组元素对应的值。 public class exam_15 public static void main(String args) _; arr=_; for(int i=0; iarr.length; i+) _; for(int i=0; iarr.length; i+) System.out.print(arri+“ “); (分数:40.00)_正确答案:(intarr(或 int arr) new int50 arri=i+1)解析:

展开阅读全文
相关资源
猜你喜欢
  • ASD-STAN PREN 2240-027-1996 Aerospace Series Lamps Incandescent Part 027  Lamp Code 334 Product Standard (Edition P 1)《航空航天系列 白炽灯 第027部分 灯 型号334 产品标准 第P1版》.pdf ASD-STAN PREN 2240-027-1996 Aerospace Series Lamps Incandescent Part 027 Lamp Code 334 Product Standard (Edition P 1)《航空航天系列 白炽灯 第027部分 灯 型号334 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-028-1996 Aerospace Series Lamps Incandescent Part 028  Lamp Code 337 Product Standard (Edition P 1)《航空航天系列 白炽灯 第028部分 灯 型号337 产品标准 第P1版》.pdf ASD-STAN PREN 2240-028-1996 Aerospace Series Lamps Incandescent Part 028 Lamp Code 337 Product Standard (Edition P 1)《航空航天系列 白炽灯 第028部分 灯 型号337 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-029-1996 Aerospace Series Lamps Incandescent Part 029  Lamp Code 338 Product Standard (Edition P 1)《航空航天系列 白炽灯 第029部分 灯 型号338 产品标准 第P1版》.pdf ASD-STAN PREN 2240-029-1996 Aerospace Series Lamps Incandescent Part 029 Lamp Code 338 Product Standard (Edition P 1)《航空航天系列 白炽灯 第029部分 灯 型号338 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-030-1996 Aerospace Series Lamps Incandescent Part 030  Lamp Code 345 Product Standard (Edition P 1)《航空航天系列 白炽灯 第030部分 灯 型号345 产品标准 第P1版》.pdf ASD-STAN PREN 2240-030-1996 Aerospace Series Lamps Incandescent Part 030 Lamp Code 345 Product Standard (Edition P 1)《航空航天系列 白炽灯 第030部分 灯 型号345 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-031-1996 Aerospace Series Lamps Incandescent Part 031  Lamp Code 356 Product Standard (Edition P 1)《航空航天系列 白炽灯 第031部分 灯 型号356 产品标准 第P1版》.pdf ASD-STAN PREN 2240-031-1996 Aerospace Series Lamps Incandescent Part 031 Lamp Code 356 Product Standard (Edition P 1)《航空航天系列 白炽灯 第031部分 灯 型号356 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-032-1996 Aerospace Series Lamps Incandescent Part 032  Lamp Code 376 Product Standard (Edition P 1)《航空航天系列 白炽灯 第032部分 灯 型号376 产品标准 第P1版》.pdf ASD-STAN PREN 2240-032-1996 Aerospace Series Lamps Incandescent Part 032 Lamp Code 376 Product Standard (Edition P 1)《航空航天系列 白炽灯 第032部分 灯 型号376 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-033-1996 Aerospace Series Lamps Incandescent Part 033  Lamp Code 377 Product Standard (Edition P 1)《航空航天系列 白炽灯 第033部分 灯 型号377 产品标准 第P1版》.pdf ASD-STAN PREN 2240-033-1996 Aerospace Series Lamps Incandescent Part 033 Lamp Code 377 Product Standard (Edition P 1)《航空航天系列 白炽灯 第033部分 灯 型号377 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-034-1996 Aerospace Series Lamps Incandescent Part 034  Lamp Code 382 Product Standard (Edition P 1)《航空航天系列 白炽灯 第034部分 灯 型号382 产品标准 第P1版》.pdf ASD-STAN PREN 2240-034-1996 Aerospace Series Lamps Incandescent Part 034 Lamp Code 382 Product Standard (Edition P 1)《航空航天系列 白炽灯 第034部分 灯 型号382 产品标准 第P1版》.pdf
  • ASD-STAN PREN 2240-035-1996 Aerospace Series Lamps Incandescent Part 035  Lamp Code 387 Product Standard (Edition P 1)《航空航天系列 白炽灯 第035部分 灯 型号387 产品标准 第P1版》.pdf ASD-STAN PREN 2240-035-1996 Aerospace Series Lamps Incandescent Part 035 Lamp Code 387 Product Standard (Edition P 1)《航空航天系列 白炽灯 第035部分 灯 型号387 产品标准 第P1版》.pdf
  • 相关搜索

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

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