Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 25

Consider below code: 

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


Options are :

  • 16-3-1980
  • 1980-03-16
  • An exception is thrown at runtime
  • 16-03-1980
  • Compilation error (Correct)

Answer :Compilation error

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 9

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


Options are :

  • Compilation error
  • NullPointerException is thrown at runtime (Correct)
  • 0.0
  • ClassCastException is thrown at runtime

Answer :NullPointerException is thrown at runtime

Consider below code: 

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


Options are :

  • P0D (Correct)
  • p0d
  • p0y0m0d
  • P0Y0M0D

Answer :P0D

Consider the code of Test.java file:

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


Options are :

  • An exception is thrown at runtime
  • null:0 (Correct)
  • James:25
  • Compilation error

Answer :null:0

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 39

Below is the code of Test.java file:

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


Options are :

  • [1, 0]
  • Compilation error
  • An exception is thrown at runtime
  • [2, 1] (Correct)

Answer :[2, 1]

Consider the following class:

Which of the following is the correct way to make the variable 'passportNo' read only for any other class?


Options are :

  • Make 'passportNo' private.
  • Make 'passportNo' private and provide a public method getPassportNo() which will return its value. (Correct)
  • Make 'passportNo' static and provide a public static method getPassportNo() which will return its value.
  • Remove 'public' from the 'passportNo' declaration. i.e., change line 2 to int passportNo;

Answer :Make 'passportNo' private and provide a public method getPassportNo() which will return its value.

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


Options are :

  • 0
  • 0.0
  • Line 4 causes runtime exception
  • Line 3 causes compilation error (Correct)

Answer :Line 3 causes compilation error

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 39

Consider below code: 

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


Options are :

  • [Counter-10]
  • An exception is thrown at runtime
  • Compilation error
  • [Counter-5] (Correct)

Answer :[Counter-5]

Consider below code:

Which of the following lambda expressions, if used to replace /*INSERT*/, prints [Jack, Liya] on to the console? Select ALL that apply.


Options are :

  • e -> { e.getSalary() >= 10000 }
  • e -> e.getSalary() >= 10000 (Correct)
  • e - > e.getSalary() >= 10000
  • (e) -> { e.getSalary() >= 10000; }
  • (Employee e) -> { return e.getSalary() >= 10000; } (Correct)

Answer :e -> e.getSalary() >= 10000 (Employee e) -> { return e.getSalary() >= 10000; }

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


Options are :

  • None of the System.out.println statements are executed (Correct)
  • OUT
  • Compilation error
  • CATCH-OUT

Answer :None of the System.out.println statements are executed

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 40

Consider below code: 

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


Options are :

  • [HeLLo, HeLLo, HeLLo]
  • [Hello, Hello, Hello] (Correct)
  • [HeLLo, Hello, HeLLo]
  • [HeLLo, Hello, Hello]

Answer :[Hello, Hello, Hello]

Consider below code:

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


Options are :

  • OCAJP
  • false
  • true (Correct)
  • Compilation error

Answer :true

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


Options are :

  • > >0.0 >0.0 (Correct)
  • >null >0.0 >0.0f
  • > >0.0 >0.0f
  • >null >0.0 >0.0

Answer :> >0.0 >0.0

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 40

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


Options are :

  • Happy Holidays! Happy Holidays!
  • null Happy New Year!
  • Happy New Year! Happy New Year! (Correct)
  • Happy New Year! Happy Holidays!

Answer :Happy New Year! Happy New Year!

For the given code snippet:

List<String> list = new /*INSERT*/(); 

Which of the following options, if used to replace /*INSERT*/, compiles successfully? Select ALL that apply.


Options are :

  • ArrayList (Correct)
  • ArrayList<> (Correct)
  • List<>
  • List

Answer :ArrayList ArrayList<>

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


Options are :

  • 4
  • None of the other options
  • 3
  • 5
  • 1 (Correct)
  • 2
  • 0

Answer :1

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 49

Consider code below:

Currently above code causes compilation error.

Which of the options can successfully print 128:TYPE-C on to the console?


Options are :

  • Replace /*INSERT-1*/ with: super(capacity); this.type = type; Replace /*INSERT-2*/ with: super(0); (Correct)
  • Replace /*INSERT-1*/ with: super(capacity); Replace /*INSERT-2*/ with: super(128);
  • Replace /*INSERT-1*/ with: super.capacity = capacity; this.type = type; Replace /*INSERT-2*/ with: super(128);
  • Replace /*INSERT-1*/ with: this.type = type; super(capacity); Replace /*INSERT-2*/ with: super(128);
  • None of the other options

Answer :Replace /*INSERT-1*/ with: super(capacity); this.type = type; Replace /*INSERT-2*/ with: super(0);

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


Options are :

  • 35-25
  • 25-60 (Correct)
  • 35-60
  • 25-25

Answer :25-60

Consider below code: 

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


Options are :

  • Compilation error
  • true:false
  • false:true (Correct)
  • An exception is thrown at runtime

Answer :false:true

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 3

Consider below code: 

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


Options are :

  • Compilation error
  • An exception is thrown at runtime (Correct)
  • [Walnut, Date]
  • [Walnut, Apricot, Almond, Date]

Answer :An exception is thrown at runtime

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


Options are :

  • [50, 50]
  • An exception is thrown at runtime
  • Compilation error (Correct)
  • [5, 10]

Answer :Compilation error

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


Options are :

  • Compilation error (Correct)
  • Output is: true
  • Output is: 10 != 5
  • Output is: false

Answer :Compilation error

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 11

Fill in the blanks for the definition of java.lang.Error class:

public class java.lang.Error extends ________________ {...}


Options are :

  • RuntimeException
  • Throwable (Correct)
  • Exception

Answer :Throwable

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


Options are :

  • Compilation error (Correct)
  • var is 200
  • In default
  • var is 100

Answer :Compilation error

Consider code of Test.java file:

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


Options are :

  • Compilation error
  • VTEO
  • VETO
  • Runtime exception (Correct)
  • VET
  • VTE

Answer :Runtime exception

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 32

Consider below code:


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


Options are :

  • null Java Java Java
  • Java Java Java null
  • Java null
  • Java Java null
  • null Java
  • Java Java Java
  • null Java Java (Correct)
  • Java
  • Java Java

Answer :null Java Java

Consider codes below:


One of the statements inside print() method is causing compilation failure. Which of the below solutions will help to resolve compilation error?


Options are :

  • Comment the statement at Line 8
  • Comment the statement at Line 11
  • Comment the statement at Line 10
  • Comment the statement at Line 9 (Correct)

Answer :Comment the statement at Line 9

Consider below code:

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


Options are :

  • Compilation error
  • An exception is thrown at runtime (Correct)
  • 2020-10-01
  • 2020-09-30

Answer :An exception is thrown at runtime

Oracle Java SE 8 Certification - OCAJP 1Z0-808 Practice Tests Set 21

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


Options are :

  • Compilation error
  • [200, 200]
  • [200]
  • [200, 100, 200]
  • Exception is thrown at runtime (Correct)
  • [100, 200, 200]

Answer :Exception is thrown at runtime

Consider below code: 

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


Options are :

  • Student[James, 27]
  • Student[James, 25] Student[James, 27] Student[James, 25]
  • Student[James, 27] Student[James, 25] Student[James, 25]
  • Student[James, 25] Student[James, 27] Student[James, 25] Student[James, 25] (Correct)

Answer :Student[James, 25] Student[James, 27] Student[James, 25] Student[James, 25]

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions