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

    Given:

    ConcurrentMap PartList = new ConcurrentMap<>();

    Which fragment puts a key/value pair in partList without the responsibility of overwriting an existing key?

    A. partList.out(key, "Blue Shirt");
    B. partList.putIfAbsent(key, "Blue Shirt");
    C. partList.putIfNotLocked (key, "Blue Shirt");
    D. partList.putAtomic(key, "Blue Shirt")
    E. if (!partList.containsKey(key)) partList.put (key, "Blue Shirt");

  • Question 62:

    Which two actions can be used in registering a JDBC 3.0 driver?

    A. Add the driver class to the META-INF/services folder of the JAR file.
    B. Set the driver class name by using the jdbc.drivers system property.
    C. Include the JDBC driver class in a jdbcproperties file.
    D. Use the java.lang.class.forName method to load the driver class.
    E. Use the DriverManager.getDriver method to load the driver class.

  • Question 63:

    Given:

    public class Test {

    public static void main(String[] args) {

    String[] arr = {"SE","ee","ME"};

    for(String var : arr) {

    try {

    switch(var) {

    case "SE":

    System.out.println("Standard Edition");

    break;

    case "EE":

    System.out.println("Enterprise Edition");

    break;

    default: assert false;

    }

    } catch (Exception e) {

    System.out.println(e.getClass()); }

    }

    }

    }

    And the commands:

    javac Test.java

    java -ea Test

    What is the result?

    A. Compilation fails
    B. Standard Edition Enterprise Edition Micro Edition
    C. Standard Edition class java.lang.AssertionError Micro Edition
    D. Standard Edition is printed and an Assertion Error is thrown

  • Question 64:

    View the exhibit: (*Missing*)

    Given the code fragment:

    class Finder extends SimpleFileVisitor {

    private final PathMatcher matcher;

    private static int numMatches = 0;

    Finder () {

    matcher = FileSystems.getDefault().getPathMatcher("glob:*java");

    }

    void find(Path file) {

    Path name = file.getFileName();

    if (name != null andand matcher.matches(name)) {

    numMatches++;

    }

    }

    void report()

    {

    System.out.println("Matched: " + numMatches);

    }

    @Override

    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)

    find(file);

    return CONTINUE;

    }

    }

    public class Visitor {

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

    Finder finder = new Finder();

    Files.walkFileTree(Paths.get("D:\\Project"), finder);

    finder.report();

    }

    }

    What is the result?

    A. Compilation fails
    B. 6
    C. 4
    D. 1
    E. 3
    F. Not possible to answer due to missing exhibit.

  • Question 65:

    Given:

    public class Dog {

    protected String bark() {return "woof "; }

    }

    public class Beagle extends Dog {

    private String bark() { return "arf "; }

    }

    public class TestDog {

    public static void main(String[] args) {

    Dog[] dogs = {new Dog(), new Beagle()};

    for(Dog d: dogs)

    System.out.print(d.bark());

    }

    }

    What is the result?

    A. woof arf
    B. woof woof
    C. arf arf
    D. A RuntimeException is generated
    E. The code fails to compile

  • Question 66:

    Given:

    Deque myDeque = new ArrayDeque();

    myDeque.push("one");

    myDeque.push("two");

    myDeque.push("three");

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

    What is the result?

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

  • Question 67:

    Given:

    What two changes should you make to apply the DAO pattern to this class?

    A. Make the Customer class abstract.
    B. Make the customer class an interface.
    C. Move the add, delete, find, and update methods into their own implementation class.
    D. Create an interface that defines the signatures of the add, delete, find, and update methods.
    E. Make the add, delete, and find, and update methods private for encapsulation.
    F. Make the getName and getID methods private for encapsulation.

  • Question 68:

    Given the class?

    public class Name implements Comparable {

    String first, last;

    public Name(String first, String last) {

    this.first = first;

    this.last = last;

    }

    public int compareTo (Name n) {

    int cmpLast = last.compareTo(n.last);

    return cmpLast != 0 ? cmpLast : first.compareTo(n.first);

    }

    public String toString() {

    return first + " " + last;

    }

    }

    and the code fragment:

    ArrayList list = new ArrayList();

    list.add (new Name("Joe","Shmoe"));

    list.add (new Name("John","Doe"));

    list.add (new Name("Jane","Doe"));

    Collections.sort(list);

    for (Name n : list) {

    System.out.println(n);

    }

    What is the result?

    A. Jane Doe John Doe Joe Shmoe
    B. John Doe Jane Doe Joe Shmoe
    C. Joe Shmoe John Doe Jane Doe
    D. Joe Shmoe Jane Doe John Doe
    E. Jane Doe Joe Shmoe John Doe
    F. John Doe Joe Shmoe Jane Doe

  • Question 69:

    Given:

    public class Runner {

    public static String name = "unknown";

    public void start() {

    System.out.println(name);

    }

    public static void main(String[] args) {

    name = "Daniel";

    start();

    }

    }

    What is the result?

    A. Daniel
    B. Unknown
    C. It may print "unknown" or "Daniel" depending on the JVM implementation.
    D. Compilation fails.
    E. An exception is thrown at runtime.

  • Question 70:

    Which code fragment is required to load a JDBC 3.0 driver?

    A. DriverManager.loadDr iver ("org.xyzdata.jdbc.NetworkDriver");
    B. Class.forName("org.xyzdata.jdbc-NetworkDriver");
    C. Connection con = Connection.getDriver ("jdbc:xyzdata://localhost:3306/EmployeeDB");
    D. Connection con = DriverManager.getConnection ("jdbc:xyzdata://localhost:3306/EmployeeDB");

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.