Free Oracle 1Z0-809 Exam Questions

Try our Free Demo Practice Tests for Comprehensive 1Z0-809 Exam Preparation

  • Oracle 1Z0-809 Exam Questions
  • Provided By: Oracle
  • Exam: Java SE 8 Programmer II
  • Certification: Oracle Java
  • Total Questions: 469
  • Updated On: Mar 28, 2025
  • Rated: 4.9 |
  • Online Users: 938
Page No. 1 of 94
Add To Cart
  • Question 1
    • Given the code fragment:
      9. Connection conn = DriveManager.getConnection(dbURL, userName, passWord);
      10. String query = “SELECT id FROM Employee”;
      11. try (Statement stmt = conn.createStatement()) {
      12. ResultSet rs = stmt.executeQuery(query);
      13. stmt.executeQuery(“SELECT id FROM Customer”);
      14. while (rs.next()) {
      15. //process the results
      16. System.out.println(“Employee ID: “+ rs.getInt(“id”));
      17. }
      18. } catch (Exception e) {
      19. System.out.println (“Error”);
      20. }
      Assume that:
       The required database driver is configured in the classpath.
       The appropriate database is accessible with the dbURL, userName, and passWord exists.
       The Employee and Customer tables are available and each table has id column with a few records and
      the SQL queries are valid.
      What is the result of compiling and executing this code fragment?


      Answer: C
  • Question 2
    • Given code of Test.java file: 

      1. package com.udayan.ocp;

      2.  

      3. import java.util.stream.Stream;

      4.  

      5. public class Test {

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

      7.         Stream stream = Stream.of("d", "cc", "bbb", "aaaa");

      8.         stream.sorted().forEach(System.out::println);

      9.     }

      10. }

      Which of the following needs to be done, so that output is: 

      d

      cc

      bbb

      aaaa


      Answer: B
  • Question 3
    • 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 4
    • Consider the code of Test.java file:

      1. package com.udayan.ocp;

      2.  

      3. class Player {

      4.     String name;

      5.     int age;

      6.  

      7.     Player() {

      8.         this.name = "Yuvraj";

      9.         this.age = 36;

      10.     }

      11.  

      12.     public String toString() {

      13.         return name + ", " + age;

      14.     }

      15.     

      16.     public Class getClass() { 

      17.         return super.getClass();

      18.     }

      19. }

      20.  

      21. public class Test {

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

      23.         System.out.println(new Player());

      24.     }

      25. }

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


      Answer: A
  • Question 5
    • What will be the result of compiling and executing class Test?

      1. package com.udayan.ocp;

      2.  

      3. class X {

      4.     class Y {

      5.         private void m() {

      6.             System.out.println("INNER");

      7.         }

      8.     }

      9.     

      10.     public void invokeInner() {

      11.         Y obj = new Y(); //Line 9

      12.         obj.m(); //Line 10

      13.     }

      14. }

      15.  

      16. public class Test {

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

      18.         new X().invokeInner();

      19.     }

      20. }


      Answer: C
PAGE: 1 - 94
Add To Cart

© Copyrights Dumpscity 2025. All Rights Reserved

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