[Free] 2017(Jan) EnsurePass Braindumps Oracle 1z0-853 Dumps with VCE and PDF 71-80

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

Java Standard Edition 5 Programmer Certified Professional Exam

Question No: 71 – (Topic 1)

Given:

  1. public class TestSeven extends Thread {

  2. private static int x;

  3. public synchronized void doThings() {

  4. int current = x;

  5. current ;

  6. x = current; 7. }

  1. public void run() {

  2. doThings();

    10. } 11.}

    Which statement is true?

    1. Compilation fails.

    2. Declaring the doThings() method as static would make the class thread-safe.

    3. Synchronizing the run() method would make the class thread-safe.

    4. Wrapping the statements within doThings() in a synchronized(new Object()) { } block would make the class thread-safe.

    5. An exception is thrown at runtime.

    6. The data in variable quot;xquot; are protected from concurrent access problems.

      Answer: B

      Question No: 72 DRAG DROP – (Topic 1)

      Click the Task button.

      Ensurepass 2017 PDF and VCE

      Answer:

      Ensurepass 2017 PDF and VCE

      Question No: 73 – (Topic 1)

      Given:

      1. public class TestFive {

      2. private int x;

      3. public void foo() {

      4. int current = x;

      5. x = current 1; 6. }

7. public void go() {

8. for(int i = 0; i lt; 5; i ) {

  1. new Thread() {

  2. public void run() {

  3. foo();

  4. System.out.print(x quot;, quot;);

13. } }.start(); 14. } }

Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ? (Choose two.)

  1. change the variable declaration on line 2 to private volatile int x;

  2. wrap the code inside the foo() method with a synchronized( this ) block

  3. change line 7 to public synchronized void go() {

  4. wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }

  5. move the line 12 print statement into the foo() method

Answer: B,E

Question No: 74 – (Topic 1)

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. An exception is thrown at runtime.

  2. null

  3. Compilation fails.

  4. zero

  5. some

Answer: C

Question No: 75 – (Topic 1)

Given:

  1. public void genNumbers() {

  2. ArrayList numbers = new ArrayList(); 13. for (int i=0; ilt;10; i ) {

  1. int value = i * ((int) Math.random());

  2. Integer intObj = new Integer(value);

  3. numbers.add(intObj);

17. }

18. System.out.println(numbers);

19. }

Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?

  1. Line 19

  2. Line 16

  3. Line 17

  4. The object is NOT a candidate for garbage collection.

  5. Line 18

Answer: A

Question No: 76 – (Topic 1)

Given:

  1. // some code here

  2. try {

  3. // some code here

  4. } catch (SomeException se) {

  5. // some code here

  6. } finally {

  7. // some code here

38. }

Under which three circumstances will the code on line 37 be executed? (Choose three.)

  1. The code on line 31 throws an exception.

  2. The code on line 35 throws an exception.

  3. The code on line 33 executes successfully.

  4. The code on line 33 throws an exception.

  5. The instance gets garbage collected.

Answer: B,C,D

Question No: 77 – (Topic 1)

Given:

  1. class Cup { }

  2. class PoisonCup extends Cup { }

  1. public void takeCup(Cup c) {

  2. if (c instanceof PoisonCup) {

  3. System.out.println(quot;Inconceivable!quot;);

  4. } else if (c instanceof Cup) {

  5. System.out.println(quot;Dizzying intellect!quot;);

  6. } else {

  7. System.exit(0);

28. }

29. }

And the execution of the statements:

Cup cup = new PoisonCup(); takeCup(cup);

What is the output?

  1. An exception is thrown at runtime.

  2. Compilation fails because of an error in line 22.

  3. Dizzying intellect!

  4. Inconceivable!

  5. The code runs with no output.

Answer: D

Question No: 78 – (Topic 1)

Given:

  1. public class Bar {

  2. static void foo( int… x ) {

  3. // insert code here

13. }

14. }

Which two code fragments, inserted independently at line 12, will allow the class to

compile? (Choose two.)

  1. for( int i=0; ilt; x.length; i ) System.out.println(x[i]);

  2. for( int z : x ) System.out.println(z);

  3. foreach( x ) System.out.println(z);

  4. while( x.hasNext() ) System.out.println( x.next() );

Answer: A,B

Question No: 79 DRAG DROP – (Topic 1)

Click the Task button.

Ensurepass 2017 PDF and VCE

Answer:

Ensurepass 2017 PDF and VCE

Question No: 80 – (Topic 1)

Given:

  1. public static Collection get() {

  2. Collection sorted = new LinkedList();

  3. sorted.add(quot;Bquot;); sorted.add(quot;Cquot;); sorted.add(quot;Aquot;);

  4. return sorted;

15. }

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

  2. for (Object obj: get()) {

  3. System.out.print(obj quot;, quot;);

19. }

20. }

What is the result?

  1. Compilation fails.

  2. B, C, A,

  3. The code runs with no output.

  4. A, B, C,

  5. An exception is thrown at runtime.

Answer: B

100% Ensurepass Free Download!
Download Free Demo:1z0-853 Demo PDF
100% Ensurepass Free Guaranteed!
Download 2017 EnsurePass 1z0-853 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

2017 EnsurePass IT Certification PDF and VCE

Leave a Reply

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