[Free] 2018(Jan) EnsurePass Dumpsleader Oracle 1z0-851 Dumps with VCE and PDF 151-160

Ensurepass.com : Ensure you pass the IT Exams
2018 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: 151 – (Topic 2)

Given:

  1. static void test() throws RuntimeException {

  2. try {

  3. System.out.print(quot;test quot;);

  4. throw new RuntimeException();

15. }

16. catch (Exception ex) { System.out.print(quot;exception quot;); }

17. }

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

  2. try { test(); }

  3. catch (RuntimeException ex) { System.out.print(quot;runtime quot;); }

  4. System.out.print(quot;end quot;);

22. }

What is the result?

  1. test end

  2. Compilation fails.

  3. test runtime end

  4. test exception end

  5. A Throwable is thrown by main at runtime.

    Answer: D

    Question No: 152 – (Topic 2)

    Given:

    1. public class Plant {

    2. private String name;

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

    4. public String getName() { return name; } 5. }

  1. public class Tree extends Plant {

  2. public void growFruit() { }

  3. public void dropLeaves() { } 4. }

    Which statement is true?

    1. The code will compile without changes.

    2. The code will compile if public Tree() { Plant(); } is added to the Tree class.

    3. The code will compile if public Plant() { Tree(); } is added to the Plant class.

    4. The code will compile if public Plant() { this(quot;fernquot;); } is added to the Plant class.

    5. The code will compile if public Plant() { Plant(quot;fernquot;); } is added to the Plant class.

Answer: D

Question No: 153 – (Topic 2)

Given:

  1. class Line {

  2. public static class Point {}

12. } 13.

  1. class Triangle {

  2. // insert code here

16. }

Which code, inserted at line 15, creates an instance of the Point class defined in Line?

  1. Point p = new Point();

  2. Line.Point p = new Line.Point();

  3. The Point class cannot be instatiated at line 15.

  4. Line l = new Line() ; l.Point p = new l.Point();

Answer: B

Question No: 154 – (Topic 2)

Given:

  1. class Nav{

  2. public enum Direction { NORTH, SOUTH, EAST, WEST }

12. }

  1. public class Sprite{

  2. // insert code here

15. }

Which code, inserted at line 14, allows the Sprite class to compile?

  1. Direction d = NORTH;

  2. Nav.Direction d = NORTH;

  3. Direction d = Direction.NORTH;

  4. Nav.Direction d = Nav.Direction.NORTH;

Answer: D

Question No: 155 – (Topic 2)

Given:

  1. interface Data { public void load(); }

  2. abstract class Info { public abstract void load(); }

Which class correctly uses the Data interface and Info class?

  1. public class Employee extends Info implements Data { public void load() { /*do something*/ }

    }

  2. public class Employee implements Info extends Data { public void load() { /*do something*/ }

    }

  3. public class Employee extends Info implements Data { public void load(){ /*do something*/ }

    public void Info.load(){ /*do something*/ }

    }

  4. public class Employee implements Info extends Data { public void Data.load(){ /*do something*/ }

    public void load(){ /*do something*/ }

    }

  5. public class Employee implements Info extends Data { public void load(){ /*do something*/ }

    public void Info.load(){ /*do something*/ }

    }

  6. public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ }

public void Info.load() { /*do something*/ }

}

Answer: A

Question No: 156 – (Topic 2)

Given:

  1. public class Rainbow {

  2. public enum MyColor {

13. RED(0xff0000), GREEN(0x00ff00), BLUE(0x0000ff);

  1. private final int rgb;

  2. MyColor(int rgb) { this.rgb = rgb; }

  3. public int getRGB() { return rgb; } 17. };

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

  2. // insert code here

20. }

21. }

Which code fragment, inserted at line 19, allows the Rainbow class to compile?

  1. MyColor skyColor = BLUE;

  2. MyColor treeColor = MyColor.GREEN;

  3. if(RED.getRGB() lt; BLUE.getRGB()) { }

  4. Compilation fails due to other error(s) in the code.

  5. MyColor purple = new MyColor(0xff00ff);

  6. MyColor purple = MyColor.BLUE MyColor.RED;

Answer: B

Question No: 157 – (Topic 2)

Given:

  1. class One {

  2. void foo() { }

12. }

  1. class Two extends One {

  2. //insert method here

15. }

Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.)

  1. int foo() { /* more code here */ }

  2. void foo() { /* more code here */ }

  3. public void foo() { /* more code here */ }

  4. private void foo() { /* more code here */ }

  5. protected void foo() { /* more code here */ }

Answer: B,C,E

Question No: 158 – (Topic 2)

Click the Exhibit button. Which statement is true about the classes and interfaces in the exhibit?

Ensurepass 2018 PDF and VCE

  1. Compilation will succeed for all classes and interfaces.

  2. Compilation of class C will fail because of an error in line 2.

  3. Compilation of class C will fail because of an error in line 6.

  4. Compilation of class AImpl will fail because of an error in line 2.

Answer: C

Question No: 159 – (Topic 2)

Given:

11. public interface A { public void m1(); }

12.

  1. class B implements A { }

  2. class C implements A { public void m1() { } }

  3. class D implements A { public void m1(int x) { } }

  4. abstract class E implements A { }

  5. abstract class F implements A { public void m1() { } }

  6. abstract class G implements A { public void m1(int x) { } } What is the result?

  1. Compilation succeeds.

  2. Exactly one class does NOT compile.

  3. Exactly two classes do NOT compile.

  4. Exactly four classes do NOT compile.

  5. Exactly three classes do NOT compile.

    Answer: C

    Question No: 160 – (Topic 2)

    Given:

    1. class Alligator {

    2. public static void main(String[] args) { 3. int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};

4. int [][]y = x;

  1. System.out.println(y[2][1]); 6. }

    7. }

    What is the result?

    1. 2

    2. 3

    3. 4

    4. 6

    5. 7

    6. Compilation fails.

Answer: E

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

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.