DRAG DROP
Select and Place:

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);Given:
11.
public static Collection get() {
12.
Collection sorted = new LinkedList();
13.
sorted.add("B"); sorted.add("C"); sorted.add("A");
14.
return sorted;
15.
}
16.
public static void main(String[] args) {
17.
for (Object obj: get()) {
18.
System.out.print(obj + ", ");
19.
}
20.
}
What is the result?
A. A, B, C,Given:
11.
String test = "a1b2c3";
12.
String[] tokens = test.split("\\d");
13.
for(String s: tokens) System.out.print(s + " ");
What is the result?
A. a b cGiven:
3.
class Employee {
4.
String name; double baseSalary;
5.
Employee(String name, double baseSalary) {
6.
this.name = name;
7.
this.baseSalary = baseSalary;
8.
}
9.
}
10.
public class SalesPerson extends Employee {
11.
double commission;
12.
public SalesPerson(String name, double baseSalary, double commission) {
13.
// insert code here
14.
}
15.
}
Which two code fragments, inserted independently at line 13, will compile? (Choose two.)
A. super(name, baseSalary);Given that:
Gadget has-a Sprocket and Gadget has-a Spring and Gadget is-a Widget and Widget has-a Sprocket
Which two code fragments represent these relationships? (Choose two.)
A. class Widget { Sprocket s; } class Gadget extends Widget { Spring s; }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);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 couplingDRAG DROP
Select and Place:

Click the Exhibit button. Given:
25.
A a = new A();
26.
System.out.println(a.doit(4, 5)); What is the result?

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Oracle exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 1Z0-851 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.