Exam Details

  • Exam Code
    :1Z0-809
  • Exam Name
    :Java SE 8 Programmer II
  • Certification
    :Oracle Database
  • Vendor
    :Oracle
  • Total Questions
    :207 Q&As
  • Last Updated
    :Oct 27, 2024

Oracle Oracle Database 1Z0-809 Questions & Answers

  • Question 151:

    Given the code fragment:

    9.

    Connection conn = DriveManager.getConnection(dbURL, userName, passWord);

    10.

    String query = "SELECT id FROM Employee";

    11.

    try (Statement stmt = conn.createStatement()) {

    12.

    ResultSet rs = stmt.executeQuery(query);

    13.

    stmt.executeQuery("SELECT id FROM Customer");

    14.

    while (rs.next()) {

    15.

    //process the results

    16.

    System.out.println("Employee ID: "+ rs.getInt("id"));

    17.

    }

    18.

    } catch (Exception e) {

    19.

    System.out.println ("Error");

    20.

    }

    Assume that:

    The required database driver is configured in the classpath.

    The appropriate database is accessible with the dbURL, userName, and passWord exists.

    The Employee and Customer tables are available and each table has id column with a few records and the

    SQL queries are valid.

    What is the result of compiling and executing this code fragment?

    A. The program prints employee IDs.

    B. The program prints customer IDs.

    C. The program prints Error.

    D. compilation fails on line 13.

  • Question 152:

    Given the code fragment:

    List codes = Arrays.asList (10, 20);

    UnaryOperator uo = s -> s +10.0;

    codes.replaceAll(uo);

    codes.forEach(c -> System.out.println(c));

    What is the result?

    A. 20.0

    30.0

    B. 10

    C. A compilation error occurs.

    D. A NumberFormatException is thrown at run time.

  • Question 153:

    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?

    A. 0

    B. 2

    C. 3

    D. 4

    E. 5

  • Question 154:

    Given:

    Item table

    ID, INTEGER: PK

    DESCRIP, VARCHAR(100)

    PRICE, REAL

    QUANTITY< INTEGER

    And given the code fragment:

    9.

    try {

    10.

    Connection conn = DriveManager.getConnection(dbURL, username, password);

    11.

    String query = “Select * FROM Item WHERE ID = 110”;

    12.

    Statement stmt = conn.createStatement();

    13.

    ResultSet rs = stmt.executeQuery(query);

    14.

    while(rs.next()) {

    15.

    System.out.println(“ID: “ + rs.getInt(“Id”));

    16.

    System.out.println(“Description: “ + rs.getString(“Descrip”));

    17.

    System.out.println(“Price: “ + rs.getDouble(“Price”));

    18.

    System.out.println(Quantity: “ + rs.getInt(“Quantity”));

    19.

    }

    20.

    } catch (SQLException se) {

    21.

    System.out.println(“Error”);

    22.

    }

    Assume that: The required database driver is configured in the classpath. The appropriate database is accessible with the dbURL, userName, and passWord exists. The SQL query is valid.

    What is the result?

    A. An exception is thrown at runtime.

    B. Compilation fails.

    C. The code prints Error.

    D. The code prints information about Item 110.

  • Question 155:

    Given:

    class Worker extends Thread {

    CyclicBarrier cb;

    public Worker(CyclicBarrier cb) { this.cb = cb; }

    public void run () {

    try {

    cb.await();

    System.out.println("Worker...");

    } catch (Exception ex) { }

    }

    }

    class Master implements Runnable { //line n1

    public void run () {

    System.out.println("Master...");

    }

    }

    and the code fragment:

    Master master = new Master();

    //line n2

    Worker worker = new Worker(cb);

    worker.start();

    You have been asked to ensure that the run methods of both the Worker and Master classes are

    executed.

    Which modification meets the requirement?

    A. At line n2, insert CyclicBarrier cb = new CyclicBarrier(2, master);

    B. Replace line n1 with class Master extends Thread {

    C. At line n2, insert CyclicBarrier cb = new CyclicBarrier(1, master);

    D. At line n2, insert CyclicBarrier cb = new CyclicBarrier(master);

  • Question 156:

    Given:

    final class Folder { //line n1 //line n2 public void open () {

    System.out.print(“Open”);

    } } public class Test {

    public static void main (String [] args) throws Exception { try (Folder f = new Folder()) { f.open(); } } }

    Which two modifications enable the code to print Open Close? (Choose two.)

    A. Replace line n1 with: class Folder implements AutoCloseable {

    B. Replace line n1 with: class Folder extends Closeable {

    C. Replace line n1 with: class Folder extends Exception {

    D. At line n2, insert: final void close () { System.out.print("Close"); }

    E. At line n2, insert:

    public void close () throws IOException {

    System.out.print("Close");

    }

  • Question 157:

    You want to create a singleton class by using the Singleton design pattern. Which two statements enforce the singleton nature of the design? (Choose two.)

    A. Make the class static.

    B. Make the constructor private.

    C. Override equals() and hashCode() methods of the java.lang.Object class.

    D. Use a static reference to point to the single instance.

    E. Implement the Serializable interface.

  • Question 158:

    The data.doc, data.txt and data.xml files are accessible and contain text.

    Given the code fragment:

    Stream paths = Stream.of (Paths. get("data.doc"),

    Paths. get("data.txt"),

    Paths. get("data.xml"));

    paths.filter(s-> s.toString().endWith("txt")).forEach(

    s -> {

    try {

    Files.readAllLines(s)

    .stream()

    .forEach(System.out::println); //line n1

    } catch (IOException e) {

    System.out.println("Exception");

    }

    }

    );

    What is the result?

    A. The program prints the content of data.txt file.

    B. The program prints: Exception <> Exception

    C. A compilation error occurs at line n1.

    D. The program prints the content of the three files.

  • Question 159:

    Which statement is true about the DriverManager class?

    A. It returns an instance of Connection.

    B. it executes SQL statements against the database.

    C. It only queries metadata of the database.

    D. it is written by different vendors for their specific database.

  • Question 160:

    Given the code fragment:

    List nums = Arrays.asList (10, 20, 8):

    System.out.println (

    //line n1

    );

    Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the

    nums list?

    A. nums.stream().max(Comparator.comparing(a -> a)).get()

    B. nums.stream().max(Integer : : max).get()

    C. nums.stream().max()

    D. nums.stream().map(a -> a).max()

Tips on How to Prepare for the Exams

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-809 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.