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

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

1、计算机二级 JAVA-79 及答案解析(总分:100.00,做题时间:90 分钟)一、基本操作题(总题数:3,分数:100.00)1.本程序计算 1100 中所有 7 的倍数的和,并打印输出结果。 public class exam_94 public static void main(String args) int i=1; _; for(i=1;i=100;i+) if(_) _; System.out.println(“sum=“+sum); (分数:30.00)_2.本程序随机产生 10 位学生的成绩(0100 之间),要求每位学生的成绩都必须及格,同时团体的平均分不少于 70 分,

2、这样这个团体才能通过,否则就不能通过。 public class exam_95 public static void main(String args) int score,sum=0,i; for(i=1;i=10;i+) score=(int)(_); System.out.print(score+“,“); if(score60) _; sum=sum+score; i+; System.out.println(); if(i=10) else System.out.println(“This team doesn“t pass!“); (分数:30.00)_3.本程序定义了方法 ch

3、eck 用来判断学生成绩是否通过考试(成绩大于等于 60 者属于通过考试),程序中调用该方法判断成绩为 75 分的学生是否通过考试,并打印输出判断结果。 public class exam_96 public static void main (String args) int score=75; System.out.println(score+“ means “+check(score); static String check(_) String str; str=“pass“; else str=“fall“; _; (分数:40.00)_计算机二级 JAVA-79 答案解析(总分:1

4、00.00,做题时间:90 分钟)一、基本操作题(总题数:3,分数:100.00)1.本程序计算 1100 中所有 7 的倍数的和,并打印输出结果。 public class exam_94 public static void main(String args) int i=1; _; for(i=1;i=100;i+) if(_) _; System.out.println(“sum=“+sum); (分数:30.00)_正确答案:()解析:第 1 处:int sum=0 第 2 处:i%7=0 第 3 处:sum=sum+i(或 sum+=i)2.本程序随机产生 10 位学生的成绩(01

5、00 之间),要求每位学生的成绩都必须及格,同时团体的平均分不少于 70 分,这样这个团体才能通过,否则就不能通过。 public class exam_95 public static void main(String args) int score,sum=0,i; for(i=1;i=10;i+) score=(int)(_); System.out.print(score+“,“); if(score60) _; sum=sum+score; i+; System.out.println(); if(i=10) else System.out.println(“This team do

6、esn“t pass!“); (分数:30.00)_正确答案:()解析:第 1 处:Math.random()*100 第 2 处:break 第 3 处:(sum/10)=703.本程序定义了方法 check 用来判断学生成绩是否通过考试(成绩大于等于 60 者属于通过考试),程序中调用该方法判断成绩为 75 分的学生是否通过考试,并打印输出判断结果。 public class exam_96 public static void main (String args) int score=75; System.out.println(score+“ means “+check(score); static String check(_) String str; str=“pass“; else str=“fall“; _; (分数:40.00)_正确答案:()解析:第 1 处:int score 第 2 处:if(score=60) 第 3 处:return str

展开阅读全文
相关资源
猜你喜欢
相关搜索

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

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