SCJP考题

上传人:xy****7 文档编号:45537514 上传时间:2018-06-17 格式:DOC 页数:81 大小:617KB
返回 下载 相关 举报
SCJP考题_第1页
第1页 / 共81页
SCJP考题_第2页
第2页 / 共81页
SCJP考题_第3页
第3页 / 共81页
SCJP考题_第4页
第4页 / 共81页
SCJP考题_第5页
第5页 / 共81页
点击查看更多>>
资源描述

《SCJP考题》由会员分享,可在线阅读,更多相关《SCJP考题(81页珍藏版)》请在金锄头文库上搜索。

1、SCJP 6.0 認證教戰手冊 黃彬華著 碁峰 出版 1 書名:SCJP 6.0 認證教戰手冊 作者:黃 彬華 完全擬真試題 1-100(共 244 題) 第 1 題 Given: 35. String #name = “Jane Doe“; 36. int $age = 24; 37. Double _height = 123.5; 38. double temp = 37.5; Which two statements are true? (Choose two.) A. Line 35 will not compile. B. Line 36 will not compile. C. L

2、ine 37 will not compile. D. Line 38 will not compile. 答案:AD 考:2-4 Java 程式內容簡介 第 2 題 Given: 1. public class TestString1 2. public static void main(String args) 3. String str = “420“; 4. str += 42; 5. System.out.print(str); 6. 7. What is the output? A. 42 B. 420 C. 462 D. 42042 E. Compilation fails. F

3、. An exception is thrown at runtime. 答案:D 考:3-3 文字接符號 第 3 題 Given: 1. public class Test 2. public static void main(String args) 3. int x = 5; SCJP 6.0 認證教戰手冊 黃彬華著 碁峰出版 2 4. boolean b1 = true; 5. boolean b2 = false; 6. 7. if(x=4) 9. System.out.print(“2 “); 10. if(b2=true) 12. 13. What is the result?

4、A. 2 B. 3 C. 1 2 D. 2 3 E. 1 2 3 F. Compilation fails. G. An exception is thrown at runtime. 答案:D 考:4-1 條件控制 第 4 題 Given: 22. public void go() 23. String o = “; 24. z: 25. for(int x=0; xdistance) (story*2)=tail) 7. System.out.print(“1“); 8. if(distance+1 != tail) (story*2)=distance) 9. System.out.pr

5、int(“2“); 10. 11. What is the result? A. 1 B. 2 C. 12 D. Compilation fails. E. No output is produced. F. An exception is thrown at runtime. 答案:E 考:4-1 條件控制 SCJP 6.0 認證教戰手 冊 黃彬華著 碁峰出版 5第 9 題 Given: 11. String elements = “for“, “tea“, “too“; 12. String first = (elements.length0) ? elements0 : null; Wh

6、at is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The variable first is set to null. D. The variable first is set to elements0. 答案:D 考:4-1 條件控制、5-2 1 維陣介紹 第 10 題 Given: 1. import java.util.*; 2. public class Quest 3. public static void main(String args) 4. String color

7、s = 5. “blue“,“red“,“green“,“yellow“,“orange“; 6. Arrays.sort(colors); 7. int s2 = Arrays.binarySearch(colors, “orange“); 8. int s3 = Arrays.binarySearch(colors, “violet“); 9. System.out.print(s2 + “ + s3); 10. 11. What is the result? A. 2-1 B. 2-4 C. 2-5 D. 3-1 E. 3-4 F. 3-5 G. Compilation fails. H

8、. An exception is thrown at runtime. 答案:C 考:5-4 1 維陣的排序與搜尋 第 11 題 Given: 1. class Alligator 2. public static void main(String args) 3. intx = 1,2,3,4,5,6,7,8,9; SCJP 6.0 認證教戰手冊 黃彬華著 碁峰 出版 6 4. inty = x; 5. System.out.print(y21); 6. 7. What is the result? A. 2 B. 3 C. 4 D. 6 E. 7 F. Compilation fails

9、. 答案:E 考:5-6 2 維陣的宣告與存取 第 12 題 Drag and Drop(拖曳題) Add methods to the Beta class to make it compile correctly. class Alpha public void bar(int. x) public void bar(int x) public class Beta extends Alpha Place here Place here Place here 答案: class Alpha public void bar(int. x) public void bar(int x) pub

10、lic class Beta extends Alpha public void bar(int x) public int bar(String x)return 1; public void bar(int x, int y) 考:6-5 繼承 第 13 題 Given: 1. public class Barn 2. public static void main(String args) private void bar(int x) public void bar(int x) public int bar(String x)return 1; public Alpha bar(in

11、t x) public void bar(int x, int y) public int bar(int x)return x; Methods SCJP 6.0 認證教戰手冊 黃彬華 著 碁峰出版 7 3. new Barn.go(“hi“, 1); 4. new Barn.go(“hi“, “world“, 2); 5. 6. public void go(String. y, int x) 7. System.out.print(yy.length-1 + “ “); 8. 9. What is the result? A. hi hi B. hi world C. world wor

12、ld D. Compilation fails. E. An exception is thrown at runtime. 答案:D 考:6-2 Java 方法 第 14 題 Given: 11. class Person 12. String name = “No name“; 13. public Person(String nm)name = nm; 14. 15. 16. class Employee extends Person 17. String empID = “0000“; 18. public Employee(String id)empID = id; 19. 20.

13、21. class EmployeeTest 22. public static void main(String args) 23. Employee e = new Employee(“4321“); 24. System.out.println(e.empID); 25. 26. What is the result? A. 4321 B. 0000 C. An exception is thrown at runtime. D. Compilation fails because of an error in line 18. 答案:D 考:6-5 繼承 第 15 題 Given: 1

14、1. class Mud SCJP 6.0 認證教戰手冊 黃彬華著 碁峰出版 8 12. /insert code here 13. System.out.println(“hi“); 14. 15. And the following five fragments: public static void main(String.a) public static void main(String.* a) public static void main(String. a) public static void main(String. a) public static void main(String. a) How many of the code fragments, inserted independently at line 12, compile? A. 0 B. 1 C. 2 D. 3 E. 4 F. 5 答案:D 考:6-2 Java 方法 第 16 題 Giv

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

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