Java SE 6 Programmer Certified Professional

Here you have the best Oracle 1z0-851 practice exam questions

  • You have 260 total questions to study from
  • Each page has 5 questions, making a total of 52 pages
  • You can navigate through the pages using the buttons at the bottom
  • This questions were last updated on October 28, 2025
  • This site is not affiliated with or endorsed by Oracle.
Question 1 of 260
Given:
public abstract class Shape {
private int x;
private int y;
public abstract void draw();
public void setAnchor(int x, int y) {
this.x = x;
this.y = y;
}
}
Which two classes use the Shape class correctly? (Choose two.)
    Correct Answer: B, E

Question 2 of 260
Given:
public class Barn {
public static void main(String[] args) {
new Barn().go("hi", 1);
new Barn().go("hi", "world", 2);
}
public void go(String... y, int x) {
System.out.print(y[y.length - 1] + " ");
}
}
What is the result?
    Correct Answer: D

Question 3 of 260
Given:
class Nav{
public enum Direction { NORTH, SOUTH, EAST, WEST }
}
public class Sprite{
// insert code here
}
Which code, inserted at line 14, allows the Sprite class to compile?
    Correct Answer: D

Question 4 of 260
Which statement is true about the classes and interfaces in the exhibit?
01. public interface A {
02. public void doSomething(String thing);
03. }
01. public class AImpl implements A {
02. public void doSomething(String msg) {}
03. }
01. public class B {
02. public A doit(){
03. //more code here
04. }
05. public String execute(){
06 //more code here
07 }
08. }
01. public class C extends B {
02. public AImpl doit(){
03. //more code here
04. }
05.
06. public Object execute() {
07. //more code here
08. }
09. }
    Correct Answer: C

Question 5 of 260
What is the result?
11. public class Person {
12. String name = "No name";
13. public Person(String nm) { name = nm; }
14. }
15.
16. public class Employee extends Person {
17. String empID = "0000";
18. public Employee(String id) { empID = id; }
19. }
20.
21. public class EmployeeTest {
22. public static void main(String[] args){
23. Employee e = new Employee("4321");
24. System.out.println(e.empID);
25. }
26. }
    Correct Answer: D