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

The author of this method forgot to include the data type. Which of the following reference types can fill in the blank to complete this method? (Choose one)


Options are :

  • D. None of the above
  • B. String (Correct)
  • C. StringBuilder
  • A. ArrayList

Answer :B. String

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

What is the output of the following application? (Choose one)


Options are :

  • B. cellulose
  • C. The code does not compile.
  • A. papyrus (Correct)
  • D. The code compiles but throws an exception at runtime.

Answer :A. papyrus

What is the output of the following? (Choose one)


Options are :

  • B. false
  • C. The code does not compile.
  • D. The code compiles but throws an exception at runtime.
  • A. true (Correct)

Answer :A. true

What is the result of compiling and executing the following application? (Choose one)


Options are :

  • B. The code compiles but a stack trace is printed at runtime.
  • A. The code compiles and runs without printing anything.
  • C. The code does not compile because of line k1.
  • D. The code does not compile for another reason. (Correct)

Answer :D. The code does not compile for another reason.

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

What is the result of the following? (Choose one)


Options are :

  • B. 12-31-2016
  • A. 01-01-2017
  • C. The code does not compile.
  • D. The code compiles but throws an exception at runtime. (Correct)

Answer :D. The code compiles but throws an exception at runtime.

Which of the following is the best reason for creating a default interface method?


Options are :

  • A. Allow interface methods to be inherited.
  • D. Allow an interface to define a method at the class level.
  • B. Add backward compatibility to existing interfaces. (Correct)
  • C. Give an interface the ability to create concrete methods.

Answer :B. Add backward compatibility to existing interfaces.

What is the result of compiling and running the following application? (Choose one)


Options are :

  • D. The code compiles, but a stack trace is printed at runtime.
  • A. The code does not compile because of line p1.
  • C. The code does not compile because of line p3. (Correct)
  • B. The code does not compile because of line p2.

Answer :C. The code does not compile because of line p3.

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

In the following application, the value of list has been omitted. Assuming the code compiles without issue, which one of the following is not a possible output of executing this class? (Choose one)


Options are :

  • A. A stack trace for NullPointerException is printed.
  • B. A stack trace for ArrayIndexOutOfBoundsException is printed.
  • D. None of the above (Correct)
  • C. A stack trace for ClassCastException is printed.

Answer :D. None of the above

What is the output of the following application? (Choose one)


Options are :

  • C. Sprinting! (Correct)
  • B. Walking and jogging!
  • A. Walking and running!
  • D. The code does not compile.

Answer :C. Sprinting!

Which statement about the following classes is correct?


Options are :

  • A. The code does not compile because of line g1.
  • C. The code does not compile because of line g3. (Correct)
  • D. None of the above
  • B. The code does not compile because of line g2.

Answer :C. The code does not compile because of line g3.

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

How many of these lines fail to compile? (Choose one)


Options are :

  • C. Three
  • B. Two
  • A. One (Correct)
  • D. Four

Answer :A. One

What happens when calling the following method with a non-null and non-empty array? (Choose one)


Options are :

  • D. Option D (Correct)
  • B. Option B
  • A. Option A
  • C. Option C

Answer :D. Option D

What is the output of the following application? (Choose one)


Options are :

  • B. Driving electric car (Correct)
  • D. The code does not compile.
  • A. Driving vehicle
  • C. Driving car

Answer :B. Driving electric car

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

How many of the String objects are eligible for garbage collection right before the end of the main method? (Choose one)


Options are :

  • A. None
  • C. Two (Correct)
  • D. Three
  • B. One

Answer :C. Two

If a try statement has catch blocks for both IllegalArgumentException and ClassCastException, then which of the following statements is correct? (Choose one)


Options are :

  • D. A try statement cannot be declared with these two catch block types because they are incompatible.
  • A. The catch block for IllegalArgumentException must appear before the catch block for ClassCastException.
  • B. The catch block for ClassCastException must appear before the catch block for IllegalArgumentException.
  • C. The catch blocks for these two exception types can be declared in any order. (Correct)

Answer :C. The catch blocks for these two exception types can be declared in any order.

Given that a Date class exists in both the java.util and java.sql packages, what is the result of compiling the following class? (Choose one)


Options are :

  • B. The code does not compile because of line 4. (Correct)
  • D. The code compiles without issue.
  • C. The code does not compile because of line 5.
  • A. The code does not compile because of lines 1 and 2.

Answer :B. The code does not compile because of line 4.

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

Given the class definitions below, which value, when inserted into the blank line, does not allow the class to compile? (Choose one)


Options are :

  • D. null
  • C. new Wolf() (Correct)
  • B. new Dog()
  • A. new Husky()

Answer :C. new Wolf()

What is the command to call one constructor from another constructor in the same class? (Choose one)


Options are :

  • C. that()
  • B. this() (Correct)
  • A. super()
  • D. construct()

Answer :B. this()

Fill in the blank: Overloaded and overridden methods always have ..................... (Choose one)


Options are :

  • C. the same method name (Correct)
  • D. covariant return types
  • B. different return types
  • A. the same parameter list

Answer :C. the same method name

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

What is the main benefit of a lambda expression? (Choose one)


Options are :

  • C. It allows you to inherit from multiple classes.
  • A. It allows you to convert a primitive to a wrapper class.
  • D. It allows you to write code that has the execution deferred. (Correct)
  • B. It allows you to change the bytecode while the application is running.

Answer :D. It allows you to write code that has the execution deferred.

What is the output of the following? (Choose one)


Options are :

  • D. The code compiles but throws an exception at runtime.
  • A. 4-0
  • B. 4-4
  • C. The code does not compile. (Correct)

Answer :C. The code does not compile.

How many lines of the following program contain compilation errors? (Choose one)


Options are :

  • B. One
  • C. Two (Correct)
  • D. Three
  • A. None

Answer :C. Two

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

How many final modifiers would need to be removed for this application to compile?


Options are :

  • D. The code will not compile regardless of the number of final modifiers that are removed.
  • B. One
  • A. None
  • C. Two (Correct)

Answer :C. Two

What is the result of running the following as java Copier? (Choose one)


Options are :

  • A. 0
  • B. 0 followed by an exception
  • D. The code does not compile. (Correct)
  • C. 1 followed by an exception

Answer :D. The code does not compile.

Which keywords are required with a try statement? (Choose one)

I. catch

II. finalize

III. finally


Options are :

  • B. II only
  • A. I only
  • D. None of these statements are required with a try statement.
  • C. I or III, or both (Correct)

Answer :C. I or III, or both

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

How many lines does the following code output? (Choose one)


Options are :

  • C. The code does not compile.
  • A. Six
  • D. The code compiles but throws an exception at runtime. (Correct)
  • B. Seven

Answer :D. The code compiles but throws an exception at runtime.

What is the best reason for using StringBuilder instead of String? (


Options are :

  • D. StringBuilder supports different languages and encodings.
  • B. StringBuilder can use == to compare values.
  • C. StringBuilder saves memory by reducing the number of objects created. (Correct)
  • A. StringBuilder adds support for multiple threads.

Answer :C. StringBuilder saves memory by reducing the number of objects created.

How many of the types ArrayList, List, and Object can fill in the blank to produce code that compiles? (Choose one)

List frisbees = new _____________();


Options are :

  • B. One (Correct)
  • C. Two
  • A. None
  • D. Three

Answer :B. One

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

What is the output of the following application? (Choose one)


Options are :

  • B. 124
  • A. 123
  • C. 12
  • D. None of the above (Correct)

Answer :D. None of the above

What is the output of the following application? (Choose one


Options are :

  • A. up (Correct)
  • C. down
  • D. The code does not compile.
  • B. middle

Answer :A. up

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions