[Free] 2018(Jan) EnsurePass Testinsides Oracle 1z0-853 Dumps with VCE and PDF 231-240

By | January 25, 2018

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: 231 – (Topic 3)

Given:

  1. public class Person {

  2. private String name;

  3. public Person(String name) { this.name = name; }

  4. public boolean equals(Person p) {

  5. return p.name.equals(this.name); 6. }

    7. }

    Which statement is true?

    1. Compilation fails because the private attribute p.name cannot be accessed in line 5.

    2. The equals method does NOT properly override the Object.equals method.

    3. To work correctly with hash-based data structures, this class must also implement the hashCode method.

    4. When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.

Answer: B

Question No: 232 – (Topic 3)

Given:

d is a valid, non-null Date object

df is a valid, non-null DateFormat object set to the current locale

What outputs the current locale#39;s country name and the appropriate version of d#39;s date?

  1. Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()

    quot; quot; df.format(d));

  2. Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()

    quot; quot; df.setDateFormat(d));

  3. Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()

    quot; quot; df.setDateFormat(d));

  4. Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()

    quot; quot; df.format(d));

    Answer: D

    Question No: 233 – (Topic 3)

    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. Synchronizing the run() method would make the class thread-safe.

    3. An exception is thrown at runtime.

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

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

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

Answer: F

Question No: 234 – (Topic 3)

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.)

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

    /foo/myLib.jar/Paper Book.java.

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

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

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

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

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

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

/foo/myLib.jar Book.java

Answer: D,E,F

Question No: 235 – (Topic 3)

Given:

  1. class ClassA {}

  2. class ClassB extends ClassA {}

  3. class ClassC extends ClassA {} and:

  1. ClassA p0 = new ClassA();

  2. ClassB p1 = new ClassB();

  3. ClassC p2 = new ClassC();

  4. ClassA p3 = new ClassB();

  5. ClassA p4 = new ClassC();

Which three are valid? (Choose three.)

  1. p0 = p1;

  2. p1 = (ClassB)p3;

  3. p2 = (ClassC)p1;

  4. p2 = (ClassC)p4;

  5. p2 = p4;

  6. p1 = p2;

Answer: A,B,D

Question No: 236 – (Topic 3)

Which Man class properly represents the relationship quot;Man has a best friend who is a Dogquot;?

  1. class Man extends Dog { }

  2. class Man { private Doglt;bestFriendgt;; }

  3. class Man implements Dog { }

  4. class Man { private Dog bestFriend; }

  5. class Man { private BestFriendlt;doggt;; }

  6. class Man { private BestFriend dog; }

Answer: D

Question No: 237 DRAG DROP – (Topic 3)

Click the Task button.

Ensurepass 2018 PDF and VCE

Answer:

Ensurepass 2018 PDF and VCE

Question No: 238 – (Topic 3)

Assuming that the serializeBanana() and the deserializeBanana() methods will correctly use Java serialization and given:

  1. import java.io.*;

  2. class Food implements Serializable {int good = 3;}

  3. class Fruit extends Food {int juice = 5;}

  4. public class Banana extends Fruit {

  5. int yellow = 4;

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

  7. Banana b = new Banana(); Banana b2 = new Banana();

  8. b.serializeBanana(b); // assume correct serialization

  9. b2 = b.deserializeBanana(); // assume correct

  10. System.out.println(quot;restore quot; b2.yellow b2.juice b2.good);

24. }

25. // more Banana methods go here 50. } What is the result?

  1. restore 403

  2. An exception is thrown at runtime.

  3. Compilation fails.

  4. restore 453

  5. restore 400

    Answer: D

    Question No: 239 – (Topic 3)

    Given:

    1. import java.util.*;

    2. public class PQ {

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

    4. PriorityQueuelt;Stringgt; pq = new PriorityQueuelt;Stringgt;();

    5. pq.add(quot;carrotquot;);

    6. pq.add(quot;applequot;);

    7. pq.add(quot;bananaquot;);

    8. System.out.println(pq.poll() quot;:quot; pq.peek()); 9. }

      10. }

      What is the result?

      1. banana:apple

      2. carrot:apple

      3. apple:banana

      4. carrot:banana

      5. apple:apple

      6. carrot:carrot

        Answer: C

        Question No: 240 – (Topic 3)

        Given:

        1. public class A {

        2. public void doit() { 3. }

  1. public String doit() {

  2. return quot;aquot;; 6. }

  1. public double doit(int x) {

  2. return 1.0; 9. }

    10. }

    What is the result?

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

    2. An exception is thrown at runtime.

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

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

      Answer: 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

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