Free Oracle 1Z0-809 Exam Questions

Absolute Free 1Z0-809 Exam Practice for Comprehensive Preparation 

  • Oracle 1Z0-809 Exam Questions
  • Provided By: Oracle
  • Exam: Java SE 8 Programmer II
  • Certification: Oracle Java
  • Total Questions: 469
  • Updated On: Nov 11, 2024
  • Rated: 4.9 |
  • Online Users: 938
Page No. 1 of 94
Add To Cart
  • Question 1
    • Given structure of EMPLOYEE table: 

      EMPLOYEE (ID integer, FIRSTNAME varchar(100), LASTNAME varchar(100), SALARY real, PRIMARY KEY (ID)) 

      EMPLOYEE table contains below records: 

      1. 101 John Smith 12000

      2. 102 Sean Smith 15000

      3. 103 Regina Williams 15500

      4. 104 Natasha George 14600

      Given code of Test.java file: 

      1. package com.udayan.ocp;

      2.  

      3. import java.sql.*;

      4. import java.util.Properties;

      5.  

      6. public class Test {

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

      8.         String url = "jdbc:mysql://localhost:3306/ocp";

      9.         Properties prop = new Properties();

      10.         prop.put("user", "root");

      11.         prop.put("password", "password");

      12.         String query = "Select ID, FIRSTNAME, LASTNAME, SALARY FROM EMPLOYEE ORDER BY ID";

      13.         try (Connection con = DriverManager.getConnection(url, prop);

      14.              Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

      15.              ResultSet rs = stmt.executeQuery(query);)

      16.         {

      17.             rs.afterLast();

      18.             rs.relative(-1);

      19.             rs.previous();

      20.             System.out.println(rs.getInt(1));

      21.         }

      22.     }

      23. }

      Also assume: 

      URL, username and password are correct.

      SQL query is correct and valid.

      The JDBC 4.2 driver jar is configured in the classpath.

      What will be the result of compiling and executing Test class? 


      Answer: A
  • Question 2
    • Given the code fragment:
      public class FileThread implements Runnable {
       String fName;
       public FileThread(String fName) { this.fName = fName; }
       public void run () System.out.println(fName);}
       public static void main (String[] args) throws IOException,
      InterruptedException {
       ExecutorService executor = Executors.newCachedThreadPool();
       Stream<Path> listOfFiles = Files.walk(Paths.get(“Java Projects”));
       listOfFiles.forEach(line -> {
       executor.execute(new FileThread(line.getFileName().toString()));
       //
      line n1
       });
       executor.shutdown();
       executor.awaitTermination(5, TimeUnit.DAYS); //
      line n2
       }
      }
      The Java Projects directory exists and contains a list of files.
      What is the result?

      Answer: B
  • Question 3
    • Given code of Test.java file: 

      1. package com.udayan.ocp;

      2.  

      3. import java.util.List;

      4. import java.util.Map;

      5. import java.util.stream.Collectors;

      6. import java.util.stream.Stream;

      7.  

      8. class Certification {

      9.     String studId;

      10.     String test;

      11.     int marks;

      12.  

      13.     Certification(String studId, String test, int marks) {

      14.         this.studId = studId;

      15.         this.test = test;

      16.         this.marks = marks;

      17.     }

      18.  

      19.     public String toString() {

      20.         return "{" + studId + ", " + test + ", " + marks + "}";

      21.     }

      22.  

      23.     public String getStudId() {

      24.         return studId;

      25.     }

      26.  

      27.     public String getTest() {

      28.         return test;

      29.     }

      30.  

      31.     public int getMarks() {

      32.         return marks;

      33.     }

      34. }

      35.  

      36. public class Test {

      37.     public static void main(String[] args) {

      38.         Certification c1 = new Certification("S001", "OCA", 87);

      39.         Certification c2 = new Certification("S002", "OCA", 82);

      40.         Certification c3 = new Certification("S001", "OCP", 79);

      41.         Certification c4 = new Certification("S002", "OCP", 89);

      42.         Certification c5 = new Certification("S003", "OCA", 60);

      43.         Certification c6 = new Certification("S004", "OCA", 88);

      44.  

      45.         Stream stream = Stream.of(c1, c2, c3, c4, c5, c6);

      46.         Map> map =

      47.                 stream.collect(Collectors.partitioningBy(s -> s.equals("OCA")));

      48.         System.out.println(map.get(true));

      49.     }

      50. }

      What will be the result of compiling and executing Test class?


      Answer: A
  • Question 4
    • Given code of Test.java file:

      1. package com.udayan.ocp;

      2.  

      3. interface Printer1 {

      4.     default void print() {

      5.         System.out.println("Printer1");

      6.     }

      7. }

      8.  

      9. class Printer2 {

      10.     public void print() {

      11.         System.out.println("Printer2");

      12.     }

      13. }

      14.  

      15. class Printer extends Printer2 implements Printer1 {

      16.  

      17. }

      18.  

      19. public class Test {

      20.     public static void main(String[] args) {

      21.         Printer printer = new Printer();

      22.         printer.print();

      23.     }

      24. }

      What will be the result of compiling and executing Test class?


      Answer: D
  • Question 5
    • Given the content of Operator.java, EngineOperator.java, and Engine.java files:

      1

      and the code fragment:

      2

      What is the result? 

      Answer: A
PAGE: 1 - 94
Add To Cart

© Copyrights DumpsEngine 2024. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the DumpsEngine.