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 11:

    Which method would you supply to a class implementing the Callable interface?

    A. callable ()
    B. executable ()
    C. call ()
    D. run ()
    E. start ()

  • Question 12:

    Given the code fragment:

    public class ReadFile01 {

    public static void main(String[] args) {

    String fileName = "myfile.txt";

    try (BufferedReader buffIn = // Line 4

    new BufferedReader(new FileReader(fileName))) {

    String line = ""; int count = 1;

    line = buffIn.readLine(); // Line 7

    do {

    line = buffIn.readLine();

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

    } while (line != null);

    } catch (IOException | FileNotFoundException e) {

    System.out.println("Exception: " + e.getMessage()); } } } What is the result, if the file myfile.txt does not exist?

    A. A runtime exception is thrown at line 4
    B. A runtime exception is thrown at line 7
    C. Creates a new file and prints no output
    D. Compilation fails

  • Question 13:

    Which code fragment demonstrates the proper way to handle JDBC resources?

    A. Try { ResultSet rs = stmt.executableQuery (query); statement stmt = con.createStatement(); while (rs.next()) (/* . . . */) } catch (SQLException e) {}
    B. Try {statement stmt = con.createStatement(); ResultSet rs = stmt.executableQuery (query); while (rs.next()) (/* . . . */) } catch (SQLException e) {}
    C. Try { statement stmt = con.createStatement(); ResultSet rs = stmt.executableQuery (query); while (rs.next()) (/* . . . */) } finally { rs.close(); stmt.close(); }
    D. Try { ResultSet rs = stmt.executableQuery (query); statement stmt = con.createStatement(); while (rs.next()) (/* . . . */) } finally { rs.close(); stmt.close(); }

  • Question 14:

    Given three resources bundles with these values set for menu1: (the default resource bundle in US English.)

    English US Resource Bundle

    Menu1 = small

    French Resource Bundle

    Menu1 = petit

    Chinese Resource Bundle

    Menu1 =

    And given the code fragment:

    Locale.setDefault(new Locale("es", "ES")); // Set default to Spanish and Spain

    Locale loc1 = Locale.getDefault();

    ResourceBundle message = ResourceBundle.getBundle("MessageBundle", loc1);

    System.out.println(message.getString("menu1"));

    What is the result?

    A. No message is printed
    B. Petit C.
    D. A runtime error is produced

  • Question 15:

    Given the code fragment:

    public class Base {

    BufferedReader br;

    String record;

    public void process() throws FileNotFoundException {

    br = new BufferedReader(new FileReader("manual.txt"));

    }

    }

    public class Derived extends Base {

    // insert code here. Line ***

    public static void main(String[] args) {

    try {

    new Derived().process();

    } catch (Exception e) { } }

    }

    Which code fragment inserted at line ***, enables the code to compile?

    A. public void process () throws FileNotFoundException, IOException { super.process (); while ((record = br.readLine()) != null) { System.out.println(record); } }
    B. public void process () throws IOException { super.process (); while ((record = br.readLine()) != null) { System.out.println(record); } }
    C. public void process () throws Exception { super.process (); while ((record = br.readLine()) != null) { System.out.println(record); } }
    D. public void process (){ try { super.process (); while ((record = br.readLine()) != null) { System.out.println(record); } } catch (IOException | FileNotFoundException e) { } }
    E. public void process (){ try { super.process (); while ((record = br.readLine()) != null) { System.out.println(record); } } catch (IOException e) {} }

  • Question 16:

    Given the cache class:

    public class Cache {

    private T t;

    public void setValue (T t) { this.t=t; }

    public T getValue() {return t; }

    }

    What is the result of the following?

    Cache<> c = new Cache(); // Line 1

    A. SetValue(100); // Line 2 System.out.print(c.getValue().intValue() +1); // Line 3
    B. 101
    C. Compilation fails at line 1.
    D. Compilation fails at line 2.
    E. Compilation fails at line 3.

  • Question 17:

    Which type of ExecutorService supports the execution of tasks after a fixed delay?

    A. DelayedExecutorService
    B. ScheduledExecutorService
    C. TimedExecutorService
    D. FixedExecutorService
    E. FutureExecutorService

  • Question 18:

    Which three statements are correct about thread's sleep method?

    A. The sleep (long) method parameter defines a delay in milliseconds.
    B. The sloop (long) method parameter defines a delay in microseconds.
    C. A thread is guaranteed to continue execution after the exact amount of time defined in the sleep (long) parameter.
    D. A thread can continue execution before the amount of time defined in the sleep (long) parameter.
    E. A thread can continue execution after the amount of time defined in the sleep(long) parameter
    F. Only runtime exceptions are thrown by the sleep method.
    G. A thread loses all object monitors (lock flags) when calling the sleep method.

  • Question 19:

    Given:

    class A {

    int a = 5;

    String doA() { return "a1"; }

    protected static String doA2 () { return "a2"; }

    }

    class B extends A {

    int a = 7;

    String doA() { return "b1"; }

    public static String doA2() { return "b2"; }

    void go() {

    A myA = new B();

    System.out.print(myA.doA() + myA.doA2() + myA.a);

    }

    public static void main (String[] args) { new B().go(); }

    }

    Which three values will appear in the output?

    A. 5
    B. 7
    C. a1
    D. a2
    E. b1
    F. b2

  • Question 20:

    Given:

    interface Books {

    //insert code here

    }

    Which fragment, inserted in the Books interface, enables the code to compile?

    A. public abstract String type; public abstract String getType();
    B. public static String type; public abstract String getType();
    C. public String type = "Fiction"; public static String getType();
    D. public String type = "Fiction"; public abstract String getType();

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.