Exambible senior Oracle lecturers and experts may approve which Exambible Oracle [productsort] examination answers and questions are almost correct. The complete price regarding Java Standard Edition 6 Programmer Certified Professional Exam was almost 95 percent. Above al, we might show the [productsort] study materials produced valuable research regarding Oracle prospects. Our [productsort] pdf file definitely worth the examinees sparing no effort to review. It is possible to bet the shoe you will have good result by the Exambible Java Standard Edition 6 Programmer Certified Professional Exam apply checks.

2021 Aug 1z0-851 dumps:

Q131. Given:

1. public class Breaker2 {

2. static String o = "";

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

4. z:

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

6. if(x==3) continue;

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

8. o = o + x;

9. }

10. System.out.println(o);

11. }

12. }

What is the result?

A. 2

B. 24

C. 234

D. 246

E. 2346

F. Compilation fails.

Answer: B


Q132. Given:

3. import java.util.*;

4. public class Mapit {

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

6. Set<Integer> set = new HashSet<Integer>();

7. Integer i1 = 45;

8. Integer i2 = 46;

9. set.add(i1);

10. set.add(i1);

11. set.add(i2); System.out.print(set.size() + " ");

12. set.remove(i1); System.out.print(set.size() + " ");

13. i2 = 47;

14. set.remove(i2); System.out.print(set.size() + " ");

15. }

16. }

What is the result?

A. 2 1 0

B. 2 1 1

C. 3 2 1

D. 3 2 2

E. Compilation fails.

F. An exception is thrown at runtime.

Answer: B


Q133. Given:

1. interface TestA { String toString(); }

2. public class Test {

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

4. System.out.println(new TestA() {

5. public String toString() { return "test"; }

6. });

7. }

8. }

What is the result?

A. test

B. null

C. An exception is thrown at runtime.

D. Compilation fails because of an error in line 1.

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

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

Answer: A


Q134. Given two files, GrizzlyBear.java and Salmon.java:

1. package animals.mammals;

2.

3. public class GrizzlyBear extends Bear {

4. void hunt() {

5. Salmon s = findSalmon();

6. s.consume();

7. }

8. }

1. package animals.fish;

2.

3. public class Salmon extends Fish {

4. public void consume() { /* do stuff */ }

5. }

If both classes are in the correct directories for their packages, and the Mammal class correctly defines the

findSalmon() method, which change allows this code to compile?

A. add import animals.mammals.*; at line 2 in Salmon.java

B. add import animals.fish.*; at line 2 in GrizzlyBear.java

C. add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java

D. add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java

Answer: B


Q135. Given:

22. public void go() {

23. String o = "";

24. z:

25. for(int x = 0; x < 3; x++) {

26. for(int y = 0; y < 2; y++) {

27. if(x==1) break;

28. if(x==2 && 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

E. Compilation fails.

F. An exception is thrown at runtime.

Answer: C


2passeasy.com

Updated oracle ocjp 1z0-851:

Q136. Given:

11. public void go(int x) {

12. assert (x > 0);

13. switch(x) {

14. case 2: ;

15. default: assert false;

16. }

17. }

18. private void go2(int x) { assert (x < 0); }

Which statement is true?

A. All of the assert statements are used appropriately.

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

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

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

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

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

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

Answer: G


Q137. Given:

11. interface DeclareStuff {

12. public static final int EASY = 3;

13. void doStuff(int t); }

14. public class TestDeclare implements DeclareStuff {

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

16. int x = 5;

17. new TestDeclare().doStuff(++x);

18. }

19. void doStuff(int s) {

20. s += EASY + ++s;

21. System.out.println("s " + s);

22. }

23. }

What is the result?

A. s 14

B. s 16

C. s 10

D. Compilation fails.

E. An exception is thrown at runtime.

Answer: D


Q138. Given:

10. class One {

11. void foo() { }

12. }

13. class Two extends One {

14. //insert method here

15. }

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

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

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

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

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

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

Answer: BCE


Q139. Given:

5. class Building { }

6. public class Barn extends Building {

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

8. Building build1 = new Building();

9. Barn barn1 = new Barn();

10. Barn barn2 = (Barn) build1;

11. Object obj1 = (Object) build1;

12. String str1 = (String) build1;

13. Building build2 = (Building) barn1;

14. }

15. }

Which is true?

A. If line 10 is removed, the compilation succeeds.

B. If line 11 is removed, the compilation succeeds.

C. If line 12 is removed, the compilation succeeds.

D. If line 13 is removed, the compilation succeeds.

E. More than one line must be removed for compilation to succeed.

Answer: C


Q140. Given:

11. static void test() throws RuntimeException {

12. try {

13. System.out.print("test ");

14. throw new RuntimeException();

15. }

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

17. }

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

19. try { test(); }

20. catch (RuntimeException ex) { System.out.print("runtime "); }

21. System.out.print("end ");

22. }

What is the result?

A. test end

B. Compilation fails.

C. test runtime end

D. test exception end

E. A Throwable is thrown by main at runtime.

Answer: D