Examcollection offers free demo for 1Z0-852 exam. "Java Standard Edition 6 Programmer Certified Professional Upgrade Exam", also known as 1Z0-852 exam, is a Oracle Certification. This set of posts, Passing the Oracle 1Z0-852 exam, will help you answer those questions. The 1Z0-852 Questions & Answers covers all the knowledge points of the real exam. 100% real Oracle 1Z0-852 exams and revised by experts!


♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1Z0-852 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1Z0-852 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1Z0-852-exam-dumps.html

Q31. Given: 

11.

 public interface A { public void m1(); } 

12. 

13.

 class B implements A { } 

14.

 class C implements A { public void m1() { } } 

15.

 class D implements A { public void m1(int x) { } } 

16.

 abstract class E implements A { } 

17.

 abstract class F implements A { public void m1() { } } 

18.

 abstract class G implements A { public void m1(int x) { } } 

What is the result? 

A. Compilation succeeds. 

B. Exactly one class does NOT compile. 

C. Exactly two classes do NOT compile. 

D. Exactly four classes do NOT compile. 

E. Exactly three classes do NOT compile. 

Answer:

Explanation: 


Q32. Given: 

1.

 public class Donkey { 

2.

 public static void main(String[] args) { 

3.

 boolean assertsOn = false; 

4.

 assert (assertsOn) : assertsOn = true; 

5.

 if(assertsOn) { 

6.

 System.out.println("assert is on"); 

7.

 } 

8.

 } 

9.

 } 

If class Donkey is invoked twice, the first time without assertions enabled, and the second time with assertions enabled, what are the results? 

A. no output 

B. no output 

assert is on 

C. assert is on 

D. no output 

An AssertionError is thrown. 

E. assert is on 

An AssertionError is thrown. 

Answer:

Explanation: 


Q33. Given: 

5.

 import java.util.*; 

6.

 public class SortOf { 

7.

 public static void main(String[] args) { 

8.

 ArrayList<Integer> a = new ArrayList<Integer>(); 

9.

 a.add(1); a.add(5); a.add(3); 

11.

 Collections.sort(a); 

12.

 a.add(2); 

13.

 Collections.reverse(a); 

14.

 System.out.println(a); 

15.

 } 

16.

 } 

What is the result? 

A. [1, 2, 3, 5] 

B. [2, 1, 3, 5] 

C. [2, 5, 3, 1] 

D. [5, 3, 2, 1] 

E. [1, 3, 5, 2] 

F. Compilation fails. 

G. An exception is thrown at runtime. 

Answer:

Explanation: 


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


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


Q36. Given: 

11.

 class PingPong2 { 

12.

 synchronized void hit(long n) { 

13.

 for(int i = 1; i < 3; i++) 

14.

 System.out.print(n + "-" + i + " "); 

15.

 } 

16.

 } 

17.

 public class Tester implements Runnable { 

18.

 static PingPong2 pp2 = new PingPong2(); 

19.

 public static void main(String[] args) { 

20.

 new Thread(new Tester()).start(); 

21.

 new Thread(new Tester()).start(); 

22.

 } 

23.

 public void run() { pp2.hit(Thread.currentThread().getId()); } 

24.

 } 

Which statement is true? 

A. The output could be 5-1 6-1 6-2 5-2 

B. The output could be 6-1 6-2 5-1 5-2 

C. The output could be 6-1 5-2 6-2 5-1 

D. The output could be 6-1 6-2 5-1 7-1 

Answer:

Explanation: 


Q37. Given: 

11.

 abstract class Vehicle { public int speed() { return 0; } 

12.

 class Car extends Vehicle { public int speed() { return 60; } 

13.

 class RaceCar extends Car { public int speed() { return 150; } ... 

21.

 RaceCar racer = new RaceCar(); 

22.

 Car car = new RaceCar(); 

23.

 Vehicle vehicle = new RaceCar(); 

24.

 System.out.println(racer.speed() + ", " + car.speed() 

25.

 + ", " + vehicle.speed()); 

What is the result? 

A. 0, 0, 0 

B. 150, 60, 0 

C. Compilation fails. 

D. 150, 150, 150 

E. An exception is thrown at runtime. 

Answer:

Explanation: 


Q38. Given that t1 is a reference to a live thread, which is true? 

A. The Thread.sleep() method can take t1 as an argument. 

B. The Object.notify() method can take t1 as an argument. 

C. The Thread.yield() method can take t1 as an argument. 

D. The Thread.setPriority() method can take t1 as an argument. 

E. The Object.notify() method arbitrarily chooses which thread to notify. 

Answer:

Explanation: 


Q39. Given: 

5.

 class A { 

6.

 void foo() throws Exception { throw new Exception(); } 

7.

 } 

8.

 class SubB2 extends A { 

9.

 void foo() { System.out.println("B "); } 

10.

 } 

11.

 class Tester { 

12.

 public static void main(String[] args) { 

13.

 A a = new SubB2(); 

14.

 a.foo(); 

15.

 } 

16.

 } 

What is the result? 

A. B 

B. B, followed by an Exception. 

C. Compilation fails due to an error on line 9. D. Compilation fails due to an error on line 14. E. An Exception is thrown with no other output. 

Answer:

Explanation: 


Q40. Given: 

10.

 abstract class A { 

11.

 abstract void a1(); 

12.

 void a2() { } 

13.

 } 

14.

 class B extends A { 

15.

 void a1() { } 

16.

 void a2() { } 

17.

 } 

18.

 class C extends B { void c1() { } } 

and: 

A x = new B(); C y = new C(); A z = new C(); 

What are four valid examples of polymorphic method calls? (Choose four.) 

A. x.a2(); 

B. z.a2(); 

C. z.c1(); 

D. z.a1(); 

E. y.c1(); 

F. x.a1(); 

Answer: A,B,D,F 

Explanation: