[Free] 2018(Jan) EnsurePass Dumpsleader Oracle 1z0-852 Dumps with VCE and PDF 31-40

Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-852
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-852.html

Java Standard Edition 6 Programmer Certified Professional Upgrade Exam

Question No: 31

Given:

  1. public class Breaker2 {

  2. static String o = quot;quot;;

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

  4. z:

5. for(int x = 2; x lt; 7; x ) {

  1. if(x==3) continue;

  2. if(x==5) break z;

  3. o = o x;

9. }

10. System.out.println(o);

11. }

12. }

What is the result?

  1. 2

  2. 24 C. 234 D. 246 E. 2346

F. Compilation fails.

Answer: B

Question No: 32

Given:

  1. try {

  2. // some code here

  3. } catch (NullPointerException e1) {

  4. System.out.print(quot;aquot;);

  5. } catch (Exception e2) {

  6. System.out.print(quot;bquot;);

  7. } finally {

  8. System.out.print(quot;cquot;);

41. }

If some sort of exception is thrown at line 34, which output is possible?

  1. a

  2. b

  3. c

  4. ac

  5. abc

Answer: D

Question No: 33

Given:

  1. public void go(int x) {

  2. assert (x gt; 0);

  3. switch(x) {

  4. case 2: ;

  5. default: assert false;

16. }

17. }

18. private void go2(int x) { assert (x lt; 0); } Which statement is true?

  1. All of the assert statements are used appropriately.

  2. Only the assert statement on line 12 is used appropriately.

  3. Only the assert statement on line 15 is used appropriately.

  4. Only the assert statement on line 18 is used appropriately.

  5. Only the assert statements on lines 12 and 15 are used appropriately.

  6. Only the assert statements on lines 12 and 18 are used appropriately.

  7. Only the assert statements on lines 15 and 18 are used appropriately.

Answer: G

Question No: 34

Given:

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

  2. String str = quot;nullquot;;

  3. if (str == null) {

  4. System.out.println(quot;nullquot;);

  5. } else (str.length() == 0) {

  6. System.out.println(quot;zeroquot;);

  7. } else {

  8. System.out.println(quot;somequot;);

19. }

20. }

What is the result?

  1. null

  2. zero

  3. some

  4. Compilation fails.

  5. An exception is thrown at runtime.

Answer: D

Question No: 35

Given:

11. class X { public void foo() { System.out.print(quot;X quot;); } } 12.

  1. public class SubB extends X {

  2. public void foo() throws RuntimeException {

  3. super.foo();

  4. if (true) throw new RuntimeException();

  5. System.out.print(quot;B quot;);

18. }

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

  2. new SubB().foo();

21. }

22. }

What is the result?

  1. X, followed by an Exception.

  2. No output, and an Exception is thrown.

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

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

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

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

Answer: A

Question No: 36

Given:

  1. public class Breaker {

  2. static String o = quot;quot;;

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

  4. z:

7. o = o 2;

8. for(int x = 3; x lt; 8; x ) {

  1. if(x==4) break;

  2. if(x==6) break z;

  3. o = o x;

12. }

13. System.out.println(o);

14. }

15. }

What is the result?

A. 23 B. 234 C. 235 D. 2345 E. 2357

F. 23457

G. Compilation fails.

Answer: G

Question No: 37

Which three will compile and run without exception? (Choose three.)

  1. private synchronized Object o;

  2. void go() {

    synchronized() { /* code here */ }

    }

  3. public synchronized void go() { /* code here */ }

  4. private synchronized(this) void go() { /* code here */ }

  5. void go() {

    synchronized(Object.class) { /* code here */ }

    }

  6. void go() {

Object o = new Object(); synchronized(o) { /* code here */ }

}

Answer: C,E,F

Question No: 38

Given:

  1. public class PingPong implements Runnable {

  2. synchronized void hit(long n) {

13. for(int i = 1; i lt; 3; i )

14. System.out.print(n quot;-quot; i quot; quot;);

15. }

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

  2. new Thread(new PingPong()).start();

  3. new Thread(new PingPong()).start();

19. }

  1. public void run() {

  2. hit(Thread.currentThread().getId());

22. }

23. }

Which two statements are true? (Choose two.)

  1. The output could be 8-1 7-2 8-2 7-1

  2. The output could be 7-1 7-2 8-1 6-1

  3. The output could be 8-1 7-1 7-2 8-2

  4. The output could be 8-1 8-2 7-1 7-2

    Answer: C,D

    Question No: 39

    Given:

    1. public class TestOne implements Runnable {

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

    3. Thread t = new Thread(new TestOne());

    4. t.start();

    5. System.out.print(quot;Startedquot;);

    6. t.join();

    7. System.out.print(quot;Completequot;); 8. }

9. public void run() {

10. for (int i = 0; i lt; 4; i ) {

11. System.out.print(i);

12. }

13. }

14. }

What can be a result?

  1. Compilation fails.

  2. An exception is thrown at runtime.

  3. The code executes and prints quot;StartedCompletequot;.

  4. The code executes and prints quot;StartedComplete0123quot;.

  5. The code executes and prints quot;Started0123Completequot;.

Answer: E

Question No: 40 DRAG DROP

Click the Task button.

Ensurepass 2018 PDF and VCE

Answer:

Ensurepass 2018 PDF and VCE

100% Ensurepass Free Download!
Download Free Demo:1z0-852 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-852 Dumps

EnsurePass ExamCollection Testking
Lowest Price Guarantee Yes No No
Up-to-Dated Yes No No
Real Questions Yes No No
Explanation Yes No No
PDF VCE Yes No No
Free VCE Simulator Yes No No
Instant Download Yes No No

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.