已阅读5页,还剩10页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
选择题 1:在软件生命周期中,下列哪个说法是不准确的? A.软件生命周期分为计划、开发和运行三个阶段 B.在计划阶段要进行问题焉醛和需求分析 C.在开发后期要进行编写代码和软件测试 D.在运行阶段主要是进行软件维护 2: Whichisthemostappropriatecodesnippetthatcanbeinsertedatline18inthefollowingcode? (Assumethatthecodeiscompiledandrunwithassertionsenabled) 1.importjava.util.*; 2. 3.publicclassAssertTest 4. 5.privateHashMapcctld; 6. 7.publicAssertTest() 8. 9.cctld=newHashMap(); 10.cctld.put(in,India); 11.cctld.put(uk,UnitedKingdom); 12.cctld.put(au,Australia); 13./morecode. 14. 15./othermethods. 16.publicStringgetCountry(StringcountryCode) 17. 18./Whatshouldbeinsertedhere? 19.Stringcountry=(String)cctld.get(countryCode); 20.returncountry; 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 HashMap();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 country = (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; 3: Givethefollowingcode: publicclassExample publicstaticvoidmain(Stringargs) intl=0; do System.out.println(“Doingitforlis:”+l); while(-l0) System.out.println(“Finish”); Whichwellbeoutput:Give the following code:public class Examplepublic static void main(String args )int l=0;doSystem.out.println(“Doing it for l is:”+l);while(-l0)System.out.println(“Finish”);Which well be output: A.Doing it for l is 3 B.Doing it for l is 1 C.Doing it for l is 2 D.Doing it for l is 0 4: Givethisclassoutline: classExample privateintx; /restofclassbody AssumingthatxinvokedbythecodejavaExample,whichstatementcanmadexbedirectlyaccessibleinmain()methodofExample.java?Give this class outline:class Exampleprivate int x;/rest of class bodyAssuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?A.Change private int x to public int x B.change private int x to static int x C.Change private int x to protected int x D.change private int x to final int x 5: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. 6:鉴于Java的特点,它最适合的计算环境是 A.并行计算环境 B.分布式计算环境 C.高强度计算环境 D.开放式计算环境 7:What is written to the standard output given the following statement:System.out.println(4|7); Select the right answer: A.4 B.5 C.6 D.7 8: 1.publicclassX 2.publicobjectm() 3.objecto=newfloat(3.14F); 4.objectoa=newobject1; 5.oa0=o; 6.o=null; 7.oa0=null; 8.returno; 9. 10. Whenisthefloatobjectcreatedinline3,eligibleforgarbagecollection? 1. public class X 2. public object m () 3. object o = new float (3.14F); 4. object oa = new object 1; 5. oa0= o; 6. o = null; 7. oa0 = null; 8.return o; 9. 10. When is the float object created in line 3, eligible for garbage collection? A.Just after line 5 B.Just after line 6 C.Just after line 7 D.Just after line 8(that is, as the method returns) 9: Consider the class hierarchy shown below: - class FourWheeler implements DrivingUtilities class Car extends FourWheeler class Truck extends FourWheeler class Bus extends FourWheeler class Crane extends FourWheeler - Consider 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 statements 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 the hierarchy without casting is not allowed. D.The code will compile if we put an explicit cast at line 6 but will throw an exception at runtime. 10: Givethefollowingmethod: publicvoidmethod() Stringa,b; a=newString(“helloworld”); b=newString(“gameover”); System.out.println(a+b+”ok”); a=null; a=b; System.out.println(a); Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitelyelibiletobegarbagecollection.Give the following method: public void method( ) String a,b; a=new String(“hello world”); b=new String(“game over”); System.out.println(a+b+”ok”); a=null; a=b; System.out.println(a); In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.A.before line 5 B.before line 6 C.before line 7 D.before line 9 11: Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? publicclassStatic static intx=5; staticintx,y; publicstaticvoidmain(Stringargs) x-; myMethod(); System.out.println(x+y+x); publicstaticvoidmyMethod() 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 : 2 B.prints : 3 C.prints : 7 D.prints : 8 12: Whatwillbetheresultofexecutingthefollowingcode? publicstaticvoidmain(Stringargs) chardigit=a; for(inti=0;i10;i+) switch(digit) casex: intj=0; System.out.println(j); default: intj=100; System.out.println(j); inti=j; System.out.println(i); Choices:What will be the result of executing the following code? public static void main(String args) char digit = a; for (int i = 0; i 10; i+) switch (digit) case x : int j = 0; System.out.println(j); default : int j = 100;System.out.println(j); int i = j; System.out.println(i); Choices:A.100 will be printed 11 times. B.The code will not compile because the variable i cannot be declared twice within the main() method. C.The code will not compile because the variable j cannot be declared twice within the switch statement. D.None of these. 13:软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开发顺序? A.计划阶段、开发阶段、运行阶段 B.设计阶段、开发阶段、编码阶段 C.设计阶段、编码阶段、维护阶段 D.计划阶段、编码阶段、测试阶段 14:设有变量说明语句int a=1,b=0; 则执行以下程序段的输出结果为( )。 switch (a) case 1: switch (b) case 0:printf(*0*);break; case 1:printf(*1*);break; case 2:printf(*2*);break; printf(n); A.*0* B.*0*2* C.*0*1*2* D.有语法错误 15: Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? classBase inti=99; publicvoidamethod() System.out.println(Base.amethod(); Base() amethod(); publicclassDerivedextendsBase inti=-1; publicstaticvoidmain(Stringargv) Baseb=newDerived(); System.out.println(b.i); b.amethod(); publicvoidamethod() System.out.println(Derived.amethod(); Choices:What will happen when you attempt to compile and run the following code? class Base int i = 99; public void amethod() System.out.println(Base.amethod(); Base() amethod(); public class Derived extends Baseint i = -1; public static void main(String a
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年抚顺市顺城区工会人员招聘笔试参考试题及答案详解
- 2026年佛山市顺德区法检系统书记员招聘考试模拟试题及答案详解
- 2026年陕西省渭南市工会人员招聘考试备考题库及答案详解
- 2026年河南洛阳洛龙职业学院单招综合素质考试题库及完整答案详解1套
- 2024年新乡牧野职业学院高职单招职业技能考试题库A4版附答案详解
- 2027年贺兰专修学院单招职业技能考试模拟试卷(B卷)附答案详解
- 2024年陕西省铜川市单招职业技能考试题库及答案详解(考点梳理)
- 2026年湍河职业学院高职单招职业技能考试题库(考点提分)附答案详解
- 2027年山东平邑职业学院高职单招职业技能考试模拟试卷及完整答案详解(名校卷)
- 2025年湖南省衡阳市单招综合素质考试题库含答案详解【基础题】
- 沪教版六年级上册数学练习题
- 血管炎患者的护理
- 架线跨越果林施工方案
- 16G362钢筋混凝土结构预埋件(详细书签)图集
- 价值型销售(技能篇)
- T-CECS120-2021套接紧定式钢导管施工及验收规程
- 医学实验风险评估报告
- MR355.臂丛神经规范化扫描方案
- 中式烹调工艺与实训(第三版) 课件全套 (刘致良) 第1-13章 绪论、烹饪文化- 成本控制
- 蒋争:英语词汇的奥秘(词根词缀)
- 山西兰花科技创业股份有限公司大阳煤矿分公司煤炭资源开发利用、地质环境保护与土地复垦方案
评论
0/150
提交评论