[Free] 2018(Jan) EnsurePass Testking Oracle 1z0-854 Dumps with VCE and PDF 21-30

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

Java Standard Edition 5 Programmer Certified Professional Upgrade Exam

Question No: 21

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 35 throws an exception.

  2. The instance gets garbage collected.

  3. The code on line 31 throws an exception.

  4. The code on line 33 executes successfully.

  5. The code on line 33 throws an exception.

Answer: A,D,E

Question No: 22

Given:

  1. public class ClassA {

  2. public void count(int i) {

  3. count( i);

13. }

14. } And:

  1. ClassA a = new ClassA();

  2. a.count(3);

Which exception or error should be thrown by the virtual machine?

  1. StackOverflowError

  2. NullPointerException

  3. ExceptionInInitializerError

  4. IllegalArgumentException

  5. NumberFormatException

    Answer: A

    Question No: 23

    Given:

    1. public class Threads4 {

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

    3. new Threads4().go(); 4. }

  1. public void go() {

  2. Runnable r = new Runnable() {

  3. public void run() {

  4. System.out.print(quot;fooquot;); 9. }

10. };

  1. Thread t = new Thread(r);

  2. t.start();

  3. t.start();

14. }

15. }

What is the result?

  1. The code executes normally and prints quot;fooquot;.

  2. An exception is thrown at runtime.

  3. The code executes normally, but nothing is printed.

  4. Compilation fails.

Answer: B

Question No: 24

Given:

  1. class Animal { public String noise() { return quot;peepquot;; } }

  2. class Dog extends Animal {

  3. public String noise() { return quot;barkquot;; }

14. }

  1. class Cat extends Animal {

  2. public String noise() { return quot;meowquot;; }

17. }

  1. Animal animal = new Dog();

  2. Cat cat = (Cat)animal;

  3. System.out.println(cat.noise()); What is the result?

  1. Compilation fails.

  2. meow

  3. bark

  4. An exception is thrown at runtime.

  5. peep

Answer: D

Question No: 25

Which two statements are true? (Choose two.)

  1. An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.

  2. An encapsulated, public class promotes re-use.

  3. An encapsulated class allows a programmer to change an implementation without affecting outside code.

  4. Classes that share the same interface are always tightly encapsulated.

    Answer: B,C

    Question No: 26

    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. No change is necessary, the current MyLogger code is already thread-safe.

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

      4. synchronize the log method

        Answer: D

        Question No: 27

        Given:

        1. class ClassA {

        2. public int numberOfInstances;

        3. protected ClassA(int numberOfInstances) {

        4. this.numberOfInstances = numberOfInstances; 5. }

6. }

  1. public class ExtendedA extends ClassA {

  2. private ExtendedA(int numberOfInstances) {

  3. super(numberOfInstances);

10. }

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

  2. ExtendedA ext = new ExtendedA(420);

  3. System.out.print(ext.numberOfInstances);

14. }

15. }

Which statement is true?

  1. Constructors CANNOT use the private modifier.

  2. All constructors must be declared public.

  3. An exception is thrown at runtime.

  4. Constructors CANNOT use the protected modifier.

  5. 420 is the output.

Answer: E

Question No: 28 DRAG DROP

Click the Task button.

Ensurepass 2018 PDF and VCE

Answer:

Ensurepass 2018 PDF and VCE

Question No: 29

Given:

  1. static class A {

  2. void process() throws Exception { throw new Exception(); }

13. }

  1. static class B extends A {

  2. void process() { System.out.println(quot;Bquot;); }

16. }

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

  2. new B().process();

19. }

What is the result?

  1. B

  2. The code runs with no output.

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

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

  5. Compilation fails because of an error in line 18.

Answer: A

Question No: 30 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-854 Demo PDF
100% Ensurepass Free Guaranteed!
1z0-854 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.