Exam Code: 1Z0-852 (Practice Exam Latest Test Questions VCE PDF)
Exam Name: Java Standard Edition 6 Programmer Certified Professional Upgrade Exam
Certification Provider: Oracle
Free Today! Guaranteed Training- Pass 1Z0-852 Exam.

2016 Nov 1Z0-852 exam cost

Q41. Click the Exhibit button. Which statement is true about the set variable on line 12? 

A. The set variable contains all six elements from the coll collection, and the order is guaranteed to be preserved. 

B. The set variable contains only three elements from the coll collection, and the order is guaranteed to be preserved. 

C. The set variable contains all six elements from the coll collection, but the order is NOT guaranteed to be preserved. 

D. The set variable contains only three elements from the coll collection, but the order is NOTguaranteed to be preserved. 

Answer:

Explanation: 


Q42. Given: 

5.

 class Thingy { Meter m = new Meter(); } 

6.

 class Component { void go() { System.out.print("c"); } } 

7.

 class Meter extends Component { void go() { System.out.print("m"); } } 

8. 

9.

 class DeluxeThingy extends Thingy { 

10.

 public static void main(String[] args) { 

11.

 DeluxeThingy dt = new DeluxeThingy(); 

12.

 dt.m.go(); 

13.

 Thingy t = new DeluxeThingy(); 

14.

 t.m.go(); 

15.

 } 

16.

 } 

Which two are true? (Choose two.) 

A. The output is mm. 

B. The output is mc. 

C. Component is-a Meter. 

D. Component has-a Meter. 

E. DeluxeThingy is-a Component. 

F. DeluxeThingy has-a Component. 

Answer: A,F 

Explanation: 


Q43. Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true? (Choose two.) 

A. The class implements java.lang.Comparable. 

B. The class implements java.util.Comparator. 

C. The interface used to implement sorting allows this class to define only one sort sequence. 

D. The interface used to implement sorting allows this class to define many different sort sequences. 

Answer: A,C 

Explanation: 


Q44. Given: 

1.

 package test; 

2. 

3.

 class Target { 

4.

 public String name = "hello"; 

5.

 } 

What can directly access and change the value of the variable name? 

A. any class 

B. only the Target class 

C. any class in the test package 

D. any class that extends Target 

Answer:

Explanation: 


Q45. RAG DROP 

Click the Task button. 

Answer: 


Down to date 1Z0-852 exam question:

Q46. Which two code fragments are most likely to cause a StackOverflowError? (Choose two.) 

A. int []x = {1,2,3,4,5}; 

for(int y = 0; y < 6; y++) 

System.out.println(x[y]); 

B. static int[] x = {7,6,5,4}; 

static { x[1] = 8; 

x[4] = 3; } 

C. for(int y = 10; y < 10; y++) 

doStuff(y); 

D. void doOne(int x) { doTwo(x); } 

void doTwo(int y) { doThree(y); } 

void doThree(int z) { doTwo(z); } 

E. for(int x = 0; x < 1000000000; x++) 

doStuff(x); 

F. void counter(int i) { counter(++i); } 

Answer: D,F 

Explanation: 


Q47. Given that: 

Gadget has-a Sprocket and 

Gadget has-a Spring and 

Gadget is-a Widget and 

Widget has-a Sprocket 

Which two code fragments represent these relationships? (Choose two.) 

A. class Widget { Sprocket s; } 

class Gadget extends Widget { Spring s; } 

B. class Widget { } 

class Gadget extends Widget { Spring s1; Sprocket s2; } 

C. class Widget { Sprocket s1; Spring s2; } 

class Gadget extends Widget { } 

D. class Gadget { Spring s; } 

class Widget extends Gadget{ Sprocket s; } 

E. class Gadget { } 

class Widget extends Gadget{ Sprocket s1; Spring s2; } 

F. class Gadget { Spring s1; Sprocket s2; } 

class Widget extends Gadget{ } 

Answer: A,C 

Explanation: 


Q48. 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:

Explanation: 


Q49. Given: 

3.

 import java.util.*; 

4.

 public class G1 { 

5.

 public void takeList(List<? extends String> list) { 

6.

 // insert code here 

7.

 } 

8.

 } 

Which three code fragments, inserted independently at line 6, will compile? (Choose three.) 

A. list.add("foo"); 

B. Object o = list; 

C. String s = list.get(0); 

D. list = new ArrayList<String>(); 

E. list = new ArrayList<Object>(); 

Answer: B,C,D 

Explanation: 


Q50. Given: 

11.

 class X { public void foo() { System.out.print("X "); } } 

12. 

13.

 public class SubB extends X { 

14.

 public void foo() throws RuntimeException { 

15.

 super.foo(); 

16.

 if (true) throw new RuntimeException(); 

17.

 System.out.print("B "); 

18.

 } 

19.

 public static void main(String[] args) { 

20.

 new SubB().foo(); 

21.

 } 

22.

 } 

What is the result? 

A. X, followed by an Exception. 

B. No output, and an Exception is thrown. 

C. Compilation fails due to an error on line 14. 

D. Compilation fails due to an error on line 16. 

E. Compilation fails due to an error on line 17. 

F. X, followed by an Exception, followed by B. 

Answer:

Explanation: