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

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: 181 – (Topic 2)

Given:

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

  2. String str = quot;nullquot;;

  3. if (str == null) {

  4. System.out.println(quot;nullquot;);

  5. } else (str.length() == 0) {

  6. System.out.println(quot;zeroquot;);

  7. } else {

  8. System.out.println(quot;somequot;);

19. }

20. }

What is the result?

  1. null

  2. zero

  3. some

  4. Compilation fails.

  5. An exception is thrown at runtime.

    Answer: D

    Question No: 182 – (Topic 2)

    Given:

    1. public class Mule {

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

    3. boolean assert = true;

    4. if(assert) {

    5. System.out.println(quot;assert is truequot;); 6. }

      7. }

      8. }

      Which command-line invocations will compile?

      1. javac Mule.java

      2. javac -source 1.3 Mule.java

      3. javac -source 1.4 Mule.java

      4. javac -source 1.5 Mule.java

Answer: B

Question No: 183 – (Topic 2)

Given:

  1. static void test() {

  2. try {

  3. String x = null;

  4. System.out.print(x.toString() quot; quot;);

15. }

16. finally { System.out.print(quot;finally quot;); }

17. }

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

  2. try { test(); }

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

21. }

What is the result?

  1. null

  2. finally

  3. null finally

  4. Compilation fails.

  5. finally exception

    Answer: E

    Question No: 184 – (Topic 2)

    Given:

    1. public class Boxer1{

    2. Integer i;

    3. int x;

    4. public Boxer1(int y) {

    5. x = i y;

    6. System.out.println(x); 7. }

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

  2. new Boxer1(new Integer(4));

    10. }

    11. }

    What is the result?

    1. The value quot;4quot; is printed at the command line.

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

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

    4. A NullPointerException occurs at runtime.

    5. A NumberFormatException occurs at runtime.

    6. An IllegalStateException occurs at runtime.

Answer: D

Question No: 185 – (Topic 2)

Which two code fragments are most likely to cause a StackOverflowError? (Choose two.)

A. int []x = {1,2,3,4,5};

for(int y = 0; y lt; 6; y ) System.out.println(x[y]); B. static int[] x = {7,6,5,4}; static { x[1] = 8;

x[4] = 3; }

C. for(int y = 10; y lt; 10; y ) doStuff(y);

D. void doOne(int x) { doTwo(x); } void doTwo(int y) { doThree(y); } void doThree(int z) { doTwo(z); }

E. for(int x = 0; x lt; 1000000000; x ) doStuff(x);

F. void counter(int i) { counter( i); }

Answer: D,F

Question No: 186 – (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: 187 – (Topic 2)

Given:

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

  2. Integer i = new Integer(1) new Integer(2);

  3. switch(i) {

  4. case 3: System.out.println(quot;threequot;); break;

  5. default: System.out.println(quot;otherquot;); break;

16. }

17. }

What is the result?

  1. three

  2. other

  3. An exception is thrown at runtime.

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

  5. Compilation fails because of an error on line 13.

  6. Compilation fails because of an error on line 15.

Answer: A

Question No: 188 – (Topic 2)

Given:

  1. class Money {

  2. private String country = quot;Canadaquot;;

  3. public String getC() { return country; }

24. }

  1. class Yen extends Money {

  2. public String getC() { return super.country; }

27. }

  1. public class Euro extends Money {

  2. public String getC(int x) { return super.getC(); }

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

  4. System.out.print(new Yen().getC() quot; quot; new Euro().getC());

32. }

33. }

What is the result?

  1. Canada

  2. null Canada

  3. Canada null

  4. Canada Canada

  5. Compilation fails due to an error on line 26.

  6. Compilation fails due to an error on line 29.

Answer: E

Question No: 189 – (Topic 2)

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: 190 – (Topic 2)

Which three statements are true? (Choose three.)

  1. A final method in class X can be abstract if and only if X is abstract.

  2. A protected method in class X can be overridden by any subclass of X.

  3. A private static method can be called only within other static methods in class X.

  4. A non-static public final method in class X can be overridden in any subclass of X.

  5. A public static method in class X can be called by a subclass of X without explicitly referencing the class X.

  6. A method with the same signature as a private final method in class X can be implemented in a subclass of X.

  7. A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.

Answer: B,E,F

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.