It is more faster and easier to pass the Oracle 1Z0-851 exam by using High value Oracle Java Standard Edition 6 Programmer Certified Professional Exam questuins and answers. Immediate access to the Far out 1Z0-851 Exam and find the same core area 1Z0-851 questions with professionally verified answers, then PASS your exam with a high score now.

2016 Oct ocjp 1z0-851 dumps:

Q51. A team of programmers is involved in reviewing a proposed design for a new utility class. After some discussion, they realize that the current design allows other classes to access methods in the utility class that should be accessible only to methods within the utility class itself. What design issue has the team discovered?

A. Tight coupling

B. Low cohesion

C. High cohesion

D. Loose coupling

E. Weak encapsulation

F. Strong encapsulation

Answer: E


Q52. Which two code fragments are most likely to cause a StackOverflowError? (Choose two.)

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

for(int y = 0; y < 6; y++)

System.out.println(x[y]);

B. static int[] x = {7,6,5,4};

static { x[1] = 8;

x[4] = 3; }

C. for(int y = 10; y < 10; y++)

doStuff(y);

D. void doOne(int x) { doTwo(x); }

void doTwo(int y) { doThree(y); }

void doThree(int z) { doTwo(z); }

E. for(int x = 0; x < 1000000000; x++)

doStuff(x);

F. void counter(int i) { counter(++i); }

Answer: DF


Q53. Given:

31. class Foo {

32. public int a = 3;

33. public void addFive() { a += 5; System.out.print("f "); }

34. }

35. class Bar extends Foo {

36. public int a = 8;

37. public void addFive() { this.a += 5; System.out.print("b " ); }

38. } Invoked with: Foo f = new Bar(); f.addFive(); System.out.println(f.a);

What is the result?

A. b 3

B. b 8

C. b 13

D. f 3

E. f 8

F. f 13

G. Compilation fails.

H. An exception is thrown at runtime.

Answer: A


Q54. Given:

1. public class BuildStuff {

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

3. Boolean test = new Boolean(true);

4. Integer x = 343;

5. Integer y = new BuildStuff().go(test, x);

6. System.out.println(y);

7. }

8. int go(Boolean b, int i) {

9. if(b) return (i/7);

10. return (i/49);

11. }

12. }

What is the result?

A. 7

B. 49

C. 343

D. Compilation fails.

E. An exception is thrown at runtime.

Answer: B


Q55. Given:

10. class One {

11. void foo() { }

12. }

13. class Two extends One {

14. //insert method here

15. }

Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.)

A. int foo() { /* more code here */ }

B. void foo() { /* more code here */ }

C. public void foo() { /* more code here */ }

D. private void foo() { /* more code here */ }

E. protected void foo() { /* more code here */ }

Answer: BCE


Most recent 1z0-851 pdf:

Q56. Given:

5. class Building { }

6. public class Barn extends Building {

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

8. Building build1 = new Building();

9. Barn barn1 = new Barn();

10. Barn barn2 = (Barn) build1;

11. Object obj1 = (Object) build1;

12. String str1 = (String) build1;

13. Building build2 = (Building) barn1;

14. }

15. }

Which is true?

A. If line 10 is removed, the compilation succeeds.

B. If line 11 is removed, the compilation succeeds.

C. If line 12 is removed, the compilation succeeds.

D. If line 13 is removed, the compilation succeeds.

E. More than one line must be removed for compilation to succeed.

Answer: C


Q57. Given that Triangle implements Runnable, and:

31. void go() throws Exception {

32. Thread t = new Thread(new Triangle());

33. t.start();

34. for(int x = 1; x < 100000; x++) {

35. //insert code here

36. if(x%100 == 0) System.out.print("g");

37. } }

38. public void run() {

39. try {

40. for(int x = 1; x < 100000; x++) {

41. // insert the same code here

42. if(x%100 == 0) System.out.print("t");

43. }

44. } catch (Exception e) { }

45. }

Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to

temporarily pause and allow the other thread to execute? (Choose two.)

A. Thread.wait();

B. Thread.join();

C. Thread.yield();

D. Thread.sleep(1);

E. Thread.notify();

Answer: CD


Q58. Given:

11. public void genNumbers() {

12. ArrayList numbers = new ArrayList();

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

14. int value = i * ((int) Math.random());

15. Integer intObj = new Integer(value);

16. numbers.add(intObj);

17. }

18. System.out.println(numbers);

19. }

Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for

garbage collection?

A. Line 16

B. Line 17

C. Line 18

D. Line 19

E. The object is NOT a candidate for garbage collection.

Answer: D


Q59. Given:

11. public class ItemTest {

12. private final int id;

13. public ItemTest(int id) { this.id = id; }

14. public void updateId(int newId) { id = newId; }

15.

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

17. ItemTest fa = new ItemTest(42);

18. fa.updateId(69);

19. System.out.println(fa.id);

20. }

21. }

What is the result?

A. Compilation fails.

B. An exception is thrown at runtime.

C. The attribute id in the ItemTest object remains unchanged.

D. The attribute id in the ItemTest object is modified to the new value.

E. A new ItemTest object is created with the preferred value in the id attribute.

Answer: A


Q60. Given:

1. public class Boxer1{

2. Integer i;

3. int x;

4. public Boxer1(int y) {

5. x = i+y;

6. System.out.println(x);

7. }

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

9. new Boxer1(new Integer(4));

10. }

11. }

What is the result?

A. The value "4" is printed at the command line.

B. Compilation fails because of an error in line 5.

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

D. A NullPointerException occurs at runtime.

E. A NumberFormatException occurs at runtime.

F. An IllegalStateException occurs at runtime.

Answer: D