It is impossible to pass Oracle 1Z0-851 exam without any help in the short term. Come to Pass4sure soon and find the most advanced, correct and guaranteed Oracle 1Z0-851 practice questions. You will get a surprising result by our Update Java Standard Edition 6 Programmer Certified Professional Exam practice guides.

2017 Feb 1z0-851 syllabus:

Q131. 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


Q132. Given:

11. class Converter {

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

13. Integer i = args[0];

14. int j = 12;

15. System.out.println("It is " + (j==i) + " that j==i.");

16. }

17. }

What is the result when the programmer attempts to compile the code and run it with the command java

Converter 12?

A. It is true that j==i.

B. It is false that j==i.

C. An exception is thrown at runtime.

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

Answer: D


Q133. A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add

(0, object), but does NOT need to support quick random access. What supports these requirements?

A. java.util.Queue

B. java.util.ArrayList

C. java.util.LinearList

D. java.util.LinkedList

Answer: D


Q134. DRAG DROP

Answer:


Q135. 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


Most recent 1z0-851 java standard edition 6 programmer:

Q136. Given:

3. class Employee {

4. String name; double baseSalary;

5. Employee(String name, double baseSalary) {

6. this.name = name;

7. this.baseSalary = baseSalary;

8. }

9. }

10. public class SalesPerson extends Employee {

11. double commission;

12. public SalesPerson(String name, double baseSalary, double commission) {

13. // insert code here

14. }

15. }

Which two code fragments, inserted independently at line 13, will compile? (Choose two.)

A. super(name, baseSalary);

B. this.commission = commission;

C. super();

this.commission = commission;

D. this.commission = commission;

super();

E. super(name, baseSalary);

this.commission = commission;

F. this.commission = commission;

super(name, baseSalary);

G. super(name, baseSalary, commission);

Answer: AE


Q137. 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


Q138. Given:

12. import java.util.*;

13. public class Explorer3 {

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

15. TreeSet<Integer> s = new TreeSet<Integer>();

16. TreeSet<Integer> subs = new TreeSet<Integer>();

17. for(int i = 606; i < 613; i++)

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

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

20. subs.add(629);

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

22. }

23. }

What is the result?

A. Compilation fails.

B. An exception is thrown at runtime.

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

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

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

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

Answer: F


Q139. Given:

11. String test = "Test A. Test B. Test C.";

12. // insert code here

13. String[] result = test.split(regex);

Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?

A. String regex = "";

B. String regex = " ";

C. String regex = ".*";

D. String regex = "\\s";

E. String regex = "\\.\\s*";

F. String regex = "\\w[ \.] +";

Answer: E


Q140. Given:

11. static class A {

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

13. }

14. static class B extends A {

15. void process() { System.out.println("B"); }

16. }

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

18. new B().process();

19. }

What is the result?

A. B

B. The code runs with no output.

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

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

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

Answer: A