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

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

Given:

  1. interface A { void x(); }

  2. class B implements A { public void x() {} public void y() {} }

  3. class C extends B { public void x() {} } And:

  1. java.util.Listlt;Agt; list = new java.util.ArrayListlt;Agt;();

  2. list.add(new B());

  3. list.add(new C());

  4. for (A a : list) { 24. a.x();

25. a.y();

26. }

What is the result?

  1. The code runs with no output.

  2. An exception is thrown at runtime.

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

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

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

  6. Compilation fails because of an error in line 25.

Answer: F

Question No: 72 – (Topic 1)

Given:

11. class Mammal { } 12.

  1. class Raccoon extends Mammal {

  2. Mammal m = new Mammal();

15. } 16.

17. class BabyRaccoon extends Mammal { } Which four statements are true? (Choose four.)

  1. Raccoon is-a Mammal.

  2. Raccoon has-a Mammal.

  3. BabyRaccoon is-a Mammal.

  4. BabyRaccoon is-a Raccoon.

  5. BabyRaccoon has-a Mammal.

  6. BabyRaccoon is-a BabyRaccoon.

Answer: A,B,C,F

Question No: 73 – (Topic 1)

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

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

    Given:

    1. public class Target {

    2. private int i = 0;

    3. public int addOne(){

    4. return i; 5. }

6. } And:

  1. public class Client {

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

  3. System.out.println(new Target().addOne()); 4. }

    5. }

    Which change can you make to Target without affecting Client?

    1. Line 4 of class Target can be changed to return i ;

    2. Line 2 of class Target can be changed to private int i = 1;

    3. Line 3 of class Target can be changed to private int addOne(){

    4. Line 2 of class Target can be changed to private Integer i = 0;

      Answer: D

      Question No: 76 – (Topic 1)

      Given:

      1. public class Blip {

      2. protected int blipvert(int x) { return 0; } 3. }

  1. class Vert extends Blip {

  2. // insert code here 6. }

    Which five methods, inserted independently at line 5, will compile? (Choose five.)

    1. public int blipvert(int x) { return 0; }

    2. private int blipvert(int x) { return 0; }

    3. private int blipvert(long x) { return 0; }

    4. protected long blipvert(int x) { return 0; }

    5. protected int blipvert(long x) { return 0; }

    6. protected long blipvert(long x) { return 0; }

    7. protected long blipvert(int x, int y) { return 0; }

      Answer: A,C,E,F,G

      Question No: 77 – (Topic 1)

      Given:

      1. class Pizza {

      2. java.util.ArrayList toppings;

      3. public final void addTopping(String topping) {

      4. toppings.add(topping); 5. }

6. }

  1. public class PepperoniPizza extends Pizza {

  2. public void addTopping(String topping) {

  3. System.out.println(quot;Cannot add Toppingsquot;);

10. }

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

  2. Pizza pizza = new PepperoniPizza();

  3. pizza.addTopping(quot;Mushroomsquot;);

14. }

15. }

What is the result?

Ensurepass 2017 PDF and VCE

  1. Compilation fails.

  2. Cannot add Toppings

  3. The code runs with no output.

  4. A NullPointerException is thrown in Line 4.

Answer: A

Question No: 78 – (Topic 1)

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 = p2;

  3. p2 = p4;

  4. p2 = (ClassC)p1;

  5. p1 = (ClassB)p3;

  6. p2 = (ClassC)p4;

    Answer: A,E,F

    Question No: 79 – (Topic 1)

    Given two files, GrizzlyBear.java and Salmon.java:

    1. package animals.mammals; 2.

  1. public class GrizzlyBear extends Bear {

  2. void hunt() {

  3. Salmon s = findSalmon();

  4. s.consume(); 7. }

8. }

1. package animals.fish; 2.

  1. public class Salmon extends Fish {

  2. public void consume() { /* do stuff */ } 5. }

    If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?

    1. add import animals.mammals.*; at line 2 in Salmon.java

    2. add import animals.fish.*; at line 2 in GrizzlyBear.java

    3. add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java

    4. add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java

      Answer: B

      Question No: 80 – (Topic 1)

      Given:

      1. package com.company.application; 2.

  1. public class MainClass {

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

    And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to quot;.quot; (current directory). Which two java commands entered at the command line will run MainClass? (Choose two.)

    1. java MainClass if run from the /apps directory

    2. java com.company.application.MainClass if run from the /apps directory

    3. java -classpath /apps com.company.application.MainClass if run from any directory

    4. java -classpath . MainClass if run from the /apps/com/company/application directory

    5. java -classpath /apps/com/company/application:. MainClass if run from the /apps directory

    6. java com.company.application.MainClass if run from the /apps/com/company/application directory

Answer: B,C

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.