[Free] 2017(Jan) EnsurePass Braindumps Oracle 1z0-851 Dumps with VCE and PDF 31-40

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: 31 – (Topic 1)

Given:

  1. interface A { public void aMethod(); }

  2. interface B { public void bMethod(); }

  3. interface C extends A,B { public void cMethod(); }

  4. class D implements B {

  5. public void bMethod(){} 6. }

  1. class E extends D implements C {

  2. public void aMethod(){}

  3. public void bMethod(){}

  4. public void cMethod(){}

11. }

What is the result?

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

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

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

  4. If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.

  5. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.

  6. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.

Answer: F

Question No: 32 – (Topic 1)

Given that: Gadget has-a Sprocket and Gadget has-a Spring and Gadget is-a Widget and Widget has-a Sprocket Which two code fragments represent these relationships? (Choose two.)

  1. class Widget { Sprocket s; }

    class Gadget extends Widget { Spring s; }

  2. class Widget { }

    class Gadget extends Widget { Spring s1; Sprocket s2; }

  3. class Widget { Sprocket s1; Spring s2; } class Gadget extends Widget { }

  4. class Gadget { Spring s; }

    class Widget extends Gadget{ Sprocket s; }

  5. class Gadget { }

    class Widget extends Gadget{ Sprocket s1; Spring s2; }

  6. class Gadget { Spring s1; Sprocket s2; } class Widget extends Gadget{ }

Answer: A,C

Question No: 33 – (Topic 1)

A company that makes Computer Assisted Design (CAD) software has, within its application, some utility classes that are used to perform 3D rendering tasks. The company#39;s chief scientist has just improved the performance of one of the utility classes#39; key rendering algorithms, and has assigned a programmer to replace the old algorithm with the new algorithm. When the programmer begins researching the utility classes, she is happy to discover that the algorithm to be replaced exists in only one class. The programmer reviews that class#39;s API, and replaces the old algorithm with the new algorithm, being careful that her changes adhere strictly to the class#39;s API. Once testing has begun, the programmer discovers that other classes that use the class she changed are no longer working properly. What design flaw is most likely the cause of these new bugs?

  1. Inheritance

  2. Tight coupling

  3. Low cohesion

  4. High cohesion

  5. Loose coupling

  6. Object immutability

Answer: B

Question No: 34 – (Topic 1)

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 implements Dog { }

  3. class Man { private BestFriend dog; }

  4. class Man { private Dog bestFriend; }

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

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

Answer: D

Question No: 35 – (Topic 1)

Given:

  1. class Foo {

  2. public int a = 3;

  3. public void addFive() { a = 5; System.out.print(quot;f quot;); }

34. }

  1. class Bar extends Foo {

  2. public int a = 8;

  3. public void addFive() { this.a = 5; System.out.print(quot;b quot; ); }

  4. } Invoked with: Foo f = new Bar(); f.addFive(); System.out.println(f.a); What is the result?

  1. b 3

  2. b 8

  3. b 13

  4. f 3

  5. f 8

  6. f 13

  7. Compilation fails.

  8. An exception is thrown at runtime.

Answer: A

Question No: 36 – (Topic 1)

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

  2. bark

  3. meow

  4. Compilation fails.

  5. An exception is thrown at runtime.

    Answer: E

    Question No: 37 – (Topic 1)

    Given:

    1. class Super {

    2. private int a;

    3. protected Super(int a) { this.a = a; } 4. } …

  1. class Sub extends Super {

  2. public Sub(int a) { super(a); }

  3. public Sub() { this.a = 5; }

14. }

Which two, independently, will allow Sub to compile? (Choose two.)

  1. Change line 2 to: public int a;

  2. Change line 2 to: protected int a;

  3. Change line 13 to: public Sub() { this(5); }

  4. Change line 13 to: public Sub() { super(5); }

  5. Change line 13 to: public Sub() { super(a); }

    Answer: C,D

    Question No: 38 – (Topic 1)

    Given:

    1. public class Base {

    2. public static final String FOO = quot;fooquot;;

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

    4. Base b = new Base();

    5. Sub s = new Sub();

    6. System.out.print(Base.FOO);

    7. System.out.print(Sub.FOO);

    8. System.out.print(b.FOO);

    9. System.out.print(s.FOO);

    10. System.out.print(((Base)s).FOO);

11. } }

12. class Sub extends Base {public static final String FOO=quot;barquot;;} What is the result?

  1. foofoofoofoofoo

  2. foobarfoobarbar

  3. foobarfoofoofoo

  4. foobarfoobarfoo

  5. barbarbarbarbar

  6. foofoofoobarbar

  7. foofoofoobarfoo

    Answer: D

    Question No: 39 – (Topic 1)

    Given:

    1. package geometry;

    2. public class Hypotenuse {

    3. public InnerTriangle it = new InnerTriangle();

    4. class InnerTriangle {

    5. public int base;

    6. public int height; 7. }

      8. }

      Which statement is true about the class of an object that can reference the variable base?

      1. It can be any class.

      2. No class has access to base.

      3. The class must belong to the geometry package.

      4. The class must be a subclass of the class Hypotenuse.

Answer: C

Question No: 40 – (Topic 1)

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

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

Leave a Reply

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