Courseiva
Question 208 of 481
Arrays and MethodsmediumMultiple ChoiceObjective-mapped

1Z0-811 Arrays and Methods Practice Question

Consider a method that takes an int array and modifies it: public static void doubleArray(int[] arr) { for (int i = 0; i < arr.length; i++) { arr[i] *= 2; } }. What is the output of: int[] nums = {1, 2, 3}; doubleArray(nums); System.out.println(nums[1]);

⚠ Common exam trap

It's easy for candidates to confuse pass-by-value for object references with pass-by-value for primitives, incorrectly assuming the array is copied and the original remains unchanged, leading them to pick the original value (option C).

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

4

The method `doubleArray` multiplies each element of the array by 2. The array `nums` is passed by reference, so modifications inside the method affect the original array. After execution, `nums[1]` (originally 2) becomes 4, which is printed.

Answer analysis

Option-by-option breakdown

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

  • 4

    Why this is correct

    The method doubles each element, so 2 becomes 4.

  • 8

    Why it's wrong here

    Would be 8 if squared, but it's multiplied by 2.

  • 2

    Why it's wrong here

    This is the original value before doubling.

  • 3

    Why it's wrong here

    Not the result of doubling.

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 25, 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.