版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、选择题1:Which statement about listener is true?A.Most component allow multiple listeners to be added.B.If multiple listener be add to a single component, the event only affected one listener.C.Component don?t allow multiple listeners to be add.D.none2:What is the result when you compile and run the fol
2、lowing code?public class ThrowsDemostatic void throwMethod()System.out.println("Inside throwMethod.");throw new IllegalAccessException("demo");public static void main(String args)trythrowMethod();catch (IllegalAccessException e)System.out.println("Caught " + e);Choices:
3、What is the result when you compile and run the following code?public class ThrowsDemostatic void throwMethod()System.out.println("Inside throwMethod.");throw new IllegalAccessException("demo");public static void main(String args)trythrowMethod();catch (IllegalAccessException e)S
4、ystem.out.println("Caught " + e);Choices:A.Compilation errorB.Runtime errorC.Compile successfully, nothing is printed.D.Inside throwMethod. followed by caught:java.lang.IllegalAccessExcption: demo3: Consider the class hierarchy shown below:class FourWheeler implements DrivingUtilitiesclass
5、 Car extends FourWheelerclass Truck extends FourWheelerclass Bus extends FourWheelerclass Crane extends FourWheelerConsider the following code below:1.DrivingUtilities du;2.FourWheeler fw;3.Truck myTruck = new Truck();4.du = (DrivingUtilities)myTruck;5.fw = new Crane();6.fw = du;Which of the stateme
6、nts below are true?Choices:A.Line 4 will not compile because an interface cannot refer to an object.B.The code will compile and run.C.The code will not compile without an explicit cast at line 6, because going down thehierarchy without casting is not allowed.D.The code will compile if we put an expl
7、icit cast at line 6 but will throw an exception atruntime.4:给出下面的代码片断。下面的哪些陈述为错误的?1) public void create() 2) Vector myVect;3) myVect = new Vector(); 4) 给出下面的代码片断。下面的哪些陈述为错误的?1) public void create() 2)3)4) Vector myVect;myVect = new Vector();A.第二行的为变量 myVect 分配内存空间。B.第二行语句创建一个 Vector 类对象。C.第三行语句创建一个
8、Vector 类对象。D.第三行语句为一个 Vector 类对象分配内存空间5:鉴于 Java 的特点,它最适合的计算环境是A.并行计算环境B.分布式计算环境C.高强度计算环境D.开放式计算环境6:Give the following java class: public class Examplepublic static void main(String args) static int x = new int15; System.out.println(x5);Which statement is corrected? Give the following java class: pub
9、lic class Examplepublic static void main(String args) static int x = new int15; System.out.println(x5);Which statement is corrected?A.When compile, some error will occur.B.When run, some error will occur.C.Output is zero.D.Output is null.7:Give the following java class: public class Examplestatic in
10、t x=new int15;public static void main(String args) System.out.println(x5);Which statement is corrected? Give the following java class: public class Examplestatic int x=new int15;public static void main(String args) System.out.println(x5);Which statement is corrected?A.When compile, some error will o
11、ccur.B.When run, some error will occur.C.Output is zero.D.Output is null.8:What will happen when you attempt to compile and run the following code?public class Staticstaticint x = 5;static int x,y;public static void main(String args)x-;myMethod();System.out.println(x + y + +x);public static void myM
12、ethod()y = x+ + +x;Choices:What will happen when you attempt to compile and run the following code?public class Staticstaticint x = 5;static int x,y;public static void main(String args)x-;myMethod();System.out.println(x + y + +x);public static void myMethod()y = x+ + +x;Choices:A.prints : 2B.prints
13、: 3C.prints : 7D.prints : 89:软件生命周期的瀑布模型把软件项目分为 3 个阶段、8 个子阶段,以下哪一个是正常的开发顺序?A.计划阶段、开发阶段、运行阶段B.设计阶段、开发阶段、编码阶段C.设计阶段、编码阶段、维护阶段D.计划阶段、编码阶段、测试阶段10:Given the following class definition:class A protected int i; A(int i) this.i=i;which of the following would be a valid inner class for this class? Select val
14、id answer:Given the following class definition:class A protected int i; A(int i) this.i=i;which of the following would be a valid inner class for this class? Select valid answer:A.class B B.class B extends A C.class B extends A B()System.out.println(“i=”+i); D.class B class A 11:Which is the most ap
15、propriate code snippet that can be inserted at line 18 in the following code?(Assume that the code is compiled and run with assertions enabled)1.import java.util.*;2.3.public class AssertTest4.5.private HashMap cctld;6.7.public AssertTest()8.9.cctld = new HashMap();10.cctld.put("in", "
16、;India");11.cctld.put("uk", "United Kingdom");12.cctld.put("au", "Australia");13./ more code.14.15./ other methods .16.public String getCountry(String countryCode)17.18./ What should be inserted here?19.String country = (String)cctld.get(countryCode);20.r
17、eturn country;21.22. Which is the most appropriate code snippet that can be inserted at line 18 in the following code?(Assume that the code is compiled and run with assertions enabled)1.import java.util.*;2.3.public class AssertTest4.5.private HashMap cctld;6.7.public AssertTest()8.9.cctld = new Has
18、hMap();10.cctld.put("in", "India");11.cctld.put("uk", "United Kingdom");12.cctld.put("au", "Australia");13./ more code.14.15./ other methods .16.public String getCountry(String countryCode)17.18./ What should be inserted here?19.String coun
19、try = (String)cctld.get(countryCode);20.return country;21.22. A.assert countryCode != null;B.assert countryCode != null : "Country code can not be null" ;C.assert cctld != null : "No country code data is available"D.assert cctld : "No country code data is available"12:T
20、he following code is entire contents of a file called Example.java,causes precisely one error durin g compilation:class SubClass extends BaseClassclass BaseClass() String str;public BaseClass() System.out.println(“ok”); public BaseClass(String s) str=s;public class Example public void method()SubCla
21、ss s=new SubClass(“hello”); BaseClass b=new BaseClass(“world”);Which line would be cause the error?The following code is entire contents of a file called Example.java,causes precisely one error during compilation:class SubClass extends BaseClassclass BaseClass() String str;public BaseClass() System.
22、out.println(“ok”); public BaseClass(String s) str=s;public class Examplepublic void method()SubClass s=new SubClass(“hello”); BaseClass b=new BaseClass(“world”);Which line would be cause the error?A.9B.10C.11D.1213:在软件生命周期中,下列哪个说法是确的?A.软件生命周期分为计划、开发和运行三个阶段B.在计划阶段要进行问题焉醛和需求分析C.在开发后期要进行编写代码和软件测试D.在运行阶段主要是进行软件维护14:Which of the following statements are not legal?A.long l = 4990;B.int i = 4L;C.double d = 34.4;D.double t = 0.9F.15:Select valid identifier of Java: Select valid identifier
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 陶溪川建设方案
- 2025年旅游危机应对与产业链协同可行性分析报告
- 企业生产管理培训班
- 低空经济航空器销售与售后服务方案
- 智能研修专项课题:基于人工智能的智能辅导系统在小学数学教学中的应用研究教学研究课题报告
- 小学美术数字化教学评价动态权重调整策略研究教学研究课题报告
- 虚拟现实在小学科学教育中的应用:创设真实科学探究环境的探索教学研究课题报告
- 基于生成式AI的智能教学系统对教师教学评价方式的影响研究教学研究课题报告
- 公司级安全培训试题含答案(考试直接用)
- 人教统编版必修3 政治与法治始终走在时代前列教案设计
- 雨季猪场生物安全防控
- 以上由自治区教育科学规划办填写内蒙古自治区教育科学“十四五”规划课题立项申请评审书
- 浙江省中高职一体化竞赛电商(高职)题库附有答案
- 中国建设银行建行研修中心华东研修院2023年招聘12名人才笔试上岸历年典型考题与考点剖析附带答案详解
- 全国专利代理师资格考试专利法律知识专项考试试题
- 湖州南太湖热电有限公司节能减排技改项目环境影响报告
- 《农业推广学》第05章 农业推广沟通
- 妊娠期高血压疾病诊治指南2020完整版
- 三角形的认识(强震球)
- 骨与关节结核PPT
- 2018年-2022年山东历史高考真题五年合集
评论
0/150
提交评论