Exam Code: 1Z0-851 (Practice Exam Latest Test Questions VCE PDF)
Exam Name: Java Standard Edition 6 Programmer Certified Professional Exam
Certification Provider: Oracle
Free Today! Guaranteed Training- Pass 1Z0-851 Exam.

2021 Aug 1z0-851 latest dumps free download:

Q71. A team of programmers is reviewing a proposed API for a new utility class. After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality. If they implement the new design, which two OO principles will they be promoting?

A. Looser coupling

B. Tighter coupling

C. Lower cohesion

D. Higher cohesion

E. Weaker encapsulation

F. Stronger encapsulation

Answer: A


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


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


Q74. DRAG DROP

Click the Task button.


Answer:


Q75. Given:

11. class Converter {

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

13. Integer i = args[0];

14. int j = 12;

15. System.out.println("It is " + (j==i) + " that j==i.");

16. }

17. }

What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?

A. It is true that j==i.

B. It is false that j==i.

C. An exception is thrown at runtime.

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

Answer: D


1Z0-851  free practice questions

Updated 1z0-851 book:

Q76. Given:

10. interface Jumper { public void jump(); } ...

20. class Animal {} ...

30. class Dog extends Animal {

31. Tail tail; 32. } ...

40. class Beagle extends Dog implements Jumper{

41. public void jump() {}

42. } ...

50. class Cat implements Jumper{

51. public void jump() {}

52. }

Which three are true? (Choose three.)

A. Cat is-a Animal

B. Cat is-a Jumper

C. Dog is-a Animal

D. Dog is-a Jumper

E. Cat has-a Animal

F. Beagle has-a Tail

G. Beagle has-a Jumper

Answer: BCF


Q77. Given:

1. public class Score implements Comparable<Score> {

2. private int wins, losses;

3. public Score(int w, int l) { wins = w; losses = l; }

4. public int getWins() { return wins; }

5. public int getLosses() { return losses; }

6. public String toString() {

7. return "<" + wins + "," + losses + ">";

8. }

9. // insert code here

10. }

Which method will complete this class?

A. public int compareTo(Object o){/*more code here*/}

B. public int compareTo(Score other){/*more code here*/}

C. public int compare(Score s1,Score s2){/*more code here*/}

D. public int compare(Object o1,Object o2){/*more code here*/}

Answer: B


Q78. Which Man class properly represents the relationship "Man has a best friend who is a Dog"?

A. class Man extends Dog { }

B. class Man implements Dog { }

C. class Man { private BestFriend dog; }

D. class Man { private Dog bestFriend; }

E. class Man { private Dog<bestFriend>; }

F. class Man { private BestFriend<dog>; }

Answer: D


Q79. Given:

10. class Line {

11. public class Point { public int x,y;}

12. public Point getPoint() { return new Point(); }

13. }

14. class Triangle {

15. public Triangle() {

16. // insert code here

17. }

18. }

Which code, inserted at line 16, correctly retrieves a local instance of a Point object?

A. Point p = Line.getPoint();

B. Line.Point p = Line.getPoint();

C. Point p = (new Line()).getPoint();

D. Line.Point p = (new Line()).getPoint();

Answer: D


Q80. DRAG DROP

Click the Task button.


Answer: