Want to know Actualtests 1Z0-852 Exam practice test features? Want to lear more about Oracle Java Standard Edition 6 Programmer Certified Professional Upgrade Exam certification experience? Study Top Quality Oracle 1Z0-852 answers to Renewal 1Z0-852 questions at Actualtests. Gat a success with an absolute guarantee to pass Oracle 1Z0-852 (Java Standard Edition 6 Programmer Certified Professional Upgrade Exam) test on your first attempt.

2021 Sep 1Z0-852 actual test

Q1. Given: 

1.

 public class Donkey2 { 

2.

 public static void main(String[] args) { 

3.

 boolean assertsOn = true; 

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 timewith 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: C 

Explanation: 


Q2. RAG DROP 

Click the Task button. 

Answer: 

94. Given: 

1.

 public class Target { 

2.

 private int i = 0; 

3.

 public int addOne(){ 

4.

 return ++i; 

5.

 } 

6.

 } 

And: 

1.

 public class Client { 

2.

 public static void main(String[] args){ 

3.

 System.out.println(new Target().addOne()); 

4.

 } 

5.

 } 

Which change can you make to Target without affecting Client? 

A. Line 4 of class Target can be changed to return i++; 

B. Line 2 of class Target can be changed to private int i = 1; 

C. Line 3 of class Target can be changed to private int addOne(){ 

D. Line 2 of class Target can be changed to private Integer i = 0; 

Answer: D 

Explanation: 


Q3. A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class? (Choose three.) 

A. The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar. 

B. The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar.. 

C. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.class. 

D. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar. 

E. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp /foo/myLib.jar/Paper Book.java. 

F. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d /foo/myLib.jar Book.java 

G. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -classpath /foo/myLib.jar Book.java 

Answer: B,D,G 

Explanation: 


Q4. 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: B 

Explanation: 


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


1Z0-852  exam cram

Far out 1Z0-852 exam question:

Q6. 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: D,E 

Explanation: 


Q7. Given the following six method names: 

addListener 

addMouseListener 

setMouseListener 

deleteMouseListener 

removeMouseListener 

registerMouseListener How many of these method names follow JavaBean Listener naming rules? 

A. 1 

B. 2 

C. 3 

D. 4 

E. 5 

Answer: B 

Explanation: 


Q8. Given: 

21.

 abstract class C1 { 

22.

 public C1() { System.out.print(1); } 

23.

 } 

24.

 class C2 extends C1 { 

25.

 public C2() { System.out.print(2); } 

26.

 } 

27.

 class C3 extends C2 { 

28.

 public C3() { System.out.println(3); } 

29.

 } 

30.

 public class Ctest { 

31.

 public static void main(String[] a) { new C3(); } 

32.

 } 

What is the result? 

A. 3 

B. 23 

C. 32 

D. 123 

E. 321 

F. Compilation fails. 

G. An exception is thrown at runtime. 

Answer: D 

Explanation: 

15. Given: 

1.

 public class A { 

2.

 public void doit() { 

3.

 } 

4.

 public String doit() { 

5.

 return "a"; 

6.

 } 

7.

 public double doit(int x) { 

8.

 return 1.0; 

9.

 } 

10.

 } 

What is the result? 

A. An exception is thrown at runtime. 

B. Compilation fails because of an error in line 7. 

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

D. Compilation succeeds and no runtime errors with class A occur. 

Answer: C 

Explanation: 


Q9. Given that the elements of a PriorityQueue are ordered according to natural ordering, and: 

2.

 import java.util.*; 

3.

 public class GetInLine { 

4.

 public static void main(String[] args) { 

5.

 PriorityQueue<String> pq = new PriorityQueue<String>(); 

6.

 pq.add("banana"); 

7.

 pq.add("pear"); 

8.

 pq.add("apple"); 

9.

 System.out.println(pq.poll() + " " + pq.peek()); 

10.

 } 

11.

 } 

What is the result? 

A. apple pear 

B. banana pear 

C. apple apple 

D. apple banana 

E. banana banana 

Answer: D 

Explanation: 


Q10. Given: 

11.

 public static void main(String[] args) { 

12.

 Integer i = new Integer(1) + new Integer(2); 

13.

 switch(i) { 

14.

 case 3: System.out.println("three"); break; 

15.

 default: System.out.println("other"); break; 

16.

 } 

17.

 } 

What is the result? 

A. three 

B. other 

C. An exception is thrown at runtime. 

D. Compilation fails because of an error on line 12. 

E. Compilation fails because of an error on line 13. 

F. Compilation fails because of an error on line 15. 

Answer: A 

Explanation: