Welcome to TestSimulate

Pass Your Next Certification Exam Fast!

Everything you need to prepare, learn & pass your certification exam easily.

365 days free updates. First attempt guaranteed success.

Oracle Java SE 8 Programmer II (1z0-809) Free Practice Test

Question 1
Which two reasons should you use interfaces instead of abstract classes? (Choose two.)

Correct Answer: A,C
Question 2
Given this code;

Which two are correct after this class is instantiated and tested?

Correct Answer: E,F
Question 3
Given:

What is the result?

Correct Answer: A
Question 4
Given:
class Book {
int id;
String name;
public Book (int id, String name) {
this.id = id;
this.name = name;
}
public boolean equals (Object obj) { //line n1
boolean output = false;
Book b = (Book) obj;
if (this.id = = b.id) {
output = true;
}
return output;
}
}
and the code fragment:
Book b1 = new Book (101, "Java Programing");
Book b2 = new Book (102, "Java Programing");
System.out.println (b1.equals(b2)); //line n2
Which statement is true?

Correct Answer: B
Question 5
Given the code fragment:
Path file = Paths.get ("courses.txt");
// line n1
Assume the courses.txt is accessible.
Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?

Correct Answer: A
Question 6
Given the code fragment:

Which two code fragments, when inserted at line n1 independently, result in the output PEEK: Unix?

Correct Answer: A,C
Question 7
Given:

and the code fragment:

Which two code fragments, when inserted at line n1 independently, enable the code to print TruckCarBike?

Correct Answer: A,C
Question 8
Which two statements are true about synchronization and locks? (Choose two.)

Correct Answer: C,D
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 9
Given:
public class Customer {
private String fName;
private String lName;
private static int count;
public customer (String first, String last) {fName = first, lName = last;
++count;}
static { count = 0; }
public static int getCount() {return count; }
}
public class App {
public static void main (String [] args) {
Customer c1 = new Customer("Larry", "Smith");
Customer c2 = new Customer("Pedro", "Gonzales");
Customer c3 = new Customer("Penny", "Jones");
Customer c4 = new Customer("Lars", "Svenson");
c4 = null;
c3 = c2;
System.out.println (Customer.getCount());
}
}
What is the result?

Correct Answer: A
Question 10
Given the structure of the Student table:
Student (id INTEGER, name VARCHAR)
Given the records from the STUDENT table:

Given the code fragment:

Assume that:
What is the result?

Correct Answer: C
Question 11
Given the content of /resourses/Message.properties:
welcome1="Good day!"
and given the code fragment:
Properties prop = new Properties ();
FileInputStream fis = new FileInputStream ("/resources/Message.properties"); prop.load(fis); System.out.println(prop.getProperty("welcome1")); System.out.println(prop.getProperty("welcome2", "Test"));//line n1 System.out.println(prop.getProperty("welcome3")); What is the result?

Correct Answer: C