《太阳证明了Java2平台的1.4Ver程序员》由会员分享,可在线阅读,更多相关《太阳证明了Java2平台的1.4Ver程序员(116页珍藏版)》请在金锄头文库上搜索。
1、Exam: 310-035 Title : Sun Certified Programmer for Java 2 Platform 1.4 Ver : 04.21.04 Note: Section A contains 147 questions. Section B contains 147 questions. The total number of questions is 294. 编号:时间:2021年x月x日书山有路勤为径,学海无涯苦作舟页码:第1页 共1页Section A QUESTION 1 Given: 1 public class Test 2 public stati
2、c void main(String args) 3 class Foo 4 public int i = 3; 5 6 Object o = (Object)new Foo(); 7 Foo foo = (Foo)o; 8 System.out.println(i = + foo.i); 9 10 What is the result? A. i = 3 B. Compilation fails. C. A ClassCastException is thrown at line 6. D. A ClassCastException is thrown at line 7. Answer:
3、A QUESTION 2 Which two cause a compiler error? (Choose two) A. float = new float(3); B. float f2 = new float; C. float f1 = new float3; D. float f3 = new float3; E. float f5 = 1.0f, 2.0f, 2.0f ; F. float f4 = new float 1.0f. 2.0f. 3.0f; Answer: A, B The F. statement is incorrect. The float numbers s
4、hould be separated with commas and not dots. QUESTION 3 Given: 1 int i =1,j =10; 2 do 3 if(i+ -j) 4 continue; 5 6 while (i j) 4 break; 5 6 j-; 7 while (+i 5); 8 System.out.println(i = +i+ and j = +j); What is the result? A. i = 6 and j = 5 B. i = 5 and j = 5 C. i = 6 and j = 4 D. i = 5 and j = 6 E.
5、i = 6 and j = 6 Answer: D QUESTION 9 Which statement is true? A. Assertions can be enabled or disabled on a class-by-class basis. B. Conditional compilation is used to allow tested classes to run at full speed. C. Assertions are appropriate for checking the validity of arguments in a method. D. The
6、programmer can choose to execute a return statement or to throw an exception if an assertion fails. Answer: A QUESTION 10 You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective? A. public B. private C. pr
7、otected D. transient E. default access Answer: E QUESTION 11 Given: 1 int x = 3; 2 int y = 1; 3 if (x = y) 4 System.out.println(x = + x); 5 What is the result? A. x = 1 B. x = 3 C. Compilation fails. D. The code runs with no output. E. An exception is thrown at runtime. Answer: C QUESTION 12 Given: 1 public class Test 2 public static void aMethod() throws Exception 3 try 4 throw new Exception(); 5 finally 6 System.out.println(finally); 7 8 9 public static void main(String args) 10 try 11 aMethod(); 12 catch