Exam Details

  • Exam Code
    :1Z0-809
  • Exam Name
    :Java SE 8 Programmer II
  • Certification
    :Oracle Database
  • Vendor
    :Oracle
  • Total Questions
    :207 Q&As
  • Last Updated
    :Oct 27, 2024

Oracle Oracle Database 1Z0-809 Questions & Answers

  • Question 171:

    Given the code fragment:

    List listVal = Arrays.asList("Joe", "Paul", "Alice", "Tom");

    System.out.println (

    // line n1

    );

    Which code fragment, when inserted at line n1, enables the code to print the count of string elements

    whose length is greater than three?

    A. listVal.stream().filter(x -> x.length()>3).count()

    B. listVal.stream().map(x -> x.length()>3).count()

    C. listVal.stream().peek(x -> x.length()>3).count().get()

    D. listVal.stream().filter(x -> x.length()>3).mapToInt(x -> x).count()

  • Question 172:

    Given the content of /resourses/Message.properties:

    welcome1="Good day!"

    and given the code fragment:

    Properties prop = new Properties ();

    FileInputStream fis = new FileInputStream ("/resources/Message.properties");

    prop.load(fis);

    System.out.println(prop.getProperty("welcome1"));

    System.out.println(prop.getProperty("welcome2", "Test"));//line n1

    System.out.println(prop.getProperty("welcome3"));

    What is the result?

    A. Good day! Test followed by an Exception stack trace

    B. Good day! followed by an Exception stack trace

    C. Good day! Test null

    D. A compilation error occurs at line n1.

  • Question 173:

    Which action can be used to load a database driver by using JDBC3.0?

    A. Add the driver class to the META-INF/services folder of the JAR file.

    B. Include the JDBC driver class in a jdbc.properties file.

    C. Use the java.lang.Class.forName method to load the driver class.

    D. Use the DriverManager.getDriver method to load the driver class.

  • Question 174:

    Given the code fragment:

    Path p1 = Paths.get("/Pics/MyPic.jpeg"); System.out.println (p1.getNameCount() + ":" + p1.getName(1) + ":" + p1.getFileName());

    Assume that the Pics directory does NOT exist. What is the result?

    A. An exception is thrown at run time.

    B. 2:MyPic.jpeg: MyPic.jpeg

    C. 1:Pics:/Pics/ MyPic.jpeg

    D. 2:Pics: MyPic.jpeg

  • Question 175:

    Given the code fragments:

    class MyThread implements Runnable {

    private static AtomicInteger count = new AtomicInteger (0);

    public void run () {

    int x = count.incrementAndGet();

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

    }

    }

    and

    Thread thread1 = new Thread(new MyThread());

    Thread thread2 = new Thread(new MyThread());

    Thread thread3 = new Thread(new MyThread());

    Thread [] ta = {thread1, thread2, thread3};

    for (int x= 0; x < 3; x++) {

    ta[x].start();

    }

    Which statement is true?

    A. The program prints 1 2 3 and the order is unpredictable.

    B. The program prints 1 2 3.

    C. The program prints 1 1 1.

    D. A compilation error occurs.

  • Question 176:

    Given the code fragment:

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

    BufferedReader br = new BufferedReader (new InputStremReader (System.in));

    System.out.print ("Enter GDP: ");

    //line 1

    }

    Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?

    A. int GDP = Integer.parseInt (br.readline());

    B. int GDP = br.read();

    C. int GDP = br.nextInt();

    D. int GDP = Integer.parseInt (br.next());

  • Question 177:

    Given the code fragment:

    Path source = Paths.get ("/data/december/log.txt");

    Path destination = Paths.get("/data"); Files.copy (source, destination);

    and assuming that the file /data/december/log.txt is accessible and contains:

    10-Dec-2014 - Executed successfully

    What is the result?

    A. A file with the name log.txt is created in the /data directory and the content of the /data/december/log.txt file is copied to it.

    B. The program executes successfully and does NOT change the file system.

    C. A FileNotFoundException is thrown at run time.

    D. A FileAlreadyExistsException is thrown at run time.

  • Question 178:

    Given:

    class Student {

    String course, name, city;

    public Student (String name, String course, String city) {

    this.course = course; this.name = name; this.city = city;

    }

    public String toString() {

    return course + ":" + name + ":" + city;

    }

    and the code fragment:

    List stds = Arrays.asList(

    new Student ("Jessy", "Java ME", "Chicago"),

    new Student ("Helen", "Java EE", "Houston"),

    new Student ("Mark", "Java ME", "Chicago"));

    stds.stream()

    .collect(Collectors.groupingBy(Student::getCourse))

    .forEach(src, res) -> System.out.println(scr));

    What is the result?

    A. [Java EE: Helen:Houston] [Java ME: Jessy:Chicago, Java ME: Mark:Chicago]

    B. Java EE Java ME

    C. [Java ME: Jessy:Chicago, Java ME: Mark:Chicago] [Java EE: Helen:Houston]

    D. A compilation error occurs.

  • Question 179:

    Given the code fragments:

    interface CourseFilter extends Predicate {

    public default boolean test (String str) {

    return str.equals ("Java");

    }

    }

    and

    List strs = Arrays.asList("Java", "Java EE", "Java ME");

    Predicate cf1 = s - > s.length() > 3;

    Predicate cf2 = new CourseFilter() { //line n1

    public boolean test (String s) {

    return s.contains ("Java");

    }

    };

    long c = strs.stream()

    .filter(cf1)

    .filter(cf2 //line n2

    .count();

    System.out.println(c);

    What is the result?

    A. 2

    B. 3

    C. A compilation error occurs at line n1.

    D. A compilation error occurs at line n2.

  • Question 180:

    Given:

    public class Emp {

    String fName;

    String lName;

    public Emp (String fn, String ln) {

    fName = fn;

    lName = ln;

    }

    public String getfName() { return fName; }

    public String getlName() { return lName; }

    }

    and the code fragment:

    List emp = Arrays.asList (

    new Emp ("John", "Smith"),

    new Emp ("Peter", "Sam"),

    new Emp ("Thomas", "Wale"));

    emp.stream()

    //line n1

    .collect(Collectors.toList());

    Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and

    then ascending order of lName?

    A. .sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing(Emp::getlName))

    B. .sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName))

    C. .map(Emp::getfName).sorted(Comparator.reserveOrder())

    D. .map(Emp::getfName).sorted(Comparator.reserveOrder().map(Emp::getlName).reserved

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-809 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.