Courseiva
Question 32 of 481
Arrays and MethodsmediumMultiple ChoiceObjective-mapped

1Z0-811 Arrays and Methods Practice Question

Exhibit

Refer to the exhibit.

public class Test {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        change(arr);
        System.out.println(arr[0]);
    }
    public static void change(int[] a) {
        a[0] = 99;
        a = new int[]{10,20};
    }
}

What is the output?

⚠ Common exam trap

Oracle often tests the misconception that the loop might cause an ArrayIndexOutOfBoundsException because candidates mistakenly think the loop runs to index 10, or they confuse the array length with 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 output is 99. This is the expected result when an array element is accessed and its value has been set to 99.

Answer analysis

Option-by-option breakdown

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

  • ArrayIndexOutOfBoundsException

    Why it's wrong here

    No out-of-bounds access.

  • 1

    Why it's wrong here

    The original array is modified.

  • 99

    Why this is correct

    The output 99 arises from the precise evaluation of the loop's termination condition. The code likely features an iterative construct, such as a `for` loop, where a counter variable increments from 0 and continues as long as it is less than 100 (e.g., `i < 100`). This ensures the loop's body executes for `i` values from 0 up to, and including, 99. Consequently, if the final value of this counter or a variable assigned within the loop is printed after termination, 99 is displayed, satisfying the constraint of the specified iteration range.

  • 10

    Why it's wrong here

    The new array is not assigned to original reference.

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.