Oracle 1Z0-809 Certification Sample Questions and Answers

1Z0-809 PDF, 1Z0-809 Dumps PDF Free Download, 1Z0-809 Dumps Free, 1Z0-809 Latest Dumps PDF, 1Z0-809 PDF Free DownloadThe Oracle 1Z0-809 Sample Question Set is designed to help you prepare for the Java SE 8 Programmer II (1Z0-809) certification exam. To become familiar with actual Oracle Certification exam environment, we suggest you to try Sample Oracle 1Z0-809 Certification Practice Exam.

This sample Oracle 1Z0-809 certification practice exam is designed for evaluation purposes only. If you really want to test your knowledge to identify your weak areas and familiarize with actual exam format, we suggest you to practice with Premium Oracle 1Z0-809 Certification Practice Exam for Java SE 8 Programmer II (1Z0-809) certification. Our team of Java experts have designed Questions-Answers for this premium practice exam by collecting inputs from recently certified candidates. Hence, We strongly recommend you to use Premium Oracle 1Z0-809 Certification Practice Exam to clear your actual Oracle 1Z0-809 Certification Exam with great score.

1Z0-809 Sample Questions:

01. What technique allows multiple variables from the same class to be shared across all instances of a class?
a) Encapsulation
b) Immutability
c) Singleton
d) Static
 
02. Given:
public abstract class Customer {
 private String name;
 public Customer (String name) {
 this.name = name;
 }
 public String getName() { return name; }
 public abstract void buy();
}
Which two statements are true about Customer?
a) The Customer class cannot be extended.
b) The Customer class cannot be instantiated.
c) Subclasses of Customer cannot override getName() method.
d) Concrete subclasses of Customer must use a default constructor.
e) Concrete subclasses of Customer must implement the buy() method.
f) Subclasses of Customer must implement the buy() method.
 
03. Given the code fragment:
class MyResource1 implements AutoCloseable {
 public void close() throws IOException {
 System.out.print("1 ");
 }
}
class MyResource2 implements Closeable {
 public void close() throws IOException {
 throw new IOException();
 }
}
public class TestRes {
 public static void main(String[] args) {
 try (MyResource1 r1 = new MyResource1();
 MyResource2 r2 = new MyResource2();) {
 System.out.print("T ");
 } catch (IOException ioe) {
 System.out.print("IOE ");
 } finally {
 System.out.print("F ");
 }
 }
}
What is the result?
a) T 1 IOE F
b) T IOE F
c) T IOE 1 F
d) Compilation fails.
 
04. Given the code fragment:
try (Connection con = DriverManager.getConnection(url, uname, pwd)) {
 Statement stmt = con.createStatement();
 System.out.print(stmt.executeUpdate("INSERT INTO Emp VALUES (500,'Murray')"));
}
Assuming the SQL query executes properly, what is the result?
a) true
b) false
c) 1
d) 0
 
05. Assuming that the TestResult.txt file exists and given the code fragment:
public class TestReadFile {
 public void readFile(String fName) throws IOException {
 // Line n1
 Stream<String> content = Files.lines(p);
 content.forEach(s1 -> System.out.println(s1));
 }
 public static void main(String[] args) throws IOException {
 TestReadFile trf = new TestReadFile();
 trf.readFile("TestResult.txt ");
 }
}
Which code fragment at Line n1 compiles?
a) Path p = new Path(fName);
b) Path p = Paths.get(fName);
c) Path p = Paths.toPath(fName);
d) Path p = Paths.get(new File(fName));
 
06. Given the code fragment:
 Queue<String> products = new ArrayDeque<String>();
 products.add("p1");
 products.add("p2");
 products.add("p3");
 System.out.print(products.peek());
 System.out.print(products.poll());
 System.out.println("");
 products.forEach(s -> System.out.print(s));
What is the result?
a) p1p1
p2p3
b) p1p2
p1p2p3
c) p1p2
p3
d) p1p1
p1p2p3
 
07. Given the code fragment:
public class TestFun {
 public static void main(String[] args) {
 List<Integer> nums = Arrays.asList(1,2,3,4,5);
 // Line n1
 }
}
Which code fragment can be inserted at Line n1 to enable the code to print 2 4?
a) nums.peek(n -> n%2 == 0)
 .forEach( s -> System.out.print(" "+s));
b) nums.filter(n -> n%2 == 0)
 .forEach( s -> System.out.print(" "+s));
c) nums.map(n -> n%2 == 0)
 .forEach( s -> System.out.print(" "+s));
d) nums.stream()
 .filter(n -> n%2 == 0)
 .forEach( s -> System.out.print(" "+s));
 
08. Given:
class Toy {
 double price;
 String color;
 Toy(String color, double price) {
 this.color = color;
 this.price = price;
 }
 public double getPrice() {
 return price;
 }
 public String getColor() {
 return color;
 }
}
And given the code fragment:
List<Toy> toys = new ArrayList<>();
toys.add(new Toy("red", 10));
toys.add(new Toy("yellow", 10));
toys.add(new Toy("red", 10));
double totalPrice = toys.stream()
 .filter(e -> e.getColor() == "red")
 /* Line n1 */
 .sum();
System.out.println("Total Price of Red Toys: " + totalPrice);
Which code fragment can be inserted at Line n1 to enable the code to print Total Price of Red Toys: 20.0?
a) .flatMap(e -> e.getPrice())
b) .mapToDouble(e -> e.getPrice())
c) .map(e -> e.getPrice())
d) .peek(e -> e.getPrice())
 
09. Which of the following statements are true, assuming a and b are String objects?
a) If a.equals(b) is true, a.hashCode() == b.hashCode() is always true.
b) If a.equals(b) is true, a.hashCode() == b.hashCode() is sometimes but not always true.
c) If a.equals(b) is false, a.hashCode() == b.hashCode() can never be true.
d) If a.equals(b) is false, a.hashCode() == b.hashCode() can sometimes be true.
 
10. Which class definition compiles?
a) class CallerThread1 implements Callable<String> {
 public String call() throws Exception { return "thread";}
 }
b) class CallerThread2 implements Callable {
 public void call() {}
 }
c) class CallerThread3 extends Callable {
 public void call() throws IOException {}
 }
d) class CallerThread4 implements Callable<String> {
 public String call(String s) { return "thread";}
 }
e) class CallerThread5 extends Callable<String> {
 public void callable(String s) throws Exception {}
 }

Solutions:

QUESTION: 01

Answer: d

QUESTION: 02

Answer: b, e

QUESTION: 03

Answer: a

QUESTION: 04

Answer: c

QUESTION: 05

Answer: b

QUESTION: 06

Answer: a

QUESTION: 07

Answer: d

QUESTION: 08

Answer: b

QUESTION: 09

Answer: d

QUESTION: 10

Answer: a

Rating: 4.9 / 5 (41 votes)