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

    Given the code fragment:

    public class App {

    public static void main (String [] args){

    Path path = Paths.get("C:\\education\\institute\\student\\report.txt");

    System.out.println("get.Name(0): %s", path.getName(0));

    System.out.println ("subpath(0, 2): %s", path.subpath (0, 2));}

    }

    What is the result?

    A. getName (0): C:\ subpath (0, 2): C:\education\report.txt
    B. getName(0): C:\ subpth(0, 2): C:\education
    C. getName(0): education subpath (0, 2): education\institute
    D. getName(0): education subpath(0, 2): education\institute\student
    E. getName(0): report.txt subpath(0, 2): insritute\student

  • Question 32:

    Which statement declares a generic class?

    A. public class Example < T >{ }
    B. public class { }
    C. public class Example { }
    D. public class Example (Generic){ }
    E. public class Example (G) { }
    F. public class Example { }

  • Question 33:

    How many Threads are created when passing task to an Executor instance?

    A. A new Thread is used for each task.
    B. A number of Threads equal to the number of CPUs Is used to execute tasks.
    C. A single Thread Is used to execute all tasks.
    D. A developer-defined number of Threads is used to execute tasks.
    E. A number of Threads determined by system load is used to execute tasks.
    F. The method used to obtain the Executor determines how many Threads are used to execute tasks.

  • Question 34:

    Given this error message when running your application:

    Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name MessageBundle, locale And given that the MessageBundle.properties file has been created, exists on your disk, and is properly formatted. What is the cause of the error message?

    A. The file is not in the environment path.
    B. The file is not in the classpath.
    C. The file is not in the javapath.
    D. You cannot use a file to store a ResourceBundle.

  • Question 35:

    Given:

    public class DoubleThread {

    public static void main(String[] args) {

    Thread t1 = new Thread() {

    public void run() {

    System.out.print("Greeting");

    }

    };

    Thread t2 = new Thread(t1); // Line 9

    t2.run();

    }

    }

    Which two are true?

    A. A runtime exception is thrown on line 9.
    B. No output is produced.
    C. Greeting is printed once.
    D. Greeting is printed twice.
    E. No new threads of execution are started within the main method.
    F. One new thread of execution is started within the main method.
    G. Two new threads of execution are started within the main method.

  • Question 36:

    To provide meaningful output for:

    System.out.print( new Item ()):

    A method with which signature should be added to the Item class?

    A. public String asString()
    B. public Object asString()
    C. public Item asString()
    D. public String toString()
    E. public object toString()
    F. public Item toString()

  • Question 37:

    Given:

    import java.util.concurrent.atomic.AtomicInteger;

    public class AtomicCounter {

    private AtomicInteger c = new AtomicInteger(0);

    public void increment() {

    // insert code here

    }

    }

    Which line of code, inserted inside the increment () method, will increment the value of c?

    A. c.addAndGet();
    B. c++;
    C. c = c+1;
    D. c.getAndIncrement ();

  • Question 38:

    Given:

    public class Test { Integer x; // line 2 public static void main(String[] args) { new Test().go(5); } void go(Integer i) { // line 6 System.out.print(x + ++i); // line 7 } } What is the result?

    A. 5
    B. 6
    C. An exception is thrown at runtime
    D. Compilation fails due to an error on line 6
    E. Compilation fails due to an error on line 7

  • Question 39:

    Given:

    public enum Direction {

    NORTH, EAST, SOUTH, WEST

    }

    Which statement will iterate through Direction?

    A. for (Direction d : Direction.values()){ // }
    B. for (Direction d : Direction.asList()){ // }
    C. for (Direction d : Direction.iterator()){ // }
    D. for (Direction d : Direction.asArray()){ // }

  • Question 40:

    Which two forms of abstraction can a programmer use in Java?

    A. enums
    B. interfaces
    C. primitives
    D. abstract classes
    E. concrete classes
    F. primitive wrappers

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.