


版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、1. Which two demonstrate an is a relationship? (Choose Two)A. public interface Person public class Employee extends Person B. public interface Shape public class Employee extends Sha pe C. public interface Color public class Employee extends Color D. public class Species public class Animalprivate S
2、pecies species;E. interface Component Class Container implements Component (Private Component children;Answer:de2. Given:1. package foo;2.2. public class Outer (3. public static class Inner (5-)6. )Which statement is true?A. An instance of the Inner class can be constructed with new Outer.lnner ()B.
3、 An instance of the inner class cannot be constructed outside of package fooC. An instance of the inner class can only be constructed from within the outer classD. From within the package bar, an instance of the inner class can be constructed with new inner 。Answer:c3. Exhibit :1 public class enclos
4、inggone2 public class insideone34 public class inertest5 public static void main (String args)6 enclosingone eo = new enclosingone();7 /insert code here8Which statement at line 7 constructs an instance of the inner class?A. InsideOne ei = eo.new lnsideOne();B. B. Eo.InsideOne ei = eo.new lnsideOne()
5、;C InsideOne ei = EnclosingOne.new lnsideOne();D.EnclosingOne InsideOne ei = eo.new lnsideOne();Answer:aC. 4.D. 1) class SuperE. 2) public float getNum()return 3.Of;F. 3) G. 4)H. 5) public class Sub extends SuperI. 6)J. 7) K. which method, placed at line 6, will cause a compiler error?L. A. public f
6、loat getNum()return 4.Of;M. B. public void getNum()N. C. public void getNum(double d)O. D. public double getNum(float d)return 4.0d;Answer:B5.1) public class Foo2) public static void main(String args)3) tryreturn;4) finally System.out.println(Finally);5) 6) what is the result?A. The program runs and
7、 prints nothing.B. The program runs and prints Tinally.C. The code compiles, but an exception is thrown at runtime.D. The code will not compile because the catch block is missing.Answer:b6./point X public class Foopublic static void main(String args)Printwriter out=new PrintWriter(new java.io.Output
8、StreamWriter(System.out),true);out.println(Hello);which statement at point X on line 1 allows this code to compile and run?A. import java.io.PrintwriterB.includeC. import java.io.OutputStreamWriter D.includeE. No statement is neededAnswer:a7. which three are valid declaraction of a float?A. float fo
9、o=-1;B. float foo=1.0;C. float foo=42e1;D. float foo=2.02f;E. float foo=3.03d;F. float foo=0x0123;Answer:adfint index=1; int foo=new int3; int bar=fooindex;int baz=bar+index; what is the result?A. baz has a value of 0B. baz has value of 1C. baz has value of 2D. an exception is thrownE. the code will
10、 not compileAnswer:b9.1) int i=1,j=10;2) do3) if(i+-j) continue; 192837464) while(ij)continue;j; while(+i6); what are the vale of i and j?A. i=6,j=5B. i=5,j=5C. i=6,j=4D. i=5,j=6E. i=6,j=6Answer: A20.byte array 1 ,array2 byte array3 byte array4if each has been initialized, which statement will cause
11、 a compile error?A. array2 = array 1;B. array2 = array3;C. array2 = array4;D. both A and BE. both A and CF. both B and CAnswer: a21.which four types of objects can be thrown use throws?A. ErrorB. EventC. ObjectD. ExcptionE. ThrowableF. RuntimeExceptionAnswer: A,D,E, F22.1) public class Test2) public
12、 static void main(String args)3) unsigned byte b=0;4) b-;5)5) 6) what is the value of b at line 5?A. -1 B.255 C.127 D.compile fail E.compile succeeded but run errorAnswer: d23.public class ExceptionTestclass TestExcepti on exte nds Excepti onpublic void runTest() throws TestExceptionpublic void test
13、() /* point x */ runTest();At point x, which code can be add on to make the code compile?A. throws ExceptionB. catch (Exception e)C. throws RuntimeExceptionD. catch (TestException e)E. no code is necessaryAnswer: A24.String foo=blue;boolean bar=new boolean1;if(barO) foo=green;what is the value of fo
14、o?A. B.null C.blue D.greenAnswer: C25.which two are equivalent?3/2323*43?23*2A3?10&methodB(1);10. b=i10&methodB(2);11. 14.12. public static void main(String args) 13. methodA(O);17.14. 15. What is the value of j at line 17?A. 0B. 1C. 2D. 3E. The code will not compile.Answer: B43.public class Testpub
15、lic static void main(String args) String foo=blue;4) String bar=foo;5) foo=green;6) System.out.println(bar);what is the result?A. An exception is thrown.B. The code will not compile.C. The program prints null.D. The program prints blue.E. The program prints green.Answer: D44.class Apublic int getNum
16、ber(int a)return a+1;class B extends Apublic int getNumber(int a, char c)return a+2;public static void main(String args)B b=new B();14) System.out.println(b.getNumber(0);what is the result?A. compilation succeeds and 1 is printedB. compilation succeeds and 2 is printedC. An error at line 8 cause com
17、pilation to failD. An error at line 14 cause compilation to failAnswer: a45.You are assigned the task of building a Panel containing a TextArea at the top, a Labbel directly bellow it, and a Button directly bellow the Label. If the three components added directly to the Panel, which layout manager c
18、an the Panel use to ensure that the TextArea absorbs all of the free vertical space when the Panel is resized?A.GridLayoutB.CardLayoutC.FIowLayoutD.BorderLayoutE.GridbagLayoutAnswer: e46.which two are true to describe an entire encapsulation class?A. member data have no access modifiersB. member dat
19、a can be modified directlyC. the access modifier for methods is protectedD. the access modifier to member data is privateE. methods provide for access and modification of dataAnswer: d,e47.public class X implements Runnablepublic static void main(String args)3) /insert codepublic void run()int x=0,y
20、=0;for(;)x+;Y+;System.out.println(x=+x+,y=+y);You want to cause execution of the run method in a new thread of execution.Which line(s) should be added to the main method at line 3?A. X x=new X();x.run();B. X x=new X();new Thread(x).run();C. X x=new X();new Thread(x).start();D. Thread t=new Thread(x)
21、.run();E. Thread t=new Thread(x).start();Answer: a,c48.which gets the name of the parent directory of file file.txt?A. String name=File.getParentName(file.txt);B. String name=(new File(file.txt).getParent();C. String name=(new File(file.txt).getParentName();D. String name=(new File(file.txt).getPare
22、ntFile();E. Diretory dir=(new File(file.txt).getParentDir();String name=dir.getName();Answer: b49.The file file.txt exists on the file system and contains ASCII text. tryFile f=new File(file.txt);Outputstream out=new FileOutputStream(f);catch (lOException e)A. the code does not compileB. the code ru
23、ns and no change is made to the fileC. the code runs and sets the length of the file to 0D. An exception is thrown because the file is not closedE. the code runs and deletes the file from the file systemAnswer: c50.The file file.txt exists on the file system and contains ASCII text. Given:38. try 39
24、. File f = new File( file.txt);40. Outputstream out = new FileOutputStream(f, true);41. 42. catch (lOException) What is the result?A. The code does not compile.B. The code runs and no change is made to the file.C. The code runs and sets the length of the file to 0.D. An exception is thrown because t
25、he file is not closed.E. The code runs and deletes the file from the file system.Answer:A51.import java.io.lOException;public class ExceptionTestpublic static void main(String args)trymethodA();catch(IOException e)System.out.println(Caught Exception);public void methodA()throw new IOException();what
26、 is the result?A. The code will not compileB. The output is Caught ExceptionC. The output is Caught lOExceptionD. The program executes normally without printing a messageAnswer: a52.Which two can directly cause a thread to stop executing? (Choose Two)A. Exiting from a synchronized block.B. Calling t
27、he wait method on an object.C. Calling the notify method on an object.D. Calling the notifyAII method on an object.E. Calling the setPriority method on a thread object.Answer: B, E53.You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be access in nature order, which interace provides that capability?A.B.C.D. java.utiLSortedSetE.F. java.utiLCollectionAnswer: B54.which two cannot directly cause a thread to stop executing?A. calling the yield methodB
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年教师招聘之《幼儿教师招聘》考前冲刺练习题库附答案详解(完整版)
- 2025年教师招聘之《幼儿教师招聘》题库必刷100题及答案详解【网校专用】
- 工业环保处理基地项目可行性研究报告模板立项申批备案
- 实商务英语综合教程(第一册)-课件 Unit 1 Meeting and Entertaining Clients
- 2025晋中祁县司法协理员招聘笔试模拟试题及答案解析
- 合肥市城镇居民消费结构:特征、影响与展望
- 民政局公考面试题库及答案
- 教师招聘之《小学教师招聘》考试押题密卷附参考答案详解【突破训练】
- 教师招聘之《幼儿教师招聘》综合检测题型汇编含答案详解(典型题)
- 教师招聘之《小学教师招聘》考前冲刺模拟题库附答案详解【满分必刷】
- 工作文件自用补充调研报告
- 美世-职位说明书与任职资格管理
- 苏科版生物七年级上册全套课件
- 第二章:保险的性质和功能
- 《危险化学品重点县专家指导服务手册》
- 中医学概论智慧树知到答案章节测试2023年安徽中医药大学
- 中华全国律师协会律师办理企业破产法律业务操作指引
- GB/T 5218-1999合金弹簧钢丝
- GB/T 19812.5-2019塑料节水灌溉器材第5部分:地埋式滴灌管
- 水文地质学基础课件
- 《科学思维与科学方法论》第二章 科学思维的逻辑方法
评论
0/150
提交评论