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

    Which two demonstrate the valid usage of the keyword synchronized?

    A. interface ThreadSafe { synchronized void doIt(); }
    B. abstract class ThreadSafe { synchronized abstract void doIt(); }
    C. class ThreadSafe { synchronized static void soIt () {} }
    D. enum ThreadSafe { ONE, TWO, Three; Synchronized final void doIt () {} }

  • Question 22:

    Which represents part of a DAO design pattern?

    A. interface EmployeeDAO { int getID(); Employee findByID (int id); void update(); void delete(); }
    B. class EmployeeDAO { int getID() { return 0;} Employee findByID (int id) { return null;} void update () {} void delete () {} }
    C. class EmployeeDAO { void create (Employee e) {} void update (Employee e) {} void delete (int id) {} Employee findByID (int id) {return id} }
    D. interface EmployeeDAO { void create (Employee e); void update (Employee e); void delete (int id); Employee findByID (int id); }
    E. interface EmployeeDAO { void create (Connection c, Employee e); void update (Connection c, Employee e); void delete (Connection c, int id); Employee findByID (Connection c, int id); }

  • Question 23:

    Given: final class FinalShow { // Line 1 final String location; // Line 2 FinalShow(final String loc) { // Line 3 location = loc; // Line 4 } // Line 5 FinalShow(String loc, String title) { // Line 6 location = loc; // Line 7 loc = "unknown"; // Line 8 } // Line 9 } // Line 10 What is the result?

    A. Compilation succeeds.
    B. Compilation fails due to an error on line 1.
    C. Compilation fails due to an error on line 2.
    D. Compilation fails due to an error on line 3.
    E. Compilation fails due to an error on line 4.
    F. Compilation fails due to an error on line 8.

  • Question 24:

    Given:

    public class MarkOutOfBoundsException extends ArrayIndexOutOfBoundsException {

    public class Test {

    public void verify(int[] arr)

    throws ArrayIndexOutOfBoundsException {

    for (int i = 1; i <= 3; i++) {

    if(arr[i] > 100)

    throw new MarkOutOfBoundsException();

    System.out.println(arr[i]);

    }

    }

    public static void main(String[] args) {

    int[] arr = {105,78,56};

    try {

    new Test().verify(arr);

    } catch (ArrayIndexOutOfBoundsException |

    MarkOutOfBoundsException e) {

    System.out.print(e.getClass());

    }

    }

    }

    What is the result?

    A. Compilation fails.
    B. 78 class java.lang.Array.IndexOutOfBoundException
    C. class MarkOutOfBoundException
    D. class java.lang.arrayIndexOutOfBoundException

  • Question 25:

    Given:

    class Plant {

    abstract String growthDirection();

    }

    class Embryophyta extends Plant {

    String growthDirection() { return "Up " }

    }

    public class Garden {

    public static void main(String[] args) {

    Embryophyta e = new Embryophyta();

    Embryophyta c = new Carrot();

    System.out.print(e.growthDirection() +

    A. growthDirection()); } } What is the result?
    B. Up Down
    C. Up Up
    D. Up null
    E. Compilation fails
    F. An exception is thrown at runtime

  • Question 26:

    Given:

    class Product {

    private int id;

    public Product (int id) {

    this.id = id;

    }

    public int hashCode() {

    return id + 42;

    }

    public boolean equals (Object obj) {

    return (this == obj) ? true : super.equals(obj);

    }

    }

    public class WareHouse {

    public static void main(String[] args) {

    Product p1 = new Product(10);

    Product p2 = new Product(10);

    Product p3 = new Product(20);

    System.out.print(p1.equals(p2) + " ");

    System.out.print(p1.equals(p3) );

    }

    }

    What is the result?

    A. false false
    B. true false
    C. true true
    D. Compilation fails
    E. An exception is thrown at runtime

  • Question 27:

    An application is waiting for notification of changes to a tmp directory using the following code statements:

    Path dir = Paths.get("tmp")

    WatchKey key = dir.register (watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY) ; In the tmp directory, the user renames the file testA to testB, Which statement is true?

    A. The events received and the order of events are consistent across all platforms.
    B. The events received and the order of events are consistent across all Microsoft Windows versions.
    C. The events received and the order of events are consistent across all UNIX platforms.
    D. The events received and the order of events are platform dependent.

  • Question 28:

    Give:

    class Fibonacci extends RecursiveTask {

    final int n;

    Fibonacci(int n) { this.n = n; }

    Integer compute() {

    if (n <= 1)

    return n;

    Fibonacci f1 = new Fibonacci(n - 1);

    f1.fork();

    Fibonacci f2 = new Fibonacci(n - 2);

    return f2.compute() + f1.join(); // Line X

    }

    }

    Suppose that line X is replace with:

    return f1.join()+f2.compute() ; // Line X

    What is the likely result?

    A. The program produces the correct result, with similar performance to the original.
    B. The program produces the correct result, with performance degraded to the equivalent of being single-threaded.
    C. The program produces an incorrect result.
    D. The program goes into an infinite loop.
    E. An exception is thrown at runtime.
    F. The program produces the correct result, with better performance than the original.

  • Question 29:

    Given the incomplete pseudo-code for a fork/join framework application: submit(Data) { if(Data.size < SMALL_ENOUGH) { _________________(Data); // line x } else { List x = _________________(Data); // line Y for(Data d: x ______________(d); // line z } } And given the missing methods: process, submit, and splitInHalf Which three insertions properly complete the pseudo-code?

    A. Insert submit at line X.
    B. Insert splitInHalf at line X.
    C. Insert process at line X.
    D. Insert process at line Y.
    E. Insert splitInHalf at line Y.
    F. Insert process at line Z.
    G. Insert submit at line Z.

  • Question 30:

    Which two codes correctly represent a standard language locale code?

    A. ES
    B. FR
    C. U8
    D. Es
    E. fr
    F. u8

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.