We provide real 1Z0-851 exam questions and answers braindumps in two formats. Download PDF & Practice Tests. Pass Oracle 1Z0-851 Exam quickly & easily. The 1Z0-851 PDF type is available for reading and printing. You can print more and practice many times. With the help of our Oracle 1Z0-851 dumps pdf and vce product and material, you can easily pass the 1Z0-851 exam.


♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1Z0-851 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1Z0-851 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1Z0-851-exam-dumps.html

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


Q32. DRAG DROP

Click the Task button.

Answer:


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


Q34. DRAG DROP

Click the Task button.

Answer:


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


Q36. Given:

3. interface Animal { void makeNoise(); }

4. class Horse implements Animal {

5. Long weight = 1200L;

6. public void makeNoise() { System.out.println("whinny"); }

7. }

8. public class Icelandic extends Horse {

9. public void makeNoise() { System.out.println("vinny"); }

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

11. Icelandic i1 = new Icelandic();

12. Icelandic i2 = new Icelandic();

13. Icelandic i3 = new Icelandic();

14. i3 = i1; i1 = i2; i2 = null; i3 = i1;

15. }

16. }

When line 15 is reached, how many objects are eligible for the garbage collector?

A. 0

B. 1

C. 2

D. 3

E. 4

F. 6

Answer: E


Q37. Given a method that must ensure that its parameter is not null:

11. public void someMethod(Object value) {

12. // check for null value ...

20. System.out.println(value.getClass());

21. }

What, inserted at line 12, is the appropriate way to handle a null value?

A. assert value == null;

B. assert value != null, "value is null";

C. if (value == null) {

throw new AssertionException("value is null");

}

D. if (value == null) {

throw new IllegalArgumentException("value is null"); }

Answer: D


Q38. Given:

5. class Thingy { Meter m = new Meter(); }

6. class Component { void go() { System.out.print("c"); } }

7. class Meter extends Component { void go() { System.out.print("m"); } }

8.

9. class DeluxeThingy extends Thingy {

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

11. DeluxeThingy dt = new DeluxeThingy();

12. dt.m.go();

13. Thingy t = new DeluxeThingy();

14. t.m.go();

15. }

16. }

Which two are true? (Choose two.)

A. The output is mm.

B. The output is mc.

C. Component is-a Meter.

D. Component has-a Meter.

E. DeluxeThingy is-a Component.

F. DeluxeThingy has-a Component.

Answer: AF


Q39. Given:

5. class Payload {

6. private int weight;

7. public Payload (int w) { weight = w; }

8. public void setWeight(int w) { weight = w; }

9. public String toString() { return Integer.toString(weight); }

10. }

11. public class TestPayload {

12. static void changePayload(Payload p) { /* insert code */ }

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

14. Payload p = new Payload(200);

15. p.setWeight(1024);

16. changePayload(p);

17. System.out.println("p is " + p);

18. } }

Which code fragment, inserted at the end of line 12, produces the output p is 420?

A. p.setWeight(420);

B. p.changePayload(420);

C. p = new Payload(420);

D. Payload.setWeight(420);

E. p = Payload.setWeight(420);

Answer: A


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