Oracle Certified Associate Java Se 8 Programmer Exam Questions & Answers

Practice 56 free Oracle Certified Associate Java Se 8 Programmer exam questions with answers and community-discussed explanations. Each question has its own page where you can reveal the correct answer and debate it in the comments.

All 56 questions

  1. Q1 Consider the code:public class Test { public static void m1() { System.out.print("A"); try { System.out.print("B"); System.out.print(10/0); } catch (ArithmeticException e) { System.out.print("C");…
  2. Q2 //ArrayProcessTest.javapublic class ArrayProcessTest {    public static void main(String[] args) {        int[] arr = {0, 1, 2, 3, 4,…
  3. Q3 public class OperatorTest {    public static void main(String[] args) {        int x = 5;        boolean…
  4. Q4 For the class Test, which options, if used to replace /*INSERT*/, will print "Hurrah! I passed..." on to the console? Select 2…
  5. Q5 What will be the result of compiling and executing the following program?public class Main {    public static void main(String[] args) { …
  6. Q6 Which of the following declarations are valid ?
  7. Q7 Which of the following are valid in overriding ?
  8. Q8 Consider the code:public class Test{ public static void main(String[] args) { int x =10; int y =0; switch(x) { case 10: y++;…
  9. Q9 import java.util.function.Predicate;public class PredicateTest {    public static void main(String[] args) {        String[] arr = {"A", "ab", "bab", "Aa",…
  10. Q10 What will be the result of compiling and executing RoomColorTest class?public class RoomColorTest {    public static void main(String[] args) {   …
  11. Q11 Consider the code:public class Test { public static void main(String[] args) { System.out.print("A"); try { System.out.print("B"); System.out.print(10/0); } catch (ArithmeticException e) {…
  12. Q12 Consider the code:public class Test { public static void main(String[] args) { StringBuilder sb = new StringBuilder(); sb.append("durga"); sb.deleteCharAt(0); sb.delete(1,3); System.out.println(sb); }}What…
  13. Q13 What will be the result of compiling and executing Circus //Circus.javapackage com.udayan.oca; class Animal {     protected void jump() {         System.out.println("Animal");     }} class Cat extends…
  14. Q14 What will be the result of compiling and executing Test class?package com.udayan.oca; public class Test {     public static void main(String[] args) {         System.out.println("Output…
  15. Q15 What will be the result of compiling and executing Test class? package com.udayan.oca; import java.util.ArrayList;import java.util.List; public class Test {     public static void main(String[]…
  16. Q16 //DateParseTest.javaimport java.time.LocalDate;public class DateParseTest {    public static void main(String[] args) {        LocalDate date = LocalDate.parse("2018-1-01");       …
  17. Q17 class AcademicRecord {    String studentName;    int score;    AcademicRecord(String studentName, int score) {        this.studentName = studentName;   …
  18. Q18 public class NumberTest {    public static void main(String[] args) {        int a = 3;        modifyValues(++a,…
  19. Q19 Given code of Test.java file: package com.udayankhattry.oca; public class Test { public static void main(String[] args) { try { //outer try { //inner…
  20. Q20 Given code: package com.udayan.oca; public class Test {     public static void main(String[] args) {         Boolean b1 = new Boolean("tRuE");         Boolean b2 = new Boolean("fAlSe");…
  21. Q21 public class ArrayByteTest { public static void main(String[] args) { byte[] values = new byte[]{20, 30}; values[0] = 15; values[1] = 25;…
  22. Q22 Consider below code fragment: private void emp() {}And the statements:1. Given code compiles successfully if it is used inside the class named…
  23. Q23 What will be the result of compiling and executing Test class? package com.udayan.oca; public class Test {     public static void main(String[] args) {…
  24. Q24 Consider below code:  //Test.javapackage com.udayan.oca; import java.time.LocalDate; public class Test {     public static void main(String [] args) {         LocalDate newYear = LocalDate.of(2018, 1, 1);…
  25. Q25 Given code of Test.java file: package com.udayankhattry.oca; import java.util.ArrayList;import java.util.List; public class Test { public static void main(String[] args) { List<StringBuilder> list = new…
  26. Q26 Consider the code:interface Interf{ void m1(); public void m2();}class Test implements Interf{ void m1(){}}Which changes are required to perform independently to compile…
  27. Q27 //StringListTest.javaimport java.util.ArrayList;import java.util.List;public class StringListTest {    public static void main(String[] args) {        List<String> list = new ArrayList<>();   …
  28. Q28 Consider below code://Test.javapackage com.udayan.oca; class SpecialString { String str; SpecialString(String str) { this.str = str; }} public class Test { public static void main(String[]…
  29. Q29 Given code of Test.java file:class A { public static void main(String [] args) { System.out.println("A"); }} class B { public static void main(String…
  30. Q30 class Learner {    String name;    int age;    Learner() {        this("John", 20);    }    Learner(String name,…
  31. Q31 Consider the following code:interface Interf//Line-1{ abstract void m1(); //Line-2}abstract class ChildClass implements Interf //Line-3{ abstract void m1();//Line-4}class ParentClass extends ChildClass //Line-5{ void…
  32. Q32 What will be the result of compiling and executing Test class? package com.udayan.oca; class M { }class N extends M { }class O…
  33. Q33 //IntegerListTest.javaimport java.util.ArrayList;import java.util.List;public class IntegerListTest {    public static void main(String[] args) {        List<Integer> list = new ArrayList<>();   …
  34. Q34 Consider the following code:public class Test { public static void main(String[] args) { StringBuilder sb = new StringBuilder("Java8"); sb.reverse().deleteCharAt(0).append("SE").delete(3,sb.length()); System.out.println(sb); }}What is…
  35. Q35 Which of the following statements is correct for the code below?//LoopCheck.javapublic class LoopCheck {    public static void main(String[] args) {   …
  36. Q36 Consider the code:public class Student { private String name; private boolean passed; private int marks;  public static void main(String[] args) { Student…
  37. Q37 Consider below code of Test.java file: package com.udayankhattry.oca; public class Test { public static void main(String [] args) { boolean flag1 = true;…
  38. Q38 import java.util.ArrayList;import java.util.List;public class ListTest {    public static void main(String[] args) {        List<String> list = new ArrayList<>();   …
  39. Q39 Which of the following statement declares a constant field in Java?
  40. Q40 Given code: package com.udayan.oca; public class Test {     public static void main(String[] args) {         int [] arr = {1, 2, 3, 4, 5};…
  41. Q41 What will be the result of compiling and executing Test class?package com.udayankhattry.oca; public class Test { public static void main(String[] args) { int…
  42. Q42 Consider the code of Test.java file: package com.udayan.oca; class Student {     String name;     int age;     Student() {         Student("James", 25);     }     Student(String name, int…
  43. Q43 Consider below Lambda expression: Predicate predicate = s -> true;  Which of the lambda expression can successfully replace the lambda expression in…
  44. Q44 Given Code: package com.udayan.oca; import java.io.*; class ReadTheFile {     static void print() { //Line 4         throw new IOException(); //Line 5     }} public class Test {…
  45. Q45 What will be the result of compiling and executing StringBuilderTest class?public class StringBuilderTest {    public static void main(String[] args) {   …
  46. Q46 Which of the following is the correct order of java exception handling keywords based on usage?
  47. Q47 Which of the following are TRUE about switch statement ?
  48. Q48 Consider the following code:public class Test { public static void main(String[] args) { byte b = 10; switch(b+1) { case 10: System.out.print(10);…
  49. Q49 What will be the result of compiling and executing Test class? package com.udayan.oca; public class Test {     public static void main(String[] args) {…
  50. Q50 Consider the following code:interface Interf{ default void m1() { System.out.println("interface default method"); }}public class Test implements Interf{ default void m1() { System.out.println("Test…
  51. Q51 Consider below code: //Test.javapackage com.udayan.oca; import java.util.ArrayList;import java.util.List; class Student {     private String name;     private int age;     Student(String name, int age) {         this.name =…
  52. Q52 Which is not a valid statement based on the given code?class A {}class B extends A {}
  53. Q53 What will be the result of compiling and executing Test class?package com.udayan.oca; public class Test {     public static void print() {         System.out.println("static method");…
  54. Q54 //InstanceofTest.javapublic class InstanceofTest {   public static void main(String[] args) {       Error obj = new Error();       boolean flag1 =…
  55. Q55 public class ArrayShortTest {    public static void main(String[] args) {        short[] numbers = new short[]{50, 50};     …
  56. Q56 public class StringBuilderTest {    public static void main(String[] args) {        StringBuilder sb = new StringBuilder();       …

More Oracle certifications

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need