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

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

1、计算机二级 JAVA-50 及答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序的功能是随机产生 50 个 0100 间的随机数,并计算 7080 间随机数的个数(包括 70,不包括80)。 public class exam_10 public static void main(String args) int result=0; int i=0; int randomNum; while(i50) randomNum=_; if(_) result+; _; System.out.println(“result=“+resu

2、lt); (分数:30.00)_2.本程序随机产生若干字母(AZ),直到出现字母 Q 停止。 public class exam_11 public static void main(String args) _; do c=(char)(_); System.out.print(c+“,“); while(_); (分数:30.00)_3.本程序采用递归的方法计算 n!(n=8)。 public class exam_12 static long Fac(_) if(_) return 1; else _; public static void main(String args) int n

3、8; System.out.println(n+“!=“+Fac(n); (分数:40.00)_计算机二级 JAVA-50 答案解析(总分:100.00,做题时间:90 分钟)一、B基本操作题/B(总题数:3,分数:100.00)1.本程序的功能是随机产生 50 个 0100 间的随机数,并计算 7080 间随机数的个数(包括 70,不包括80)。 public class exam_10 public static void main(String args) int result=0; int i=0; int randomNum; while(i50) randomNum=_; if(

4、) result+; _; System.out.println(“result=“+result); (分数:30.00)_正确答案:(int) (Math.random() *100) randomNum=70 do c=(char)(_); System.out.print(c+“,“); while(_); (分数:30.00)_正确答案:(char c (int) (Math.random() *26)+A c!=Q)解析:3.本程序采用递归的方法计算 n!(n=8)。 public class exam_12 static long Fac(_) if(_) return 1; else _; public static void main(String args) int n=8; System.out.println(n+“!=“+Fac(n); (分数:40.00)_正确答案:(int n n=1 return n*Fac(n-1)解析:

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

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

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