1Z0-804 Exam Details

  • Exam Code
    :1Z0-804
  • Exam Name
    :Java SE 7 Programmer II
  • Certification
    :Oracle Certifications
  • Vendor
    :Oracle
  • Total Questions
    :150 Q&As
  • Last Updated
    :Dec 08, 2021

Oracle 1Z0-804 Online Questions & Answers

  • Question 41:

    Given the code fragment:

    String s = "Java 7, Java 6";

    Pattern p = Pattern.compile("Java.+\\d");

    Matcher m = p.matcher(s);

    while (m.find()) {

    System.out.println(m.group());

    }

    What is the result?

    A. Java 7
    B. Java 6
    C. Java 7, Java 6
    D. Java 7 java 6
    E. Java

  • Question 42:

    Given the code fragment:

    1.

    Thread t1 = new Thread ();

    2.

    t1.start ()

    3.

    t1.join ( );

    4.

    // . . .

    Which three are true?

    A. On line 3, the current thread stops and waits until the t1 thread finishes.
    B. On line 3, the t1 thread stops and waits until the current thread finishes.
    C. On line 4, the t1 thread is dead.
    D. On line 4, the t1 thread is waiting to run.
    E. This code cannot throw a checked exception.
    F. This code may throw a checked exception.

  • Question 43:

    Given:

    interface Rideable {

    String ride() ;

    }

    class Horse implements Rideable {

    String ride() { return "cantering "; }

    }

    class Icelandic extends Horse {

    String ride() { return "tolting "; }

    }

    class Test {

    public static void main(String[] args) {

    Rideable r1 = new Icelandic();

    Rideable r2 = new Horse();

    Horse h1 = new Icelandic();

    System.out.println(r1.ride() + r2.ride() + h1.ride());

    }

    }

    What is the result?

    A. tolting cantering cantering
    B. cantering cantering cantering
    C. compilation fails
    D. an exception is thrown at runtime

  • Question 44:

    Given that myFile.txt contains:

    First

    Second

    Third

    And given:

    import java.io.BufferedReader;

    import java.io.FileReader;

    import java.io.IOException;

    public class ReadFile04 {

    public static void main(String[] args) {

    try (BufferedReader buffIn =

    new BufferedReader(new FileReader("D:\\faculty\\myfile.txt"))) {

    String line = "";

    int count = 1;

    buffIn.mark(1);

    line = buffIn.readLine();

    System.out.println(count + ": " + line);

    line = buffIn.readLine();

    count++;

    System.out.println(count + ": " + line);

    buffIn.reset();

    line = buffIn.readLine();

    count++;

    System.out.println(count + ": " + line);

    } catch (IOException e) {

    System.out.println("IOException");

    }

    }

    }

    What is the result?

    A. 1: First 2: Second 3: Third
    B. 1 : First 2: Second 3: First
    C. 1: First 2: First 3: First
    D. IOExcepton
    E. Compilation fails

  • Question 45:

    Given:

    What is the result?

    A. John Adams George Washington Thomas Jefferson
    B. George Washington John Adams Thomas Jefferson
    C. Thomas Jefferson John Adams George Washington
    D. An exception is thrown at runtime
    E. Compilation fails

  • Question 46:

    For which three objects must a vendor provide implementations in its JDBC driver?

    A. Time
    B. Date
    C. Statement
    D. ResultSet
    E. Connection
    F. SQLException
    G. DriverManager

  • Question 47:

    Given the code fragment:

    try {

    String query = "SELECT * FROM Employee WHERE ID=110";

    Statement stmt = conn.createStatement();

    ResultSet rs = stmt.executeQuery(query);

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

    } catch (Exception se) {

    System.out.println("Error");

    }

    Assume that the SQL query matches one record. What is the result of compiling and executing this code?

    A. The code prints Error.
    B. The code prints the employee ID.
    C. Compilation fails due to an error at line 13.
    D. Compilation fails due to an error at line 14.

  • Question 48:

    Given:

    import java.io.File;

    import java.nio.file.Path;

    public class Test12 {

    static String displayDetails(String path, int location) {

    Path p = new File(path).toPath();

    String name = p.getName(location).toString();

    return name;

    }

    public static void main(String[] args) {

    String path = "project//doc//index.html";

    String result = displayDetails(path,2);

    System.out.print(result);

    }

    }

    What is the result?

    A. doc
    B. index.html
    C. an IllegalArgumentException is thrown at runtime.
    D. An InvalidPthException is thrown at runtime.
    E. Compilation fails.

  • Question 49:

    What are two differences between Callable and Runnable?

    A. A callable can return a value when executing, but a Runnable cannot.
    B. A callable can be executed by a ExecutorService, but a Runnable cannot.
    C. A Callable can be passed to a Thread, but a Runnable cannot.
    D. A callable can throw an Exception when executing, but a Runnable cannot.

  • Question 50:

    Given:

    public class StringSplit01 {

    public static void main(String[] args) {

    String names = "John-.-George-.-Paul-.-Ringo";

    String[] results = names.split("-. .");

    for(String str:results) {

    System.out.println(str);

    }

    }

    }

    What is the result?

    A. John?. -George-. ?Paul -. ?Ringo
    B. John George Paul Ringo
    C. John George Paul Ringo
    D. An exception is thrown at runtime
    E. Compilation fails

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