Testking offers free demo for 1Z0-851 exam. "Java Standard Edition 6 Programmer Certified Professional Exam", also known as 1Z0-851 exam, is a Oracle Certification. This set of posts, Passing the Oracle 1Z0-851 exam, will help you answer those questions. The 1Z0-851 Questions & Answers covers all the knowledge points of the real exam. 100% real Oracle 1Z0-851 exams and revised by experts!


♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1Z0-851 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1Z0-851 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1Z0-851-exam-dumps.html

Q111. Click the Exhibit button. What two must the programmer do to correct the compilation errors? (Choose two.)

A. insert a call to this() in the Car constructor

B. insert a call to this() in the MeGo constructor

C. insert a call to super() in the MeGo constructor

D. insert a call to super(vin) in the MeGo constructor

E. change the wheelCount variable in Car to protected

F. change line 3 in the MeGo class to super.wheelCount = 3;

Answer: DE


Q112. Given:

1. class Super {

2. private int a;

3. protected Super(int a) { this.a = a; }

4. } ...

11. class Sub extends Super {

12. public Sub(int a) { super(a); }

13. public Sub() { this.a = 5; }

14. }

Which two, independently, will allow Sub to compile? (Choose two.)

A. Change line 2 to:

public int a;

B. Change line 2 to:

protected int a;

C. Change line 13 to:

public Sub() { this(5); }

D. Change line 13 to:

public Sub() { super(5); }

E. Change line 13 to:

public Sub() { super(a); }

Answer: CD


Q113. Given:

1. package com.company.application;

2.

3. public class MainClass {

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

5. }

And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory). Which two java commands entered at the command line will run MainClass? (Choose two.)

A. java MainClass if run from the /apps directory

B. java com.company.application.MainClass if run from the /apps directory

C. java -classpath /apps com.company.application.MainClass if run from any directory

D. java -classpath . MainClass if run from the /apps/com/company/application directory

E. java -classpath /apps/com/company/application:. MainClass if run from the /apps directory

F. java com.company.application.MainClass if run from the /apps/com/company/application directory

Answer: BC


Q114. Given:

1. public class GC {

2. private Object o;

3. private void doSomethingElse(Object obj) { o = obj; }

4. public void doSomething() {

5. Object o = new Object();

6. doSomethingElse(o);

7. o = new Object();

8. doSomethingElse(null);

9. o = null;

10. }

11. }

When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection?

A. Line 5

B. Line 6

C. Line 7

D. Line 8

E. Line 9

F. Line 10

Answer: D


Q115. DRAG DROP

Click the Task button.

Answer:


Q116. Given that the elements of a PriorityQueue are ordered according to natural ordering, and:

2. import java.util.*;

3. public class GetInLine {

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

5. PriorityQueue<String> pq = new PriorityQueue<String>();

6. pq.add("banana");

7. pq.add("pear");

8. pq.add("apple");

9. System.out.println(pq.poll() + " " + pq.peek());

10. }

11. }

What is the result?

A. apple pear

B. banana pear

C. apple apple

D. apple banana

E. banana banana

Answer: D


Q117. Given:

23. Object [] myObjects = {

24. new Integer(12),

25. new String("foo"),

26. new Integer(5),

27. new Boolean(true)

28. };

29. Arrays.sort(myObjects);

30. for(int i=0; i<myObjects.length; i++) {

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

32. System.out.print(" ");

33. }

What is the result?

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

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

C. A ClassCastException occurs in line 29.

D. A ClassCastException occurs in line 31.

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

Answer: C


Q118. Given:

21. class Money {

22. private String country = "Canada";

23. public String getC() { return country; }

24. }

25. class Yen extends Money {

26. public String getC() { return super.country; }

27. }

28. public class Euro extends Money {

29. public String getC(int x) { return super.getC(); }

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

31. System.out.print(new Yen().getC() + " " + new Euro().getC());

32. }

33. }

What is the result?

A. Canada

B. null Canada

C. Canada null

D. Canada Canada

E. Compilation fails due to an error on line 26.

F. Compilation fails due to an error on line 29.

Answer: E


Q119. Given:

2. public class Hi {

3. void m1() { }

4. protected void() m2 { }

5. }

6. class Lois extends Hi {

7. // insert code here

8. }

Which four code fragments, inserted independently at line 7, will compile? (Choose four.)

A. public void m1() { }

B. protected void m1() { }

C. private void m1() { }

D. void m2() { }

E. public void m2() { }

F. protected void m2() { }

G. private void m2() { }

Answer: ABEF


Q120. Given:

10: public class Hello {

11: String title;

12: int value;

13: public Hello() {

14: title += " World";

15: }

16: public Hello(int value) {

17: this.value = value;

18: title = "Hello";

19: Hello();

20: }

21: }

and:

30: Hello c = new Hello(5);

31: System.out.println(c.title);

What is the result?

A. Hello

B. Hello World

C. Compilation fails.

D. Hello World 5

E. The code runs with no output.

F. An exception is thrown at runtime.

Answer: C