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

    Give:

    public class Test {

    public static void main(String[] args) {

    String svar= "sports cars";

    svar.replace(svar,"convertibles");

    System.out.printf("There are %3$s %2$s and %d trucks.",5,svar,2+7);

    }

    }

    What is the result?

    A. There are 27 sports cars and 5 trucks
    B. There are 27 convertibles and 5 trucks
    C. There are 9 sports cars and 5 trucks
    D. There are 9 convertibles and 5 trucks
    E. IllegalFormatConversionException is thrown at runtime

  • Question 92:

    Given the following code fragment:

    public static void main(String[] args) {

    Connection conn = null;

    Deque myDeque = new ArrayDeque<>();

    myDeque.add("one");

    myDeque.add("two");

    myDeque.add("three");

    System.out.println(myDeque.remove());

    }

    What is the result?

    A. Three
    B. One
    C. Compilation fails
    D. The program runs, but prints no outout

  • Question 93:

    Given:

    interface Rideable {

    public String ride() { return "riding "; }

    }

    class Horse implements Rideable {

    public String ride() { return "cantering "; }

    }

    class Icelandic extends Horse implements Rideable {

    public 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. riding riding tolting
    B. riding riding cantering
    C. tolting cantering tolting
    D. tolting cantering cantering
    E. Compilation fails.
    F. An exception is thrown at runtime.

  • Question 94:

    Given two classes in separate files:

    package a.b;

    / / import statement

    public class parent

    child c = new child();

    package a.b.c;

    public class child{

    }

    Which two import statements can make the a.b.parent class compliable?

    A. import a.b.c.Parent;
    B. import a.b.c.Child;
    C. import a.b.c.*;
    D. import a.b.*;
    E. import a.*;

  • Question 95:

    Given:

    public abstract class Account {

    abstract void deposit (double amt);

    public abstract Boolean withdraw (double amt);

    }

    public class CheckingAccount extends Account {

    }

    What two changes, made independently, will enable the code to compile?

    A. Change the signature of Account to: public class Account.
    B. Change the signature of CheckingAccount to: public abstract CheckingAccount
    C. Implement private methods for deposit and withdraw in CheckingAccount.
    D. Implement public methods for deposit and withdraw in CheckingAccount.
    E. Change Signature of checkingAccount to: CheckingAccount implements Account.
    F. Make Account an interface.

  • Question 96:

    Given:

    public class Test {

    void display(String[] arr) {

    try {

    System.out.print(arr[2]);

    } catch(ArrayIndexOutOfBoundsException |

    NullPointerException e) {

    e = new Exception();

    throw e;

    }

    }

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

    try {

    String[] arr = {"Unix","Solaris",null};

    new Test().display(arr);

    } catch(Exception e) {

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

    }

    }

    }

    What is the result?

    A. Null
    B. class java.lang.ArraylndexOutOfBoundsException
    C. class java.lang.NullPointerException
    D. class java.lang.Exception
    E. Compilation fails.

  • Question 97:

    Given:

    class Deeper {

    public Number getDepth() {

    return 10;

    }

    }

    Which two classes correctly override the getDepth method?

    A. public class deep extends Deeper { protected integer getDepth(){ return 5; } }
    B. public class deep extends Deeper { public double getDepth() { return "5"; } }
    C. public class deep extends Deeper { public String getDepth () { } }
    D. public class deep extends Deeper { public Long getDepth (int d) { return 5L; } }
    E. public class deep extends Deeper { public short getDepth () { return 5; } }

  • Question 98:

    Given:

    From what threading problem does the program suffer?

    A. deadlock
    B. livelock
    C. starvation
    D. race condition

  • Question 99:

    Given:

    StringBuffer b = new StringBuffer("3");

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

    What is the result?

    A. 54321
    B. 9321
    C. 5433
    D. 933
    E. Output is Similar to: 9java.lang.StringBuffer@100490121.
    F. Compilation fails.

  • Question 100:

    ITEM Table

    *

    ID, INTEGER: PK

    *

    DESCRIP, VARCHAR(100)

    *

    PRICE, REAL

    *

    QUALITY, INTEGER

    And given the code fragment (assuming that the SQL query is valid):

    try {

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

    Statement stmt = conn.createStatement();

    ResultSet rs = stmt.executeQuery(query);

    while (rs.next ()) {

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

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

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

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

    }

    } catch (SQLException se) {

    System.out.println("Error");

    }

    What is the result of compiling and executing this code?

    A. An exception is thrown at runtime
    B. Compile fails
    C. The code prints Error
    D. The code prints information about Item 110

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.