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

    Given the integer implements comparable:

    import java.util.*;

    public class SortAndSearch2 {

    static final Comparator IntegerComparator =

    new Comparator() {

    public int compare (Integer n1, Integer n2) {

    return n2.compareTo(n1);

    }

    };

    public static void main(String args[]) {

    ArrayList list = new ArrayList<>();

    list.add (4);

    list.add (1);

    list.add (3);

    list.add (2);

    Collections.sort(list, null);

    System.out.println(Collections.binarySearch(list, 3));

    Collections.sort(list,IntegerComparator);

    System.out.println(Collections.binarySearch(list, 3));

    }

    }

    What is the result?

    A. 2
    B. 1
    C. 2
    D. 2
    E. 3

  • Question 112:

    Given:

    public class Counter {

    public static int getCount(String[] arr) {

    int count =0 ;

    for(String var:arr) {

    if(var!=null) count++;

    }

    return count;

    }

    public static void main(String[] args) {

    String[] arr =new String[4];

    arr[1] = "C";

    arr[2] = "";

    arr[3] = "Java";

    assert (getCount(arr) < arr.length);

    System.out.print(getCount(arr));

    }

    }

    And the commands:

    javac Counter.java

    java -ea Counter

    What is the result?

    A. 2
    B. 3
    C. NullPointException is thrown at runtime
    D. AssertionError is thrown at runtime
    E. Compilation fails

  • Question 113:

    Given:

    abstract class Boat {

    String doFloat() { return "floating"; }

    abstract void doDock();

    }

    class Sailboat extends Boat {

    public static void main(String[] args) {

    Boat b = new Sailboat(); // Line A

    Boat b2 = new Boat(); // Line B

    }

    String doFloat() { return "slow float"; } // Line C

    void doDock() { } // Line D

    }

    Which two are true about the lines labeled A through D?

    A. The code compiles and runs as is.
    B. If only line A is removed, the code will compile and run.
    C. If only line B is removed, the code will compile and run.
    D. If only line D is removed, the code will compile and run.
    E. Line C is optional to allow the code to compile and run.
    F. Line C is mandatory to allow the code to compile and run.

  • Question 114:

    Given a language code of fr and a country code of FR, which file name represents a rce bundle file name that is not the default?

    A. MessageBundle_fr_FR.properties
    B. MessageBundle_fr_FR.profile
    C. MessageBundle_fr_FR.xinl
    D. MessageBundle__fr__FR.Java
    E. MessageBundle__fr__FR.Locale

  • Question 115:

    Which is a factory method from the java.text.NumberFormat class?

    A. format (long number)
    B. getInstance()
    C. getMaxiraumFractionDigits ()
    D. getAvailableLocales ()
    E. isGroupingUsed()

  • Question 116:

    Which four are true about enums?

    A. An enum is typesafe.
    B. An enum cannot have public methods or fields.
    C. An enum can declare a private constructor.
    D. All enums implicitly implement Comparable.
    E. An enum can subclass another enum.
    F. An enum can implement an interface.

  • Question 117:

    Given:

    import java.util.Scanner;

    public class Painting {

    public static void main(String[] args) {

    String input = "Pastel, *Enamel, Fresco, *Gouache";

    Scanner s = new Scanner(input);

    A. useDelimiter(",\\s*"); while (s.hasNext()) { System.out.println(s.next()); } } } What is the result?
    B. Paste1 Ename1 Fresco Gouache
    C. Paste1 *Ename1 Fresco *Gouache
    D. Pastel Ename1 Fresco Gouache
    E. Pastel Ename1, Fresco Gouache

  • Question 118:

    Given:

    Which group of method is moved to a new class when implementing the DAO pattern?

    A. public in getId () public String getContractDetails () public Void setContractDetails(String contactDetails) public String getName () public void setName (String name)
    B. public int getId () public String getContractDetails() public String getName() public Person getPerson(int id) throws Exception
    C. public void setContractDetails(String contractDetails) public void setName(String name)
    D. public Person getPerson(int id) throws Exception public void createPerson(Person p) throws Exception public void deletePerson(int id) throws Exception public void updatePerson(Person p) throws Exception

  • Question 119:

    Given:

    import java.io.IOException;

    import java.io.file.Path;

    import java.io.file.Paths;

    public class Path12 {

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

    Path path = Paths.get("\\sales\\quarter\\..\\qtrlreport.txt");

    path.relativize(Paths.get("\\sales\\annualreport.txt"));

    if(path.endsWith("annualreport.txt")) {

    System.out.println(true);

    } else {

    System.out.println(false);

    }

    System.out.println(path);

    }

    }

    What is the result?

    A. false \sales\quarter\ . . \qtrlreport.txt
    B. false \quarter\ . . \qtrlreport.txt
    C. true . . \ . . \ . . \ annualreport.txt
    D. true \ . . \ . . \annualreport.txt

  • Question 120:

    Given the code fragment:

    If the file userguide.txt does not exist, what is the result?

    A. An empty file is created and success is printed.
    B. class java.io.FileNotFoundException.
    C. class java.io.IOException.
    D. class java.lang.Exception.
    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.