Our Oracle Oracle study guides are generally available in Pdf forms which are printed along with convenient to utilize. You can carry all of them with a person whenever along with whenever youd like to. We all are certain you will end up being armed with the newest and most useful Oracle 1Z0-851 training materials. All the Oracle 1Z0-851 questions along with answers are customized on the basis of the genuine exam syllabus. You wont pass from the Oracle 1Z0-851 certification. Our Oracle test engine gives some visualized scenarios that you will experience in the Oracle 1Z0-851 real exam. Our Oracle 1Z0-851 exam dumps can polish your skills and thoughts.

2016 Sep oracle ocp 1z0-851:

Q191. Given:

10. class Nav{

11. public enum Direction { NORTH, SOUTH, EAST, WEST }

12. }

13. public class Sprite{

14. // insert code here

15. }

Which code, inserted at line 14, allows the Sprite class to compile?

A. Direction d = NORTH;

B. Nav.Direction d = NORTH;

C. Direction d = Direction.NORTH;

D. Nav.Direction d = Nav.Direction.NORTH;

Answer: D


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


Q193. Given:

10. interface Foo {}

11. class Alpha implements Foo {}

12. class Beta extends Alpha {}

13. class Delta extends Beta {

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

15. Beta x = new Beta();

16. // insert code here

17. }

18. }

Which code, inserted at line 16, will cause a java.lang.ClassCastException?

A. Alpha a = x;

B. Foo f = (Delta)x;

C. Foo f = (Alpha)x;

D. Beta b = (Beta)(Alpha)x;

Answer: B


certifyforall.com

Improved 1z0-851 mock:

Q194. Given classes defined in two different files:

1. package util;

2. public class BitUtils {

3. private static void process(byte[] b) {}

4. }

1. package app; 2

. public class SomeApp {

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

4. byte[] bytes = new byte[256];

5. // insert code here

6. }

7. }

What is required at line 5 in class SomeApp to use the process method of BitUtils?

A. process(bytes);

B. BitUtils.process(bytes);

C. app.BitUtils.process(bytes);

D. util.BitUtils.process(bytes);

E. import util.BitUtils.*; process(bytes);

F. SomeApp cannot use the process method in BitUtils.

Answer: F


Q195. Given:

11. public class Commander {

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

13. String myProp = /* insert code here */

14. System.out.println(myProp);

15. }

16. }

and the command line: java -Dprop.custom=gobstopper Commander Which two, placed on line 13, will

produce the output gobstopper? (Choose two.)

A. System.load("prop.custom");

B. System.getenv("prop.custom");

C. System.property("prop.custom");

D. System.getProperty("prop.custom");

E. System.getProperties().getProperty("prop.custom");

Answer: DE


Q196. Given:

31. // some code here

32. try {

33. // some code here

34. } catch (SomeException se) {

35. // some code here

36. } finally {

37. // some code here

38. }

Under which three circumstances will the code on line 37 be executed? (Choose three.)

A. The instance gets garbage collected.

B. The code on line 33 throws an exception.

C. The code on line 35 throws an exception.

D. The code on line 31 throws an exception.

E. The code on line 33 executes successfully.

Answer: BCE


Q197. Given:

1. public class TestFive {

2. private int x;

3. public void foo() {

4. int current = x;

5. x = current + 1;

6. }

7. public void go() {

8. for(int i = 0; i < 5; i++) {

9. new Thread() {

10. public void run() {

11. foo();

12. System.out.print(x + ", ");

13. } }.start();

14. } }

Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ? (Choose two.)

A. move the line 12 print statement into the foo() method

B. change line 7 to public synchronized void go() {

C. change the variable declaration on line 2 to private volatile int x; D. wrap the code inside the foo() method with a synchronized( this ) block

D. wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }

Answer: AD