[Free] 2018(Jan) EnsurePass Testking Oracle 1z0-853 Dumps with VCE and PDF 191-200

Ensurepass.com : Ensure you pass the IT Exams
2018 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: 191 – (Topic 2)

Given:

  1. public class MyLogger {

  2. private StringBuilder logger = new StringBuuilder();

  3. public void log(String message, String user) {

  4. logger.append(message);

  5. logger.append(user); 6. }

    7. }

    The programmer must guarantee that a single MyLogger object works properly for a multi- threaded system.

    How must this code be changed to be thread-safe?

    1. replace StringBuilder with StringBuffer

    2. synchronize the log method

    3. No change is necessary, the current MyLogger code is already thread-safe.

    4. replace StringBuilder with just a String object and use the string concatenation ( =) within the log method

Answer: B

Question No: 192 DRAG DROP – (Topic 2)

Click the Task button.

Ensurepass 2018 PDF and VCE

Answer:

Ensurepass 2018 PDF and VCE

Question No: 193 – (Topic 2)

Given:

35. int x = 10; 36. do { 37. x-;

38. } while (x lt; 10);

How many times will line 37 be executed?

  1. more than ten times

  2. ten times

  3. zero times

  4. one to nine times

Answer: A

Question No: 194 – (Topic 2)

Given:

  1. public abstract class Shape {

  2. private int x;

  3. private int y;

  4. public abstract void draw();

  5. public void setAnchor(int x, int y) {

  6. this.x = x;

  7. this.y = y;

18. }

19. }

Which two classes use the Shape class correctly? (Choose two.)

  1. public abstract class Circle implements Shape { private int radius;

    public void draw();

    }

  2. public abstract class Circle implements Shape { private int radius;

    public void draw() { /* code here */ }

  3. public class Circle extends Shape { private int radius;

    public void draw() {/* code here */}

  4. public class Circle implements Shape { private int radius;

    }

  5. public abstract class Circle extends Shape { private int radius;

    }

  6. public class Circle extends Shape { private int radius;

public void draw();

}

Answer: C,E

Question No: 195 – (Topic 2)

Given:

public class NamedCounter { private final String name; private int count;

public NamedCounter(String name) { this.name = name; } public String getName() { return name; }

public void increment() { count ; } public int getCount() { return count; } public void reset() { count = 0; }

}

Which three changes should be made to adapt this class to be used safely by multiple

threads? (Choose three.)

  1. declare reset() using the synchronized keyword

  2. declare the constructor using the synchronized keyword

  3. declare getName() using the synchronized keyword

  4. declare getCount() using the synchronized keyword

  5. declare increment() using the synchronized keyword

Answer: A,D,E

Question No: 196 – (Topic 2)

Given:

  1. // insert code here

  2. private N min, max;

  3. public N getMin() { return min; }

  4. public N getMax() { return max; }

  5. public void add(N added) {

  6. if (min == null || added.doubleValue() lt; min.doubleValue()) 17. min = added;

18. if (max == null || added.doubleValue() gt; max.doubleValue()) 19. max = added;

20. }

21. }

Which two, inserted at line 11, will allow the code to compile? (Choose two.)

  1. public class MinMaxlt;N extends Numbergt; {

  2. public class MinMaxlt;?gt; {

  3. public class MinMaxlt;N extends Objectgt; {

  4. public class MinMaxlt;? extends Objectgt; {

  5. public class MinMaxlt;? extends Numbergt; {

  6. public class MinMaxlt;N extends Integergt; {

Answer: A,F

Question No: 197 – (Topic 2)

Given:

  1. static void test() {

  2. try {

  3. String x = null;

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

15. }

16. finally { System.out.print(quot;finally quot;); }

17. }

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

  2. try { test(); }

  3. catch (Exception ex) { System.out.print(quot;exception quot;); }

21. }

What is the result?

  1. finally exception

  2. Compilation fails.

  3. null finally

  4. finally

  5. null

Answer: A

Question No: 198 – (Topic 2)

When comparing java.io.BufferedWriter to java.io.FileWriter, which capability exists as a method in only one of the two?

  1. writing to the stream

  2. closing the stream

  3. flushing the stream

  4. marking a location in the stream

  5. writing a line separator to the stream

    Answer: E

    Question No: 199 – (Topic 2)

    Given:

    1. public class Threads2 implements Runnable { 2.

  1. public void run() {

  2. System.out.println(quot;run.quot;);

  3. throw new RuntimeException(quot;Problemquot;); 6. }

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

  2. Thread t = new Thread(new Threads2());

  3. t.start();

  4. System.out.println(quot;End of method.quot;);

11. }

12. }

Which two can be results? (Choose two.)

  1. run.

    java.lang.RuntimeException: Problem

  2. run.

    java.lang.RuntimeException: Problem End of method.

  3. End of method. java.lang.RuntimeException: Problem

  4. End of method.

    run.

    java.lang.RuntimeException: Problem

  5. java.lang.RuntimeException: Problem

Answer: B,D

Question No: 200 – (Topic 2)

Which three statements concerning the use of the java.io.Serializable interface are true? (Choose three.)

  1. The values in fields with the transient modifier will NOT survive serialization and deserialization.

  2. It is legal to serialize an object of a type that has a supertype that does NOT implement java.io.Serializable.

  3. The values in fields with the volatile modifier will NOT survive serialization and deserialization.

  4. Objects from classes that use aggregation cannot be serialized.

  5. An object serialized on one JVM can be successfully deserialized on a different JVM.

    Answer: A,B,E

    Topic 3, Volume C

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

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.