We have the specialized team that we are proud of. They will create and also revise our Oracle Oracle exam products for many occasions before publishing. We also maintain improving the quality and worth of each of our Oracle 1Z0-851 practice demos. You are guaranteed that you will obtain through the Oracle Oracle certification. Normally, you can claim full refund of getting fees in case you fail the exam following using each of our Oracle 1Z0-851 exam products. We now have achieved the high reputation in the This market because of our higher reputation throughout compiling the Oracle certification. Take actions proper now and also be nicely prepared for the Oracle 1Z0-851 genuine test.

2016 Dec oracle 1z0-851:

Q151. Given:

1. public class TestString3 {

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

3. // insert code here

5. System.out.println(s);

6. }

7. }

Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose two.)

A. String s = "123456789";

s = (s-"123").replace(1,3,"24") - "89";

B. StringBuffer s = new StringBuffer("123456789");

C. delete(0,3).replace(1,3,"24").delete(4,6);

D. StringBuffer s = new StringBuffer("123456789");

E. substring(3,6).delete(1,3).insert(1, "24");

F. StringBuilder s = new StringBuilder("123456789");

G. substring(3,6).delete(1,2).insert(1, "24");

H. StringBuilder s = new StringBuilder("123456789");

I. delete(0,3).delete(1,3).delete(2,5).insert(1, "24");

Answer: BE


Q152. Given:

1. public class LineUp {

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

3. double d = 12.345;

4. // insert code here

5. }

6. }

Which code fragment, inserted at line 4, produces the output | 12.345|?

A. System.out.printf("|%7d| \n", d);

B. System.out.printf("|%7f| \n", d);

C. System.out.printf("|%3.7d| \n", d);

D. System.out.printf("|%3.7f| \n", d);

E. System.out.printf("|%7.3d| \n", d);

F. System.out.printf("|%7.3f| \n", d);

Answer: F


Q153. Given:

11. class Animal { public String noise() { return "peep"; } }

12. class Dog extends Animal {

13. public String noise() { return "bark"; }

14. }

15. class Cat extends Animal {

16. public String noise() { return "meow"; }

17. } ...

30. Animal animal = new Dog();

31. Cat cat = (Cat)animal;

32. System.out.println(cat.noise());

What is the result?

A. peep

B. bark

C. meow

D. Compilation fails.

E. An exception is thrown at runtime.

Answer: E


Q154. Given:

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

12. for (int i = 0; i <= 10; i++) {

13. if (i > 6) break;

14. }

15. System.out.println(i);

16. }

What is the result?

A. 6

B. 7

C. 10

D. 11

E. Compilation fails.

F. An exception is thrown at runtime.

Answer: E


Q155. Given:

1. public class Venus {

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

3. int [] x = {1,2,3};

4. int y[] = {4,5,6};

5. new Venus().go(x,y);

6. }

7. void go(int[]... z) {

8. for(int[] a : z)

9. System.out.print(a[0]);

10. }

11. }

What is the result?

A. 1

B. 12

C. 14

D. 123

E. Compilation fails.

F. An exception is thrown at runtime.

Answer: C


Most up-to-date ocjp 1z0-851 syllabus:

Q156. Which two statements are true? (Choose two.)

A. It is possible for more than two threads to deadlock at once.

B. The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.

C. Deadlocked threads release once their sleep() method's sleep duration has expired.

D. Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.

E. It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.

F. If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().

Answer: AF


Q157. Given:

3. import java.util.*;

4. public class Hancock {

5. // insert code here

6. list.add("foo");

7. }

8. }

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

A. public void addStrings(List list) {

B. public void addStrings(List<String> list) {

C. public void addStrings(List<? super String> list) {

D. public void addStrings(List<? extends String> list) {

Answer: BC


Q158. Given that the current directory is empty, and that the user has read and write privileges to the current directory, and the following:

1. import java.io.*;

2. public class Maker {

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

4. File dir = new File("dir");

5. File f = new File(dir, "f");

6. }

7. }

Which statement is true?

A. Compilation fails.

B. Nothing is added to the file system.

C. Only a new file is created on the file system.

D. Only a new directory is created on the file system.

E. Both a new file and a new directory are created on the file system.

Answer: B


Q159. Given:

1. public class Plant {

2. private String name;

3. public Plant(String name) { this.name = name; }

4. public String getName() { return name; }

5. }

1. public class Tree extends Plant {

2. public void growFruit() { }

3. public void dropLeaves() { }

4. }

Which statement is true?

A. The code will compile without changes.

B. The code will compile if public Tree() { Plant(); } is added to the Tree class.

C. The code will compile if public Plant() { Tree(); } is added to the Plant class.

D. The code will compile if public Plant() { this("fern"); } is added to the Plant class.

E. The code will compile if public Plant() { Plant("fern"); } is added to the Plant class.

Answer: D


Q160. Given:

11. public abstract class Shape {

12. private int x;

13. private int y;

14. public abstract void draw();

15. public void setAnchor(int x, int y) {

16. this.x = x;

17. this.y = y;

18. }

19. }

Which two classes use the Shape class correctly? (Choose two.)

A. public class Circle implements Shape {

private int radius;

}

B. public abstract class Circle extends Shape {

private int radius;

}

C. public class Circle extends Shape {

private int radius;

public void draw();

}

D. public abstract class Circle implements Shape {

private int radius;

public void draw();

}

E. public class Circle extends Shape {

private int radius;

public void draw() {/* code here */}

F. public abstract class Circle implements Shape {

private int radius;

public void draw() { /* code here */ }

Answer: BE