Jul 2016 updated: Exambible SUN 310-065 answers 161-170

310-065 Royal Pack Testengine pdf

100% Actual & Verified — 100% PASS

Unlimited access to the world's largest Dumps library!

https://www.2passeasy.com/dumps/310-065/

Proper study guides for Refresh SUN Sun Certified Programmer for the Java 2 Platform.SE 6.0 certified begins with SUN 310-065 preparation products which designed to deliver the Certified 310-065 questions by making you pass the 310-065 test at your first time. Try the free 310-065 demo right now.

2016 Jul 310-065 free practice questions

Q161. Given: 

11. public class Commander { 

12. public static void main(String[] args) { 

13. String myProp = /* insert code here */ 

14. System.out.println(myProp); 

15. } 

16. } 

and the command line: 

java -Dprop.custom=gobstopper Commander Which two, placed on line 13, will produce the output gobstopper? (Choose two.) 

A. System.load("prop.custom"); 

B. System.getenv("prop.custom"); 

C. System.property("prop.custom"); 

D. System.getProperty("prop.custom"); 

E. System.getProperties().getProperty("prop.custom"); 

Answer: DE 


Q162. Given: 

12. import java.util.*; 

13. public class Explorer1 { 

14. public static void main(String[] args) { 

15. TreeSet<Integer> s = new TreeSet<Integer>(); 

16. TreeSet<Integer> subs = new TreeSet<Integer>(); 

17. for(int i = 606; i < 613; i++) 

18. if(i%2 == 0) s.add(i); 

19. subs = (TreeSet)s.subSet(608, true, 611, true); 

20. s.add(609); 

21. System.out.println(s + " " + subs); 

22. } 

23. } 

What is the result? 

A. Compilation fails. 

B. An exception is thrown at runtime. 

C. [608, 609, 610, 612] [608, 610] 

D. [608, 609, 610, 612] [608, 609, 610] 

E. [606, 608, 609, 610, 612] [608, 610] 

F. [606, 608, 609, 610, 612] [608, 609, 610] 

Answer: F 


Q163. Given: 

1. interface TestA { String toString(); } 

2. public class Test { 

3. public static void main(String[] args) { 

4. System.out.println(new TestA() { 

5. public String toString() { return "test"; } 

6. }); 

7. } 

8. } 

What is the result? 

A. test 

B. null 

C. An exception is thrown at runtime. 

D. Compilation fails because of an error in line 1. 

E. Compilation fails because of an error in line 4. 

F. Compilation fails because of an error in line 5. 

Answer: A 


Q164. Given: 

11. String test = "a1b2c3"; 

12. String[] tokens = test.split("\\d"); 

13. for(String s: tokens) System.out.print(s + " "); 

What is the result? 

A. a b c 

B. 1 2 3 

C. a1b2c3 

D. a1 b2 c3 

E. Compilation fails. 

F. The code runs with no output. 

G. An exception is thrown at runtime. 

Answer: A 


Q165. A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add(0, object), but does NOT need to support quick random access. What supports these requirements? 

A. java.util.Queue 

B. java.util.ArrayList 

C. java.util.LinearList 

D. java.util.LinkedList 

Answer: D 


2passeasy.com

Most recent 310-065 free practice test:

Q166. Given: 

1. public class Mule { 

2. public static void main(String[] args) { 

3. boolean assert = true; 

4. if(assert) { 

5. System.out.println("assert is true"); 

6. } 

7. } 

8. } 

Which command-line invocations will compile? 

A. javac Mule.java 

B. javac -source 1.3 Mule.java 

C. javac -source 1.4 Mule.java 

D. javac -source 1.5 Mule.java 

Answer: B 


Q167. Given: 

11. public class Rainbow { 

12. public enum MyColor { 

13. RED(0xff0000), GREEN(0x00ff00), BLUE(0x0000ff); 

14. private final int rgb; 

15. MyColor(int rgb) { this.rgb = rgb; } 

16. public int getRGB() { return rgb; } 

17. }; 

18. public static void main(String[] args) { 

19. // insert code here 

20. } 

21. } 

Which code fragment, inserted at line 19, allows the Rainbow class to compile? 

A. MyColor skyColor = BLUE; 

B. MyColor treeColor = MyColor.GREEN; 

C. if(RED.getRGB() < BLUE.getRGB()) { } 

D. Compilation fails due to other error(s) in the code. 

E. MyColor purple = new MyColor(0xff00ff); 

F. MyColor purple = MyColor.BLUE + MyColor.RED; 

Answer: B 


Q168. Given: 

11. public static void test(String str) { 

12. int check = 4; 

13. if (check = str.length()) { 

14. System.out.print(str.charAt(check -= 1) +", "); 

15. } else { 

16. System.out.print(str.charAt(0) + ", "); 

17. } 

18. } and the invocation: 

21. test("four"); 

22. test("tee"); 

23. test("to"); What is the result? 

A. r, t, t, 

B. r, e, o, 

C. Compilation fails. 

D. An exception is thrown at runtime. 

Answer: C 


Q169. Given: 

10. interface Jumper { public void jump(); } ... 

20. class Animal {} ... 

30. class Dog extends Animal { 

31. Tail tail; 32. } ... 

40. class Beagle extends Dog implements Jumper{ 

41. public void jump() {} 

42. } ... 

50. class Cat implements Jumper{ 

51. public void jump() {} 

52. } 

Which three are true? (Choose three.) 

A. Cat is-a Animal 

B. Cat is-a Jumper 

C. Dog is-a Animal 

D. Dog is-a Jumper 

E. Cat has-a Animal 

F. Beagle has-a Tail 

G. Beagle has-a Jumper 

Answer: BCF 


Q170. Given a correctly compiled class whose source code is: 

1. package com.sun.sjcp; 

2. public class Commander { 

3. public static void main(String[] args) { 

4. // more code here 

5. } 

6. } 

Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains "." (current directory). Which command line correctly runs Commander? 

A. java Commander 

B. java com.sun.sjcp.Commander 

C. java com/sun/sjcp/Commander 

D. java -cp com.sun.sjcp Commander 

E. java -cp com/sun/sjcp Commander 

Answer: B 



see more Sun Certified Programmer for the Java 2 Platform.SE 6.0