




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
选择题 1: 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 2:在软件生命周期中,下列哪个说法是不准确的? A.软件生命周期分为计划、开发和运行三个阶段 B.在计划阶段要进行问题焉醛和需求分析 C.在开发后期要进行编写代码和软件测试 D.在运行阶段主要是进行软件维护 3:Which of the following answer is correct to express the value 8 in octal number? A.010 B.0x10 C.08 D.0x8 4:Use the operator “” and “”. Which statement is true? A.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 1010 0000 0000 0000 0000 0000 0000 B.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 C.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 0000 0000 0000 0000 0000 0000 0000 D.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 5:Which statement about the garbage collection mechanism are true? A.Garbage collection require additional programe code in cases where multiple threads are running. B.The programmer can indicate that a reference through a local variable is no longer of interest. C.The programmer has a mechanism that explicity and immediately frees the memory used by Java objects. D.The garbage collection mechanism can free the memory used by Java Object at explection time. 6:鉴于Java的特点,它最适合的计算环境是 A.并行计算环境 B.分布式计算环境 C.高强度计算环境 D.开放式计算环境 7:在下述选项时,没有构成死循环的程序是 A.int i=100 while (1) i=i%100+1; if (i100) break; B.for (;); C.int k=1000; do +k; while(k=10000); D.int s=36; while (s);-s; 8: 1. Givethefollowingjavasourcefragement: 2. /pointx 3. publicclassInteresting 4. /dosomething 5. 6. WhichstatementiscorrectlyJavasyntaxatpointx?Give the following java source fragement:/point xpublic class Interesting/do somethingWhich statement is correctly Java syntax at point x? A.public class MyClass/do other thing B.static int PI=3.14 C.class MyClass/do something D.none 9: 1. Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? 2. 3. classBase 4. 5. 6. 7. inti=99; 8. 9. publicvoidamethod() 10. 11. 12. 13. System.out.println(Base.amethod(); 14. 15. 16. 17. Base() 18. 19. 20. 21. amethod(); 22. 23. 24. 25. 26. 27. publicclassDerivedextendsBase 28. 29. 30. 31. inti=-1; 32. 33. 34. 35. publicstaticvoidmain(Stringargv) 36. 37. 38. 39. Baseb=newDerived(); 40. 41. System.out.println(b.i); 42. 43. b.amethod(); 44. 45. 46. 47. publicvoidamethod() 48. 49. 50. 51. System.out.println(Derived.amethod(); 52. 53. 54. 55. 56. 57. 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 argv) Base b = new Derived(); System.out.println(b.i); b.amethod(); public void amethod() System.out.println(Derived.amethod(); Choices:A.Derived.amethod() -1 Derived.amethod() B.Derived.amethod() 99 C.Compile time error D.Derived.amethod() 10: 1. publicclassOuterClass 2. privatedoubled1=1.0; 3. /insertcodehere 4. 5. Youneedtoinsertaninnerclassdeclarationatline3.Whichtwoinnerclassdeclarationsare 6. valid?public class OuterClass private double d1 = 1.0;/insert code hereYou need to insert an inner class declaration at line 3. Which two inner class declarations arevalid?A.class InnerOne public static double methoda() return d1; B.public class InnerOne static double methoda() return d1; C.private class InnerOne double methoda() return d1; D.static class InnerOne protected double methoda() return d1; 11: 1. Whatwillhappenwhenyouattempttocompileandrunthefollowingcode? 2. 3. publicclassStatic 4. 5. 6. 7. static8. 9. 10. 11. intx=5; 12. 13. 14. 15. staticintx,y; 16. 17. publicstaticvoidmain(Stringargs) 18. 19. 20. 21. x-; 22. 23. myMethod(); 24. 25. System.out.println(x+y+x); 26. 27. 28. 29. publicstaticvoidmyMethod() 30. 31. 32. 33. y=x+x; 34. 35. 36. 37. 38. 39. 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: 1. Givethecodefragment: 2. if(x4) 3. System.out.println(“Test1”); 4. elseif(x9) 5. System.out.println(“Test2”); 6. else 7. System.out.println(“Test3”); 8. Whichrangeofvaluexwouldproduceofoutput“Test2”?Give the code fragment:if(x4)System.out.println(“Test 1”);else if (x9)System.out.println(“Test 2”);else System.out.println(“Test 3”);Which range of value x would produce of output “Test 2”? A.x4 C.x9 D.None 13: 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 14:关于垃圾收集的哪些叙述是对的。 A.程序开发者必须自己创建一个线程进行内存释放的工作。 B.垃圾收集将检查并释放不再使用的内存。 C.垃圾收集允许程序开发者明确指定并立即释放该内存。 D.垃圾收集能够在期望的时间释放被java对象使用的内存。 15:Math.round(-11.5)等於多少? A.-11 B.-12 C.-11.5 D.none 16: 1. Whatresultsfromattemptingtocompileandrunthefollowingcode? 2. 3. publicclassTernary 4. 5. 6. 7. publicstaticvoidm
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 织布机操作工质量追溯知识考核试卷及答案
- 印染洗涤工岗位操作规程考核试卷及答案
- 电池部件制备工理念考核试卷及答案
- 冷冻食品制作工三级安全教育(班组级)考核试卷及答案
- 2024新版2025秋青岛版科学五四制三年级上册教学课件:第四单元 第15课 温度计的秘密
- 2025人民出版社供小学用中华民族大家庭教学课件:第9课 绚丽多姿的民俗风情 含微课视频
- 医院环境卫生学监测考试题及答案解析
- 银行征信知识试题及答案
- 银行行政测试题及答案
- 建筑工程专业试题及答案
- 2.2.1 季风气候显著 课件 人教版地理八年级上册
- 中学2025年“迎国庆、庆中秋”主题班会
- 垃圾的危害教学课件
- 寻找闪闪发光的自己(主题班会)课件
- 中国燃气工程管理办法
- 卷烟送货员安全培训课件
- 2025年电子乐器行业研究报告及未来行业发展趋势预测
- 2025至2030年中国招投标行业发展潜力分析及投资战略咨询报告
- 2025至2030中国矿山机械行业发展趋势分析与未来投资战略咨询研究报告
- 2025年法学硕士专业知识考试试卷及答案解析
- GB 26488-2025镁合金压铸安全生产规范
评论
0/150
提交评论