【计算机类职业资格】全国计算机等级考试二级JAVA机试真题2006年3月及答案解析.doc

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

1、全国计算机等级考试二级 JAVA机试真题 2006年 3月及答案解析(总分:100.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:30.00)1.注意:下面出现的“考生文件夹”均为%USER%。在考生文件夹下存有文件名为 Java_1.java文件,请完善 Java_1.java文件,并进行调试,程序先显示一个输入窗口如下:连续输入 3个整数,显示积的结果如下:(分数:30.00)_二、简单应用题(总题数:1,分数:40.00)2.注意:下面出现的“考生文件夹”均为%USER%。在考生文件夹下存有文件名为 Java_2.java文件,本题功能是完成对字符串缓存类中与字符相关方法

2、的应用。请完善 Java_2.java文件,并进行调试,程序运行的某次结果如下:(分数:40.00)_三、综合应用题(总题数:1,分数:30.00)3.注意:下面出现的“考生文件夹”均为%USER%。在考生文件夹中存有文件名为 Java_3.java的文件,该程序是不完整的,请在注释行“/*Found*”下一行语句的下画线地方填入正确内容,然后删除下画线,请勿删除注释行或改动其他已有语句内容。存盘时文件必须存放在考生文件夹下,不得改变原有文件的文件名。本题的要求是:Java_3.java程序是一个二分法检索算法程序,完成程序,然后运行并所得结果为对 ArrayList分类:白,粉红,紫,红,茶

3、色,蓝,黄,黑检索关键字:黑找到下标 7检索关键字:红找到下标 3检索关键字:粉红找到下标 1检索关键字:绿没有找到-5检索关键字:灰没有找到-1检索关键字:橙色没有找到-1给定源程序:/Java_3.java:二分法检索算法import Java.util.*;public class Java_3private String colors=“红“,“白“,“蓝“,“黑“,“黄“,“紫“,“茶色“,“粉红“);private ArrayList aList;/ArrayList 引用public Java_3()aList=new ArrayList(Arrays.asList(colors

4、);Collections.sort(aList);/ArrayList分类System.out.println(“对 ArrayList分类:“+aList);public void printSearchResults()printSearchResultsHelper(colorsE3); /首项printSearchResultsHelper(colors0); /中间项printSearchResultsHelper(colors7); /最后项printSearchResultsHelper(“绿“); /最低printSearchResultsHelper(“灰“); /不存在/

5、Found*printSearchResultsHelper(“_“); /不存在private void printSearchResultsHelper(String key)int result=0;System out.println(“/n检索关键字:“+key);result=Collections binarySearch(aList, key);System.out.primtln(result=0?“找到下标“+result:“没有找到(“+result+“)“);public static void main(String args)/*Found*new Java_3(

6、)._;(分数:30.00)_全国计算机等级考试二级 JAVA机试真题 2006年 3月答案解析(总分:100.00,做题时间:90 分钟)一、基本操作题(总题数:1,分数:30.00)1.注意:下面出现的“考生文件夹”均为%USER%。在考生文件夹下存有文件名为 Java_1.java文件,请完善 Java_1.java文件,并进行调试,程序先显示一个输入窗口如下:连续输入 3个整数,显示积的结果如下:(分数:30.00)_正确答案:(showInputDialog parseInt JOptionPane)解析:解析 第 1处:输入对话框函数,需填入 showInputDialog。第 2

7、处:将字符串转换成整数的函数,需填入 parseInt。第 3处:显示信息对话框函数,需填入 JOptionPane。二、简单应用题(总题数:1,分数:40.00)2.注意:下面出现的“考生文件夹”均为%USER%。在考生文件夹下存有文件名为 Java_2.java文件,本题功能是完成对字符串缓存类中与字符相关方法的应用。请完善 Java_2.java文件,并进行调试,程序运行的某次结果如下:(分数:40.00)_正确答案:(new getChars charArray.length reverse()解析:解析 第 1处:定义字符数组,需填入 new。第 2处:创建文本域对象,需填入 get

8、Chars。第 3处:循环变量的终值,需填入 charArray.length。第 4处:将字符串缓冲区里的字符串反向排列,需填入 reverse()。三、综合应用题(总题数:1,分数:30.00)3.注意:下面出现的“考生文件夹”均为%USER%。在考生文件夹中存有文件名为 Java_3.java的文件,该程序是不完整的,请在注释行“/*Found*”下一行语句的下画线地方填入正确内容,然后删除下画线,请勿删除注释行或改动其他已有语句内容。存盘时文件必须存放在考生文件夹下,不得改变原有文件的文件名。本题的要求是:Java_3.java程序是一个二分法检索算法程序,完成程序,然后运行并所得结果

9、为对 ArrayList分类:白,粉红,紫,红,茶色,蓝,黄,黑检索关键字:黑找到下标 7检索关键字:红找到下标 3检索关键字:粉红找到下标 1检索关键字:绿没有找到-5检索关键字:灰没有找到-1检索关键字:橙色没有找到-1给定源程序:/Java_3.java:二分法检索算法import Java.util.*;public class Java_3private String colors=“红“,“白“,“蓝“,“黑“,“黄“,“紫“,“茶色“,“粉红“);private ArrayList aList;/ArrayList 引用public Java_3()aList=new Array

10、List(Arrays.asList(colors);Collections.sort(aList);/ArrayList分类System.out.println(“对 ArrayList分类:“+aList);public void printSearchResults()printSearchResultsHelper(colorsE3); /首项printSearchResultsHelper(colors0); /中间项printSearchResultsHelper(colors7); /最后项printSearchResultsHelper(“绿“); /最低printSearch

11、ResultsHelper(“灰“); /不存在/*Found*printSearchResultsHelper(“_“); /不存在private void printSearchResultsHelper(String key)int result=0;System out.println(“/n检索关键字:“+key);result=Collections binarySearch(aList, key);System.out.primtln(result=0?“找到下标“+result:“没有找到(“+result+“)“);public static void main(String args)/*Found*new Java_3()._;(分数:30.00)_正确答案:(橙色 printSearchResuhs()解析:解析 第 1处:检索结果,需填入橙色。第 2处:创建对象,需填入 printSearchResults()。

展开阅读全文
相关资源
猜你喜欢
  • EN ISO 15750-1-2008 en Packaging - Steel drums - Part 1 Removable head (open head) drums with a minimum total capacity of 208 l 210 l and 216 5 l《包装 钢制鼓形桶 最小总容量为208L 210L和216 5L的可拆.pdf EN ISO 15750-1-2008 en Packaging - Steel drums - Part 1 Removable head (open head) drums with a minimum total capacity of 208 l 210 l and 216 5 l《包装 钢制鼓形桶 最小总容量为208L 210L和216 5L的可拆.pdf
  • EN ISO 15750-2-2008 en Packaging - Steel drums - Part 2 Non-removable head (tight head) drums with a minimum total capacity of 212 l 216 5 l and 230 l《包装 钢制鼓形桶 最小总容量为121L 216 5L和23.pdf EN ISO 15750-2-2008 en Packaging - Steel drums - Part 2 Non-removable head (tight head) drums with a minimum total capacity of 212 l 216 5 l and 230 l《包装 钢制鼓形桶 最小总容量为121L 216 5L和23.pdf
  • EN ISO 15750-3-2008 en Packaging - Steel drums - Part 3 Inserted flange-type closure systems《包装 钢制鼓形桶 第3部分 插入式法兰型密封系统》.pdf EN ISO 15750-3-2008 en Packaging - Steel drums - Part 3 Inserted flange-type closure systems《包装 钢制鼓形桶 第3部分 插入式法兰型密封系统》.pdf
  • EN ISO 15752-2010 en Ophthalmic instruments - Endoilluminators - Fundamental requirements and test methods for optical radiation safety《眼科仪器 内发光器 光辐射安全的基本要求和试验方法》.pdf EN ISO 15752-2010 en Ophthalmic instruments - Endoilluminators - Fundamental requirements and test methods for optical radiation safety《眼科仪器 内发光器 光辐射安全的基本要求和试验方法》.pdf
  • EN ISO 15753-2006 3750 Animal and vegetable fats and oils - Determination of polycyclic aromatic hydrocarbons - Exclusion of olive pomace oil from the scope (Incorporates Amendment.pdf EN ISO 15753-2006 3750 Animal and vegetable fats and oils - Determination of polycyclic aromatic hydrocarbons - Exclusion of olive pomace oil from the scope (Incorporates Amendment.pdf
  • EN ISO 15753-2016 en Animal and vegetable fats and oils - Determination of polycyclic aromatic hydrocarbons《动物和植物脂肪和油中多环芳烃的测定(ISO 15753 2016)》.pdf EN ISO 15753-2016 en Animal and vegetable fats and oils - Determination of polycyclic aromatic hydrocarbons《动物和植物脂肪和油中多环芳烃的测定(ISO 15753 2016)》.pdf
  • EN ISO 15755-1999 en Paper and Board - Estimation of Contraries《纸与纸张 反面估算 ISO 15755-1999》.pdf EN ISO 15755-1999 en Paper and Board - Estimation of Contraries《纸与纸张 反面估算 ISO 15755-1999》.pdf
  • EN ISO 15758-2014 en Hygrothermal performance of building equipment and industrial installations - Calculation of water vapour diffusion - Cold pipe insulation systems《建筑物设备和工业设施的湿.pdf EN ISO 15758-2014 en Hygrothermal performance of building equipment and industrial installations - Calculation of water vapour diffusion - Cold pipe insulation systems《建筑物设备和工业设施的湿.pdf
  • EN ISO 15761-2002 en Steel gate globe and check valves for sizes DN 100 and smaller for the petroleum and natural gas industries《石油及天然气工业用DN100及较小的钢闸阀 球阀和防逆阀 ISO 15761-2002》.pdf EN ISO 15761-2002 en Steel gate globe and check valves for sizes DN 100 and smaller for the petroleum and natural gas industries《石油及天然气工业用DN100及较小的钢闸阀 球阀和防逆阀 ISO 15761-2002》.pdf
  • 相关搜索

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

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