SCJP八套真题解析版(达内)

上传人:cl****1 文档编号:431181107 上传时间:2024-01-26 格式:DOC 页数:119 大小:871.75KB
返回 下载 相关 举报
SCJP八套真题解析版(达内)_第1页
第1页 / 共119页
SCJP八套真题解析版(达内)_第2页
第2页 / 共119页
SCJP八套真题解析版(达内)_第3页
第3页 / 共119页
SCJP八套真题解析版(达内)_第4页
第4页 / 共119页
SCJP八套真题解析版(达内)_第5页
第5页 / 共119页
点击查看更多>>
资源描述

《SCJP八套真题解析版(达内)》由会员分享,可在线阅读,更多相关《SCJP八套真题解析版(达内)(119页珍藏版)》请在金锄头文库上搜索。

1、声明此电子书是对SCJP考试题库选择题部分的解析,目的是方便同学们理解考题当中所涉及的知识点,对于此书未经允许不得以任何方式传播,本书最终解释权归西安达内项目部。此次编撰工作由王志刚老师策划,Module 1- Module 3由马成龙老师编撰,Module 4- Module 5由王志刚老师编撰,Module 6- Module 8由孟凡新老师编撰,由于时间仓促编写当中存在的纰漏还请同学们谅解,如有疑问可致函王志刚老师。同时感谢尚敏老师的大力支持,以及对这次编撰工作提出宝贵意见及支持的各位老师!最后,祝各位同学以高分通过SCJP考试!Module 1-JAVA 基础一、选择题:Module1

2、:Question 1Given:35. String #name = “Jane Doe”;36. int $age=24;37. Double _height = 123.5;38. double temp = 37.5;Which two are true? (Choose two.)A. Line 35 will not compile.B. Line 36 will not compile.C. Line 37 will not compile. D. Line 38 will not compile.Answer: ADQuestion 2Click the Exhibit but

3、ton.1. public class Test 2. int x= 12;3. public void method(int x) 4. x+=x;5. System.out.println(x);6. 7. Given:34. Test t = new Test();35. t.method(5);What is the output from line 5 of the Test class?A. 5B. 10C. 12D. 17E. 24Answer: B 局部变量覆盖全局变量Question 3Given:11. public class Test 12. public static

4、 void main(String args) 13. int x =5;14. boolean b1 = true;15. boolean b2 = false;16.17.if(x=4) & !b2) 18. System.out.print(”l “); if结束19. System.out.print(”2 “);20. if (b2 = true) & b1) 赋值21. System.out.print(”3 “);22. Copyright Tarena Corporation,2008.All rights reserved23. What is the result?A. 2

5、B. 3C. 1 2D. 2 3E. 1 2 3F. Compilation fails.G. Au exceptional is thrown at runtime.Answer: DQuestion 4Given:42. public class ClassA 43. public int getValue() 44.int value=0;45. boolean setting = true;46. String title=”Hello”;47. if (value | (setting & title = “Hello”) return 1; 48. if (value = 1 &

6、title.equals(”Hello”) return 2; 49. 50. And:70. ClassA a = new ClassA();71. a.getValue();What is the result?A. 1B. 2C. Compilation fails.D. The code runs with no output.E. An exception is thrown at runtime.Answer: C 不能为数字0,1,只能是表达式Question 5Given:11. public void testIfA() 12. if(testIfB(”True”) 13.

7、System.out.println(”True”);14. else 15. System.out.println(”Not true”);16. 17. 18. public Boolean testIfB(String str) 19. return Boolean.valueOf(str);20. What is the result when method testIfA is invoked?(调用一次)A. TrueB. Not trueCopyright Tarena Corporation,2008.All rights reservedC. An exception is

8、thrown at runtime.D. Compilation fails because of an error at line 12.E. Compilation fails because of an error at line 19.Answer: A Returns a Boolean with a value represented by the specified string. The Boolean returned represents a true value if the string argument is not null and is equal, ignori

9、ng case, to the string true. Question 6Given:11. public static void main(String args) 12. Integer i = new Integer(1) + new Integer(2);13. switch(i) 14. case 3: System.out.println(”three”); break;15. default: System.out.println(”other”); break;16. 17. What is the result?A. threeB. otherC. An exceptio

10、n is thrown at runtime.D. Compilation fails because of an error on line 12.E. Compilation fails because of an error on line 13.F. Compilation fails because of an error on line 15.Answer: AQuestion 7Given:11. public static void main(String args) 12. String str = “null;13. if (str = null) 14. System.o

11、ut.println(”null”);15. else (str.length() = 0) 16. System.out.println(”zero”);17. else 18. System.out.println(”some”);19. 20. What is the result?A. nullB. zeroC. someD. Compilation fails.E. An exception is thrown at runtime.Answer: D 条件语句中,else至多有一个,并且没有()Question 8Given:10.int x=0;11.int y 10;12. d

12、o l3. y-;14. +x;Copyright Tarena Corporation,2008.All rights reserved15. while (x 5);16. System.out.print(x + “,“ + y);What is the result?A. 5,6B. 5,5C. 6,5D. 6,6Answer: BQuestion 9Given:25.int x=12;26. while (x 10) 27. x-;28. 29. System.out.print(x);What is the result?A. 0B. 10C. 12D. Line 29 will

13、never be reached.Answer: C Question 10Given:35. int x= 10;36. do 37. x-;38. while(x 10);How many times will line 37 be executed?A. ten timesB. zero timesC. one to me timesD. more than ten timesAnswer: D 一直减下去,直到int的最小值-2147483648再减1 ,变为正数,循环结束Question 11Given:11. public static void main(String args)

14、 12. for (int i=0;i6) break;14. 15. System.out.println(i);16. What is the result?A. 6B. 7C. 10D. 11Copyright Tarena Corporation,2008.All rights reservedE. Compilation fails.F. An exception is thrown at runtime.Answer: E (变量的作用范围)for里面的变量为局部变量,在外部不能使用Question 12Given:55. int x= 1, 2,3,4, 5;56.int y =x;57. System.out.println(y2);Which is true?A. Line 57 will print the value 2.B. Line 57 will print the value 3.C. Compilation will fail because of an error in line 55.D. Compilati

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 营销创新

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号