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

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

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

Given:

  1. class A {

  2. public void process() { System.out.print(quot;A,quot;); }

  3. class B extends A {

  4. public void process() throws IOException {

  5. super.process();

  6. System.out.print(quot;B,quot;);

  7. throw new IOException();

18. }

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

  2. try { new B().process(); }

  3. catch (IOException e) { System.out.println(quot;Exceptionquot;); }

22. }

What is the result?

  1. Exception

  2. A,B,Exception

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

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

  5. A NullPointerException is thrown at runtime.

Answer: D

Question No: 43 – (Topic 1)

Given:

  1. public void go(int x) {

  2. assert (x gt; 0);

  3. switch(x) {

  4. case 2: ;

  5. default: assert false;

16. }

17. }

18. private void go2(int x) { assert (x lt; 0); } Which statement is true?

  1. All of the assert statements are used appropriately.

  2. Only the assert statement on line 12 is used appropriately.

  3. Only the assert statement on line 15 is used appropriately.

  4. Only the assert statement on line 18 is used appropriately.

  5. Only the assert statements on lines 12 and 15 are used appropriately.

  6. Only the assert statements on lines 12 and 18 are used appropriately.

  7. Only the assert statements on lines 15 and 18 are used appropriately.

    Answer: G

    Question No: 44 – (Topic 1)

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

    Given:

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

  3. String str = quot;nullquot;;

  4. if (str == null) {

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

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

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

  8. } else {

  9. 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: 46 – (Topic 1)

Given:

  1. public class Test {

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

  3. int x = 5;

  4. boolean b1 = true;

  5. boolean b2 = false; 16.

17. if ((x == 4) amp;amp; !b2 )

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

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

20. if ((b2 = true) amp;amp; b1 )

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

22. }

23. }

What is the result?

  1. 2

  2. 3

  3. 1 2

  4. 2 3

E. 1 2 3

  1. Compilation fails.

  2. An exception is thrown at runtime.

Answer: D

Question No: 47 – (Topic 1)

Given:

  1. static void test() throws Error {

  2. if (true) throw new AssertionError();

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

14. }

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

  2. try { test(); }

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

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

19. }

What is the result?

  1. end

  2. Compilation fails.

  3. exception end

  4. exception test end

  5. A Throwable is thrown by main.

  6. An Exception is thrown by main.

Answer: E

Question No: 48 – (Topic 1)

Given:

  1. public class Foo {

  2. static int[] a;

12. static { a[0]=2; }

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

14. }

Which exception or error will be thrown when a programmer attempts to run this code?

  1. java.lang.StackOverflowError

  2. java.lang.IllegalStateException

  3. java.lang.ExceptionInInitializerError

  4. java.lang.ArrayIndexOutOfBoundsException

Answer: C

Question No: 49 – (Topic 1)

Click the Exhibit button. Given:

  1. try {

  2. A a = new A();

  3. a.method1();

  4. } catch (Exception e) {

  5. System.out.print(quot;an error occurredquot;);

30. }

Which two statements are true if a NullPointerException is thrown on line 3 of class C? (Choose two.)

Ensurepass 2017 PDF and VCE

  1. The application will crash.

  2. The code on line 29 will be executed.

  3. The code on line 5 of class A will execute.

  4. The code on line 5 of class B will execute.

  5. The exception will be propagated back to line 27.

Answer: B,E

Question No: 50 – (Topic 1)

Given:

11. public static void main(String[] args) { 12. for (int i = 0; i lt;= 10; i ) {

13. if (i gt; 6) break;

14. }

15. System.out.println(i);

16. }

What is the result?

  1. 6

  2. 7

  3. 10

  4. 11

  5. Compilation fails.

  6. An exception is thrown at runtime.

Answer: E

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.