【计算机类职业资格】(A)二级JAVA笔试-17及答案解析.doc
《【计算机类职业资格】(A)二级JAVA笔试-17及答案解析.doc》由会员分享,可在线阅读,更多相关《【计算机类职业资格】(A)二级JAVA笔试-17及答案解析.doc(33页珍藏版)》请在麦多课文档分享上搜索。
1、(A)二级 JAVA 笔试-17 及答案解析(总分:100.00,做题时间:90 分钟)一、选择题(总题数:40,分数:70.00)1.如果进栈序列为 e1、e2、e3、e4、e5,则可能的出栈序列是_。Ae3、e1、e4、e2、e5 Be5、e2、e4、e3、e1Ce3、e4、e1、e2、e5 D任意顺序(分数:1.80)A.B.C.D.2.下述关于数据库系统的叙述中,正确的是_。A数据库系统减少了数据冗余B数据库系统避免了一切冗余C数据库系统中数据的一致性是指数据类型一致D数据库系统比文件系统能管理更多的数据(分数:1.80)A.B.C.D.3.数据流图用于抽象描述一个软件的逻辑模型,数据
2、流图由一些特定的图符构成。下列图符名标识的图符不属于数据流图合法图符的是_。A控制流 B加工C数据存储 D源和终(分数:1.80)A.B.C.D.4.已知一个有序线性表为(13,18,24,35,47,50,62,83,90,115,134),当用二分法查找值为 90的元素时,查找成功的比较次数为_。A1 B2C3 D9(分数:1.80)A.B.C.D.5.有下列二叉树,对此二叉树进行后序遍历的结果为_。(分数:1.80)A.B.C.D.6.下列关于项目中“移出”文件的说法,正确的是_。A被移出的文件将直接从磁盘中删除B被移出的文件将不能被任何项目添加C被移出的文件只是将文件移出项目,但文件保
3、留在磁盘中D被移出的文件,以后不能再次添加到原项目中,但可以添加到其他项目中(分数:1.80)A.B.C.D.7.需求分析阶段的任务是_。A软件开发方法 B软件开发工具C软件开发费用 D软件系统功能(分数:1.80)A.B.C.D.8.设 R 是一个 2 元关系,S 是一个 3 元关系,则下列运算中正确的是_。AR-S BRSCRS DRS(分数:1.80)A.B.C.D.9.结构化分析方法是面向_的自顶向下逐步求精进行需求分析的方法。A对象 B数据结构C数据流 D目标(分数:1.80)A.B.C.D.10.数据库设计包括两个方面的设计内容,它们是_。A概念设计和逻辑设计B模式设计和内模式设计
4、C内模式没计和物理设计D结构特性设计和行为特性设计(分数:1.80)A.B.C.D.11.用来导入已定义好的类或包的语句是_。Amain BimportCpublic class Dclass(分数:1.80)A.B.C.D.12.下列叙述中,正确的是_。A声明变量时必须指定一个类型BJava 认为变量 number 与 Number 相同CJava 中唯一的注释方式是“/”D源文件中 public 类可以有 0 个或多个(分数:1.80)A.B.C.D.13.下列属于合法的 Java 标识符是_。A“ABC“ BBstring a;Cchar a50;Dstring a=new String
5、50(分数:1.80)A.B.C.D.21.下列程序的输出结果是_。public class ArrayTestpublic static void main(String args)intintArray=new int3for(int i=0; i3; i+)intArrayi=i+2:system. out. println(“IntArray“+i+“=intArrayi);System. out. println (“-“);int arrLen=4:IntArray=new intarrLen;For(int j=intArray. length;j=0;j-)intArrayj=
6、j * 3;system. out. println(“hello“+intArrayj);A编译未通过 B编译通过,但运行错误C可以运行,但有错误 D以上都不对(分数:1.80)A.B.C.D.22.下列程序的运行结果是_。Public class sunPublic static void main (String args)int x=4, y=0;if (Math. pow (x, 2)=16)y=x;if (Math. pow (x, 2)15)y=1/x;if (Math. pow (x, 2)15)y=(int)Math. pow (x, 2)+1;system. out. pr
7、intln(y);A4 B17C18 D0.25(分数:1.80)A.B.C.D.23.自定义的异常类可从_类继承。AError BAWTErrorCVirtualMachineError DException 及其子集(分数:1.80)A.B.C.D.24.t 为 int 类型,进入下面的循环之前,t 的值为 0。则下列说法中正确的是_。while(t=1).A循环控制表达式的值为 0B循环控制表达式的值为 1C循环控制表达式不合法D以上说法都不对(分数:1.80)A.B.C.D.25.下面 for 循环语句的执行结果是_。for(int j=10; j3; j-)if(j%3! =0)j-
8、;-j;-j;System. out. println(j);A63 B74C62 D73(分数:1.80)A.B.C.D.26.关于 Applet 执行的操作,下面说法正确的是_。A在运行时调用其他程序B可以进行文件读/写操作C不能装载动态连接库和调用任何本地方法D试图打开一个 socket 进行网络通信,但是所连接的主机并不是提供 Applet 的主机(分数:1.80)A.B.C.D.27.下列关于 Applet 生命周期的说法,正确的是_。Avoidinit()在 Applet 下载前调用Bvoidstart()只在初始化之后调用Cvoidstop()在关闭浏览器时调用Dstop()总在
9、 voiddestroy()之前被调用(分数:1.80)A.B.C.D.28.对于下面语句的说法,不正确的是_。Thread thrObj=new Thread();A系统没有为该线程对象分配资源B只能启动或者终止C创建了一个空的线程对象D可以调用其他方法(分数:1.80)A.B.C.D.29.在 Java 中,线程是_。A分时的 B抢占式的C非抢占式的 D非分时的(分数:1.80)A.B.C.D.30.下列关于线程和进程的说法正确的是_。A进程结构的所有成分都在用户空间内B用户程序能够直接访问进程涉及的数据C线程是内核级的实体D线程结构驻留在用户空间中(分数:1.80)A.B.C.D.31.
10、下列选项成员变量声明正确的是_。Apublic protected final int i;Babstract class F1.Cprivate double height;Ddouble weight(分数:1.80)A.B.C.D.32.下面程序段的输出结果是_。class Testpublic static void main (String args)MyThread t=new MyThread();t. displayOutput(“t has been createD“);t. start();Class MyThread extends Threadpublic void d
11、isplayOutput(String s)System. out. println(s):)public void run()displayOutput(“t is running.“);At has been created.Bt has been created.t is running.Ct is running.D编译出错(分数:1.80)A.B.C.D.33.执行下列程序时,会产生什么异常_。public class Testpublic static void main (String args)int d=101;int b=220;long a=321;System. out
12、. println(a-b)/(a-b-d);AArrayIndexOutOfBoundsExceptionBNumberFormatExceptionCArithmeticExceptionDEOFException(分数:1.80)A.B.C.D.34.下面程序段的输出结果为_。public class Testpublic static void main(String args)booleana, b, C;a=(35);b= (a=true);System. out. println( “a= “+a+“b=“+b);c=(b=false);System. out. println
13、(“b=“+b+“c=“+c);Aa=true b=false b=true c=true Ba=true b=falseb=true c=falseCa=true b=true b=true c=false Da=false b=falseb=true c=false(分数:1.80)A.B.C.D.35.下面程序段的输出结果是_。public class Testpublic static void main(String args)int a, b;for (a=1, b=1; a=100; a+)if (b=10) break;if (b%2=1)b+=2;continue;Syste
14、m. out. println(a);A5 B6C7 D101(分数:1.80)A.B.C.D.36.栈中允许进行插入和删除的一端称为_。A栈顶 B栈底C栈端 D栈尾(分数:1.80)A.B.C.D.37.下面程序段的输出结果是_。public class Testpublic static void main (String args)int i=1;switch(i)case0:System. out. println(“0“);break;case1:System. out. println(“1“);case2:System. out. println(“2“);break;defau
15、lt:System. out. println(“default“);A01 B12C10 D21(分数:1.80)A.B.C.D.38.Frame 默认的布局管理器是_。AFlowLayout BBorderLayoutCGridLayout DUpLayout(分数:1.80)A.B.C.D.39.在 Java 语言中,ObjectOutputStream 是指_。A字节流 B字符流C对象输出流 D数据流(分数:0.80)A.B.C.D.40.请阅读下列程序代码,然后将程序的执行结果补充完整。横线处应填写的内容是_。程序代码:public class throwsExceptionstat
16、ic void Proe(intsel)throws Arithmetic Exception, Array Index Out OfBounds ExceptionSystem. out. println(“InSituation“+sel);if(sel=0)System. out. println( “noExeeption caught“)return;else if(sel=1)int iArray=newint4;iArray1=3;public static void main(String args)tryProc(0);Proc(1);catch(Array Index Ou
17、t Of Bounds Exception e)System. out. println( “Catch“+e);finallySystem. out. println(“inProcfinally“);执行结果:In Situation 0no Exception caught_in Proc finallyAIn Situation 1 BIn SituationCwith Catch Dint iArray 1(分数:0.80)A.B.C.D.二、基本操作题(总题数:1,分数:10.00)41.本题的功能是用冒泡法对数组元素 arr=30,1,-9,70)进行从小到大排列。冒泡法排序是比
18、较相邻的两个元素的大小,然后把小的元素交换到前面。public class java1public static void main(String args)int i, j;int arr=30,1,-9,70;int n=_;for(i=0; in-1; i+)for(j=i+1; jn; j+)if(arriarrj)int temp=arri;for(i=O; in; i+)System. out. print(arri+“ “);(分数:10.00)填空项 1:_三、简单应用题(总题数:1,分数:10.00)42.本题的功能是用按钮来控制文字的颜色。窗口中有三个按钮“Yellow”、
19、“Blue”和“Red”,它们分别对应文字标签中文本的颜色为黄色、蓝色和红色,单击任意一个按钮,文字标签中的文本就变成按钮对应的颜色。import java. awt. * ;import java. awt. event. * ;import javax. swing. * ;class ButtonPanel extends JPanel implements ActionListenerpublic ButtonPanel()yellowButton=new JButton(“Yellow“);blueButton=new JButton(“Blue“);redButton=new JB
20、utton(“Red“);jl=new JLabel(“I am from China!“);add(yellowButton);add(blueButton);add(redButton);add(jl);yellowButton. addActionListener(this);blueButton. addActionListener(this);redButton. addActionListener(this);public void actionPerformed(ActionEvent evt)Object source=evt. getSource();Color color=
21、getForeground();if(source=yellowButton) color=Color. yellow;else if(source=blueButton) color=Color. blue;else if(source=redButton) color=Color. red;_;_;private JButton yellowButton;private JButton blueButton;private JButton redButton;private JLabel jl;class ButtonFrame extends JFramepublic ButtonFra
22、me()setTitle(“exam_16“);setSize(300,200);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)System. exit(0););Container contentPane=getContentPane();contentPane, add(new ButtonPanel();public class java2public static void main(String args)JFrame frame=new ButtonFrame();frame
23、. show();(分数:10.00)填空项 1:_四、综合应用题(总题数:1,分数:10.00)43.本题的功能是监听对于菜单项和工具条的操作。窗口中有一个菜单“Color”和一个工具体,菜单“Color”中有菜单项“Yellow”、“Blue”、“Red”和“Exit”,每个菜单项都有对应的图形,单击前三个颜色菜单项,主窗口就变成对应的颜色,单击“Exit”则退出程序。工具条上有 4 个按钮,分别为三个颜色按钮和一个退出程序的按钮,单击任意一个颜色按钮,主窗口将变成按钮对应的颜色,单击退出程序按钮,则退出程序。import java. awt. * ;import java. awt. e
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
5000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 职业资格 二级 JAVA 笔试 17 答案 解析 DOC
