Courseiva
Question 390 of 481
Arrays and MethodseasyMultiple ChoiceObjective-mapped

1Z0-811 Arrays and Methods Practice Question

Exhibit

Refer to the exhibit.

public class ArrayExample {
    public static void main(String[] args) {
        int[] numbers = {1, 2, 3, 4, 5};
        modifyArray(numbers);
        System.out.println(numbers[0]);
    }
    public static void modifyArray(int[] arr) {
        arr[0] = 99;
    }
}

What is the output?

⚠ Common exam trap

A common mistake is assuming array indices start at 1, leading candidates to believe index 5 is out of bounds for a 6-element array. However, Java arrays are zero-indexed, so indices 0-5 are valid, making index 5 the last valid index.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

99

The code initializes an array of size 6 and assigns the value 99 to index 5. Since Java arrays are zero-indexed, index 5 is the last valid index for a 6-element array. The assignment succeeds, and the print statement outputs 99. Option C is correct.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • 1

    Why it's wrong here

    1 is the original value, but it is changed to 99.

  • Compilation error

    Why it's wrong here

    The code compiles and runs without error.

  • 99

    Why this is correct

    The method sets numbers[0] to 99, so that is printed.

  • Runtime exception

    Why it's wrong here

    No exception occurs; the array is accessed correctly.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.