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

    Given:

    String s = new String("3");

    System.out.print(1 + 2 + s + 4 + 5);

    What is the result?

    A. 12345
    B. 3345
    C. 1239
    D. 339
    E. Compilation fails.

  • Question 82:

    Given:

    import java.util.Map;

    import java.util.Set;

    import java.util.TreeMap;

    public class MapClass {

    public static void main(String[] args) {

    Map partList = new TreeMap<>();

    partList.put("P002", "Large Widget");

    partList.put("P001", "Widget");

    partList.put("P002", "X-Large Widget");

    Set keys = partList.keySet();

    for (String key:keys) {

    System.out.println(key + " " + partList.get(key));

    }

    }

    }

    What is the result?

    A. p001 Widget p002 X-Large Widget
    B. p002 Large Widget p001 Widget
    C. p002 X-large Widget p001 Widget
    D. p001 Widget p002 Large Widget
    E. compilation fails

  • Question 83:

    Given the code fragment:

    public class Employee {

    String name;

    transient String companyName;

    }

    public class Manager extends Employee implements Serializable {

    String mgrId;

    public static void main(String s[]) throws Exception {

    Manager mgr = new Manager();

    What is the result?

    A. M001, ,
    B. M001, null, null
    C. M001, Sam,
    D. M001, Sam, null
    E. M001, Sam, ABC Inc
    F. Compilation fails
    G. A NullPointerException is thrown at runtime

  • Question 84:

    Given the code fragment:

    public class DisplaValues {

    public void printNums (int [] nums){

    for (int number: nums) { System.err.println(number);

    }

    }

    }

    Assume the method printNums is passed a valid array containing data. Why is this method not producing output on the console?

    A. There is a compilation error.
    B. There is a runtime exception.
    C. The variable number is not initialized.
    D. Standard error is mapped to another destination.

  • Question 85:

    Given:

    1.

    interface Writable {

    2.

    void write (String s);

    3.

    }

    4 .

    5.

    abstract class Writer implements Writable {

    6.

    // Line ***

    7.

    }

    Which two statements are true about the writer class?

    A. It compiles without any changes.
    B. It compiles if the code void write (String s); is added at line ***.
    C. It compiles if the code void write (); is added at line ***.
    D. It compiles if the code void write (string s) { } is added at line ***.
    E. It compiles if the code write () {} is added at line ***.

  • Question 86:

    The two methods of code reuse that aggregate the features located in multiple classes are ____________ .

    A. Inheritance
    B. Copy and Paste
    C. Composition
    D. Refactoring
    E. Virtual Method Invocation

  • Question 87:

    Given:

    class InvalidAgeException extends IllegalArgumentException { }

    public class Tracker {

    void verify (int age) throws IllegalArgumentException {

    if (age < 12)

    throw new InvalidAgeException ();

    if (age >= 12 andand age <= 60)

    System.out.print("General category");

    else

    System.out.print("Senior citizen category");

    }

    public static void main(String[] args) {

    int age = Integer.parseInt(args[1]);

    try {

    new Tracker().verify(age);

    }

    catch (Exception e) {

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

    }

    }

    }

    And the command-line invocation:

    Java Tracker 12 11

    What is the result?

    A. General category
    B. class invalidAgeException
    C. class java.lang.IllegalArgumentntException
    D. class java.lang.RuntimeException

  • Question 88:

    Given the code fragment:

    String query = "SELECT ID FROM Employee";

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

    ResultSet rs = stmt.executeQuery(query);

    stmt.executeQuery("SELECT ID FROM Customer"); // Line ***

    while (rs.next()) {

    // process the results

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

    }

    } catch (Exception e) {

    System.err.println ("Error");

    }

    Assume that the SQL queries return records.

    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 ***

  • Question 89:

    A valid reason to declare a class as abstract is to:

    A. define methods within a parent class, which may not be overridden in a child class
    B. define common method signatures in a class, while forcing child classes to contain unique method implementations
    C. prevent instance variables from being accessed
    D. prevent a class from being extended
    E. define a class that prevents variable state from being stored when object Instances are serialized
    F. define a class with methods that cannot be concurrently called by multiple threads

  • Question 90:

    Given:

    interface Event {

    String type = "Event";

    public void details();

    }

    class Quiz {

    static String type = "Quiz";

    }

    public classPracticeQuiz extends Quiz implements Event {

    public void details() {

    System.out.print(type);

    }

    public static void main(String[] args) {

    new PracticeQuiz().details();

    System.out.print(" " + type);

    }

    }

    What is the result?

    A. Event Quiz
    B. Event Event
    C. Quiz Quiz
    D. Quiz Event
    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.