You will have quick access for the free downloadable Oracle 1Z0-851 simulated tests soon after purchasing. It?¡¥s any shortcut in your case to get certified inside a low value. Make entire use of your own spare time to be able to practise the Oracle 1Z0-851 on the internet study supplies. Our cheapest along with latest Oracle 1Z0-851 exam braindumps include the resourceful supplies for the Oracle real check. You should select 1 that meets your own studying requirements.

2016 Dec oracle ocp 1z0-851:

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


Q22. Given:

11. // insert code here

12. private N min, max;

13. public N getMin() { return min; }

14. public N getMax() { return max; }

15. public void add(N added) {

16. if (min == null || added.doubleValue() < min.doubleValue())

17. min = added;

18. if (max == null || added.doubleValue() > max.doubleValue()) 19. max = added;

20. }

21. }

Which two, inserted at line 11, will allow the code to compile? (Choose two.)

A. public class MinMax<?> {

B. public class MinMax<? extends Number> {

C. public class MinMax<N extends Object> {

D. public class MinMax<N extends Number> {

E. public class MinMax<? extends Object> {

F. public class MinMax<N extends Integer> {

Answer: DF


Q23. Given:

3. public class Breaker {

4. static String o = "";

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

6. z:

7. o = o + 2;

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

9. if(x==4) break;

10. if(x==6) break z;

11. o = o + x;

12. }

13. System.out.println(o);

14. }

15. }

What is the result?

A. 23

B. 234

C. 235

D. 2345

E. 2357

F. 23457

G. Compilation fails.

Answer: G


Q24. Given:

11. public static Iterator reverse(List list) {

12. Collections.reverse(list);

13. return list.iterator();

14. }

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

16. List list = new ArrayList();

17. list.add("1"); list.add("2"); list.add("3");

18. for (Object obj: reverse(list))

19. System.out.print(obj + ", ");

20. }

What is the result?

A. 3, 2, 1,

B. 1, 2, 3,

C. Compilation fails.

D. The code runs with no output.

E. An exception is thrown at runtime.

Answer: C


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


Regenerate 1z0-851 discount voucher:

Q26. Click the Exhibit button. What is the result?

A. 4321

B. 0000

C. An exception is thrown at runtime.

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

Answer: D


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


Q28. Click the Exhibit button. What is the result?

A. go in Goban

go in Sente

B. go in Sente

go in Goban

C. go in Sente

go in Goban

D. go in Goban

go in Sente

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

Answer: C


Q29. A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class

while compiling the Book class? (Choose three.)

A. The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar.

B. The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar..

C. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/

myLib.jar/Paper.class.

D. The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/

myLib.jar.

E. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp /foo/myLib.jar/

Paper Book.java.

F. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d /foo/myLib.jar

Book.java

G. The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -classpath /foo/

myLib.jar Book.java

Answer: BDG


Q30. Given:

1. public class Threads5 {

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

3. new Thread(new Runnable() {

4. public void run() {

5. System.out.print("bar");

6. }}).start();

7. }

8. }

What is the result?

A. Compilation fails.

B. An exception is thrown at runtime.

C. The code executes normally and prints "bar".

D. The code executes normally, but nothing prints.

Answer: C