北京清软创新科技有限公司_第1页
北京清软创新科技有限公司_第2页
北京清软创新科技有限公司_第3页
北京清软创新科技有限公司_第4页
北京清软创新科技有限公司_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

选择题 1:在软件生命周期中,下列哪个说法是不准确的? A.软件生命周期分为计划、开发和运行三个阶段 B.在计划阶段要进行问题焉醛和需求分析 C.在开发后期要进行编写代码和软件测试 D.在运行阶段主要是进行软件维护 2:Which fragments are not correct in Java source file? A.package testpackage; public class Test/do something. B.import java.io.*; package testpackage; public class Test/ do something. C.import java.io.*; class Person/ do something. public class Test/ do something. D.import java.io.*; import java.awt.*; public class Test/ do something. 3: 1. Whatwillbetheresultofexecutingthefollowingcode? 2. 3. /Filename;SuperclassX.java 4. 5. packagepackageX; 6. 7. publicclassSuperclassX 8. 9. 10. 11. protectedvoidsuperclassMethodX() 12. 13. 14. 15. 16. 17. intsuperclassVarX; 18. 19. 20. 21. 22. 23. /FilenameSubclassY.java 24. 25. 1.packagepackageX.packageY; 26. 27. 2. 28. 29. 3.publicclassSubclassYextendsSuperclassX 30. 31. 4. 32. 33. 5.SuperclassXobjX=newSubclassY(); 34. 35. 6.SubclassYobjY=newSubclassY(); 36. 37. 7.voidsubclassMethodY() 38. 39. 8. 40. 41. 9.objY.superclassMethodX(); 42. 43. 10.inti; 44. 45. 11.i=objY.superclassVarX; 46. 47. 12. 48. 49. 13. 50. 51. Choices:What will be the result of executing the following code? / Filename; SuperclassX.javapackage packageX; public class SuperclassXprotected void superclassMethodX()int superclassVarX; / Filename SubclassY.java1.package packageX.packageY;2.3.public class SubclassY extends SuperclassX4.5.SuperclassX objX = new SubclassY();6.SubclassY objY = new SubclassY();7.void subclassMethodY()8.9.objY.superclassMethodX();10.int i;11.i = objY.superclassVarX;12.13. Choices:A.Compilation error at line 5 B.Compilation error at line 9 C.Runtime exception at line 11 D.None of these 4: 1. Inthefollowingcode,whichistheearlieststatement,wheretheobjectoriginallyheldine,maybegarbagecollected: 2. 1.publicclassTest 3. 4. 2.publicstaticvoidmain(Stringargs) 5. 6. 3.Employeee=newEmployee(Bob,48); 7. 8. 4.e.calculatePay(); 9. 10. 5.System.out.println(e.printDetails(); 11. 12. 6.e=null; 13. 14. 7.e=newEmployee(Denise,36); 15. 16. 8.e.calculatePay(); 17. 18. 9.System.out.println(e.printDetails(); 19. 20. 10. 21. 22. 11. 23. OnlyOne:In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected: 1.public class Test 2. public static void main (String args ) 3. Employee e = new Employee(Bob, 48); 4. e.calculatePay(); 5. System.out.println(e.printDetails(); 6. e = null; 7. e = new Employee(Denise, 36); 8. e.calculatePay(); 9. System.out.println(e.printDetails(); 10. 11.Only One: A.Line 10 B.Line 11 C.Line 7 D.Line 8 5:Which are not Java keywords? A.TRUE B.const C.super D.void 6:Which declares for native method in a java class corrected? A.public native void method() B.public native void method(); C.public native method(); D.public void native method(); 7: 1. Givethefollowingmethod: 2. publicvoidmethod() 3. Stringa,b; 4. a=newString(“helloworld”); 5. b=newString(“gameover”); 6. System.out.println(a+b+”ok”); 7. a=null; 8. a=b; 9. System.out.println(a); 10. 11. 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 8:Which modifier should be applied to a method for the lock of object this to be obtained prior to excution any of the method body? A.synchronized B.abstract C.final D.static 9:Which code fragments would correctly identify the number of arguments passed via command line to a Java application, exclude the name of the class that is being invoke. A.int count = args.length; B.int count = args.length-1; C.int count=0; while(argscount!=null) count+; D.int count=0;while (!(argscount.equals(“”) count+; 10: 1. Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? 2. 3. intOutput=10; 4. 5. booleanb1=false; 6. 7. if(b1=true)&(Output+=10)=20) 8. 9. 10. 11. System.out.println(Weareequal+Output); 12. 13. 14. 15. else16. 17. 18. 19. System.out.println(Notequal!+Output); 20. 21. 22. 23. Choices:What will happen when you attempt to compile and run the following code? int Output = 10;boolean b1 = false; if(b1 = true) & (Output += 10) = 20) System.out.println(We are equal + Output); else System.out.println(Not equal! + Output); Choices:A.Compilation error, attempting to perform binary comparison on logical data type B.Compilation and output of We are equal 10. C.Compilation and output of Not equal! 20. D.Compilation and output of Not equal! 10. 11:A class design requires that a particular member variable must be accessible for direct access by any subclasses of this class. but otherwise not by classes which are not members of the same package. What should be done to achieve this? A.The variable should be marked public B.The variable should be marked private C.The variable should be marked protected D.The variable should have no special access modifier 12: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 13:以下的C程序代码片段运行后C和d的值分别是多少 Int a =1,b =2; Int c,d; c =(a&b)&a; d =(a&b)&a; A.0,0 B.0,1 C.1,0 D.1,1 14: Which of the following statements are true? A.The automatic garbage collection of the JVM prevents programs from ever running out of memory B.A program can suggest that garbage collection be performed and force it C.Garbage collection is platform independent D.An object becomes eligible for garbage collection when all references denoting it are set to null. 15: 1. Whatresultsfromattemptingtocompileandrunthefollowingcode? 2. 3. publicclassTernary 4. 5. 6. 7. publicstaticvoidmain(Stringargs) 8. 9. 10. 11. inta=5; 12. 13. System.out.println(Valueis-+(a5)?9.9:9); 14. 15. 16. 17. 18. 19. Choices:What results from attempting to compile and run the following code? public class Ternarypublic static void main(String args)int a = 5;System.out.println(Value is - + (a 5) ? 9.9 : 9); Choices:A.prints: Value is - 9 B.Compilation error C. prints: Value is - 5 D.None of these 16: 1. SelectvalididentifierofJava:Select valid identifier of Java:A.%passwd B.3d_game C.$charge D.this 17: 1. publicclassX 2. 3. publicObjectm() 4. 5. Objecto=newFloat(3.14F);/line3 6. 7. Objectoa=newObject1;/line4 8.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论