[Free] 2017(Jan) EnsurePass Testinsides Oracle 1z0-851 Dumps with VCE and PDF Download 121-130

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

Java Standard Edition 6 Programmer Certified Professional Exam

Question No: 121 – (Topic 2)

A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company#39;s old printers, but the new wireless printers as well. When the programmer starts looking into the application, the programmer discovers that because of the design of the application, it is necessary to make changes to each report to support the new printers. Which two design concepts most likely explain this situation? (Choose two.)

  1. Inheritance

  2. Low cohesion

  3. Tight coupling

  4. High cohesion

  5. Loose coupling

  6. Object immutability

Answer: B,C

Question No: 122 – (Topic 2)

Given:

  1. public class Hi {

  2. void m1() { }

  3. protected void() m2 { } 5. }

  1. class Lois extends Hi {

  2. // insert code here 8. }

    Which four code fragments, inserted independently at line 7, will compile? (Choose four.)

    1. public void m1() { }

    2. protected void m1() { }

    3. private void m1() { }

    4. void m2() { }

    5. public void m2() { }

    6. protected void m2() { }

    7. private void m2() { }

Answer: A,B,E,F

Question No: 123 – (Topic 2)

Given:

10: public class Hello { 11: String title;

12: int value;

13: public Hello() { 14: title = quot; Worldquot;; 15: }

16: public Hello(int value) { 17: this.value = value;

18: title = quot;Helloquot;; 19: Hello();

20: }

21: }

and:

30: Hello c = new Hello(5); 31: System.out.println(c.title); What is the result?

  1. Hello

  2. Hello World

  3. Compilation fails.

  4. Hello World 5

  5. The code runs with no output.

  6. An exception is thrown at runtime.

Answer: C

Question No: 124 – (Topic 2)

Given:

  1. class Employee {

  2. String name; double baseSalary;

  3. Employee(String name, double baseSalary) {

  4. this.name = name;

  5. this.baseSalary = baseSalary; 8. }

9. }

  1. public class SalesPerson extends Employee {

  2. double commission;

  3. public SalesPerson(String name, double baseSalary, double commission) {

  4. // insert code here

14. }

15. }

Which two code fragments, inserted independently at line 13, will compile? (Choose two.)

  1. super(name, baseSalary);

  2. this.commission = commission;

  3. super();

    this.commission = commission;

  4. this.commission = commission; super();

  5. super(name, baseSalary); this.commission = commission;

  6. this.commission = commission;

    super(name, baseSalary);

  7. super(name, baseSalary, commission);

Answer: A,E

Question No: 125 – (Topic 2)

A team of programmers is reviewing a proposed API for a new utility class. After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality. If they implement the new design, which two OO principles will they be promoting?

  1. Looser coupling

  2. Tighter coupling

  3. Lower cohesion

  4. Higher cohesion

  5. Weaker encapsulation

  6. Stronger encapsulation

    Answer: A

    Question No: 126 – (Topic 2)

    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. 420 is the output.

  2. An exception is thrown at runtime.

  3. All constructors must be declared public.

  4. Constructors CANNOT use the private modifier.

  5. Constructors CANNOT use the protected modifier.

Answer: A

Question No: 127 – (Topic 2)

Given:

  1. class Building { }

  2. public class Barn extends Building {

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

  4. Building build1 = new Building();

  5. Barn barn1 = new Barn();

  6. Barn barn2 = (Barn) build1;

  7. Object obj1 = (Object) build1;

  8. String str1 = (String) build1;

  9. Building build2 = (Building) barn1;

14. }

15. }

Which is true?

  1. If line 10 is removed, the compilation succeeds.

  2. If line 11 is removed, the compilation succeeds.

  3. If line 12 is removed, the compilation succeeds.

  4. If line 13 is removed, the compilation succeeds.

  5. More than one line must be removed for compilation to succeed.

    Answer: C

    Question No: 128 – (Topic 2)

    Given:

    1. public class TestOne {

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

    3. Thread.sleep(3000);

    4. System.out.println(quot;sleepquot;); 5. }

      6. }

      What is the result?

      1. Compilation fails.

      2. An exception is thrown at runtime.

      3. The code executes normally and prints quot;sleepquot;.

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

        Answer: C

        Question No: 129 – (Topic 2)

        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. Compilation fails.

  2. An exception is thrown at runtime.

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

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

Answer: B

Question No: 130 – (Topic 2)

Which two statements are true? (Choose two.)

  1. It is possible for more than two threads to deadlock at once.

  2. The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.

  3. Deadlocked threads release once their sleep() method#39;s sleep duration has expired.

  4. Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.

  5. It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.

  6. If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().

    Answer: A,F

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

Add a Comment

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.