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

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

Given:

  1. import java.util.*;

  2. public class Explorer1 {

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

  4. TreeSetlt;Integergt; s = new TreeSetlt;Integergt;();

  5. TreeSetlt;Integergt; subs = new TreeSetlt;Integergt;(); 17. for(int i = 606; i lt; 613; i )

18. if(i%2 == 0) s.add(i);

19. subs = (TreeSet)s.subSet(608, true, 611, true); 20. s.add(609);

21. System.out.println(s quot; quot; subs);

22. }

23. }

What is the result?

  1. Compilation fails.

  2. An exception is thrown at runtime.

C. [608, 609, 610, 612] [608, 610]

D. [608, 609, 610, 612] [608, 609, 610]

E. [606, 608, 609, 610, 612] [608, 610]

F. [606, 608, 609, 610, 612] [608, 609, 610]

Answer: F

Question No: 102 – (Topic 2)

Given:

  1. Object [] myObjects = {

  2. new Integer(12),

  3. new String(quot;fooquot;),

  4. new Integer(5),

  5. new Boolean(true) 28. };

  1. Arrays.sort(myObjects);

  2. for(int i=0; ilt;myObjects.length; i ) {

  3. System.out.print(myObjects[i].toString());

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

33. }

What is the result?

  1. Compilation fails due to an error in line 23.

  2. Compilation fails due to an error in line 29.

  3. A ClassCastException occurs in line 29.

  4. A ClassCastException occurs in line 31.

  5. The value of all four objects prints in natural order.

    Answer: C

    Question No: 103 – (Topic 2)

    Given:

    1. public class Donkey {

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

    3. boolean assertsOn = false;

    4. assert (assertsOn) : assertsOn = true;

    5. if(assertsOn) {

    6. System.out.println(quot;assert is onquot;); 7. }

      8. }

      9. }

      If class Donkey is invoked twice, the first time without assertions enabled, and the second time with assertions enabled, what are the results?

      1. no output

      2. no output assert is on

      3. assert is on

      4. no output

        An AssertionError is thrown.

      5. assert is on

An AssertionError is thrown.

Answer: D

Question No: 104 – (Topic 2)

Given:

11. Float pi = new Float(3.14f);

12. if (pi gt; 3) {

13. System.out.print(quot;pi is bigger than 3. quot;);

14. }

  1. else {

  2. System.out.print(quot;pi is not bigger than 3. quot;);

17. }

  1. finally {

  2. System.out.println(quot;Have a nice day.quot;);

20. }

What is the result?

  1. Compilation fails.

  2. pi is bigger than 3.

  3. An exception occurs at runtime.

  4. pi is bigger than 3. Have a nice day.

  5. pi is not bigger than 3. Have a nice day.

Answer: A

Question No: 105 – (Topic 2)

Given:

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

  2. try {

  3. args = null;

  4. args[0] = quot;testquot;;

  5. System.out.println(args[0]);

  6. } catch (Exception ex) {

  7. System.out.println(quot;Exceptionquot;);

  8. } catch (NullPointerException npe) {

  9. System.out.println(quot;NullPointerExceptionquot;);

20. }

21. }

What is the result?

  1. test

  2. Exception

  3. Compilation fails.

  4. NullPointerException

Answer: C

Question No: 106 – (Topic 2)

Given:

  1. public void go() {

  2. String o = quot;quot;;

  3. z:

25. for(int x = 0; x lt; 3; x ) { 26. for(int y = 0; y lt; 2; y ) {

27. if(x==1) break;

28. if(x==2 amp;amp; y==1) break z;

29. o = o x y;

30. }

31. }

32. System.out.println(o);

33. }

What is the result when the go() method is invoked?

A. 00

B. 0001

C. 000120

D. 00012021

  1. Compilation fails.

  2. An exception is thrown at runtime.

Answer: C

Question No: 107 – (Topic 2)

Given:

  1. public class Test {

  2. public enum Dogs {collie, harrier};

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

  4. Dogs myDog = Dogs.collie;

  5. switch (myDog) {

  6. case collie:

  7. System.out.print(quot;collie quot;);

  8. case harrier:

  9. System.out.print(quot;harrier quot;);

21. }

22. }

23. }

What is the result?

  1. collie

  2. harrier

  3. Compilation fails.

  4. collie harrier

  5. An exception is thrown at runtime.

Answer: D

Question No: 108 – (Topic 2)

Click the Exhibit button. Given:

  1. public void method() {

  2. A a = new A();

  3. a.method1();

34. }

Which statement is true if a TestException is thrown on line 3 of class B?

Ensurepass 2017 PDF and VCE

  1. Line 33 must be called within a try block.

  2. The exception thrown by method1 in class A is not required to be caught.

  3. The method declared on line 31 must be declared to throw a RuntimeException.

  4. On line 5 of class A, the call to method2 of class B does not need to be placed in a try/catch block.

    Answer: B

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

Given:

  1. static class A {

  2. void process() throws Exception { throw new Exception(); }

13. }

  1. static class B extends A {

  2. void process() { System.out.println(quot;Bquot;); }

16. }

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

  2. new B().process();

19. }

What is the result?

  1. B

  2. The code runs with no output.

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

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

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

    Answer: A

    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.