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

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

Given:

  1. public class Breaker2 {

  2. static String o = quot;quot;;

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

  4. z:

5. for(int x = 2; x lt; 7; x ) {

  1. if(x==3) continue;

  2. if(x==5) break z;

  3. o = o x; 9. }

  1. System.out.println(o);

    11. }

    12. }

    What is the result?

    1. 2

    2. 24 C. 234 D. 246 E. 2346

    F. Compilation fails.

    Answer: B

    Question No: 142 – (Topic 2)

    Given:

  2. public void testIfA() {

  3. if (testIfB(quot;Truequot;)) {

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

  5. } else {

  6. System.out.println(quot;Not truequot;);

16. }

17. }

  1. public Boolean testIfB(String str) {

  2. return Boolean.valueOf(str);

20. }

What is the result when method testIfA is invoked?

  1. True

  2. Not true

  3. An exception is thrown at runtime.

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

  5. Compilation fails because of an error at line 19.

    Answer: A

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

Given:

  1. // some code here

  2. try {

  3. // some code here

  4. } catch (SomeException se) {

  5. // some code here

  6. } finally {

  7. // some code here

38. }

Under which three circumstances will the code on line 37 be executed? (Choose three.)

  1. The instance gets garbage collected.

  2. The code on line 33 throws an exception.

  3. The code on line 35 throws an exception.

  4. The code on line 31 throws an exception.

  5. The code on line 33 executes successfully.

Answer: B,C,E

Question No: 145 – (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: 146 – (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: 147 – (Topic 2)

Given:

  1. interface Foo {}

  2. class Alpha implements Foo {}

  3. class Beta extends Alpha {}

  4. class Delta extends Beta {

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

  6. Beta x = new Beta();

  7. // insert code here

17. }

18. }

Which code, inserted at line 16, will cause a java.lang.ClassCastException?

  1. Alpha a = x;

  2. Foo f = (Delta)x;

  3. Foo f = (Alpha)x;

  4. Beta b = (Beta)(Alpha)x;

Answer: B

Question No: 148 – (Topic 2)

Given:

  1. try {

  2. // some code here

  3. } catch (NullPointerException e1) {

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

  5. } catch (Exception e2) {

  6. System.out.print(quot;bquot;);

  7. } finally {

  8. System.out.print(quot;cquot;);

41. }

If some sort of exception is thrown at line 34, which output is possible?

  1. a

  2. b

  3. c

  4. ac

  5. abc

Answer: D

Question No: 149 – (Topic 2)

Given:

  1. public class Test {

  2. public enum Dogs {collie, harrier, shepherd};

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

  4. Dogs myDog = Dogs.shepherd;

  5. switch (myDog) {

  6. case collie:

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

  8. case default:

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

  10. case harrier:

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

22. }

23. }

24. }

What is the result?

  1. harrier

  2. shepherd

  3. retriever

  4. Compilation fails.

  5. retriever harrier

  6. An exception is thrown at runtime.

Answer: D

Question No: 150 – (Topic 2)

Click the Exhibit button. Given: ClassA a = new ClassA(); a.methodA(); What is the result?

Ensurepass 2017 PDF and VCE

  1. Compilation fails.

  2. ClassC is displayed.

  3. The code runs with no output.

  4. An exception is thrown at runtime.

Answer: D

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.