Skip to content

1z0-808 Java SE 8 Programmer I (OCA) Practice Questions

Prepare for 1z0-808 with more than an answer.

432 questions in the full set20 sample questionsUpdated Jan 23, 2026
Level
Associate
Valid for
Does not expire
Domains covered on the exam 9
  1. Java Basics11%
  2. Working With Java Data Types14%
  3. Using Operators and Decision Constructs13%
  4. Creating and Using Arrays8%
  5. Using Loop Constructs9%
  6. Working with Methods and Encapsulation15%
  7. Working with Inheritance14%
  8. Handling Exceptions9%
  9. Working with Selected classes from the Java API17%
  1. 1

    Given the code fragment, what is the result?

    Question exhibit
    • Option exhibit
    Show answer details

    Correct answer: D

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  2. 2

    Given the two code fragments below, what is the result?

    Question exhibit
    Show answer details

    Correct answer: A

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  3. 3

    Given the code fragment, and given the requirements:

    If the value of the qty variable is greater than or equal to 90, discount = 0.5
    If the value of the qty variable is between 80 and 90, discount = 0.2

    Which two code (A to E) fragments can be independently placed at line n1 to meet the requirements? (Choose two.)

    Question exhibit
    Show answer details

    Correct answer: A, C

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  4. 4

    Given the code fragment, what is the result?

    Question exhibit
    Show answer details

    Correct answer: B

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  5. 5

    Given the code fragment below, which option, inserted at line n1, prints The Top element: 30?

    Question exhibit
    • Option exhibit
    • Option exhibit
    • Option exhibit
    • Option exhibit
    • Option exhibit
    Show answer details

    Correct answer: E

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  6. 6

    Given the code snippet from a compiled Java source file, and the output below it:

    Which command should you run to obtain this output?

    Question exhibit
    Show answer details

    Correct answer: C

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  7. 7

    A system processes different types of media files. A base class MediaFile has a method void process() throws IOException. A subclass VideoFile overrides this method. According to Java's rules for overriding methods with checked exceptions, which of the following declarations for the process method in VideoFile are valid? (Select ALL that apply)

    classDiagram class MediaFile { +process() throws IOException } class VideoFile { +process() } MediaFile <|-- VideoFile

    Show answer details

    Correct answer: A, B, E

    This is valid. An overriding method can declare a subclass of a checked exception declared by the superclass method. FileNotFoundException is a subclass of IOException.

    This is valid. An overriding method can choose not to declare any checked exceptions, even if the superclass method does.

    This is valid. An overriding method can declare any unchecked (runtime) exceptions regardless of what the superclass method declares, because they do not need to be handled at compile time.

  8. 8

    Given the following:

    Question exhibit
    Show answer details

    Correct answer: D

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  9. 9

    Given the code fragments below, which statement is true?

    Question exhibit
    Show answer details

    Correct answer: C

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

  10. 10

    Given the code fragment, what is the result?

    Question exhibit
    Show answer details

    Correct answer: B

    This is one of the correct answers in a multi-select question. The selected options work together to satisfy the Java programming requirements, demonstrating proper syntax, valid type usage, correct method implementation, or appropriate design patterns. Each correct choice represents a valid solution component that addresses different aspects of the programming scenario while maintaining Java language compliance and best practices.

Create an account to continue.