Question 171 of 509
Arrays and MethodshardMultiple SelectObjective-mapped

Quick Answer

The correct answer is that passing null as an array argument is allowed at compile time, because Java treats arrays as objects, and null is a valid reference value for any object type, including arrays. This means a method declared with an array parameter, such as `void process(int[] arr)`, will compile without error when invoked with `null`, though it may throw a NullPointerException at runtime if the method tries to access elements without a null check. On the Oracle Java Foundations 1Z0-811 exam, this concept tests your understanding of reference types versus primitive types, and a common trap is assuming that passing null causes a compile-time error. Another key point is that varargs, written as `Type... param`, are syntactic sugar for an array parameter, so they also accept null and zero arguments. To remember this, think: "Arrays are objects, null is a valid object reference — compile accepts, runtime checks."

1Z0-811 Arrays and Methods Practice Question

This 1Z0-811 practice question tests your understanding of arrays and methods. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Which THREE statements are true about passing arrays to methods in Java?

Question 1hardmulti select
Full question →

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

Varargs parameters allow passing zero or more arguments of the specified type.

Option B is correct because varargs (variable-length arguments) in Java allow a method to accept zero or more arguments of a specified type, using the syntax `Type... param`. This is syntactic sugar for an array parameter, and the method body treats it as an array. This enables flexible method invocation without requiring the caller to explicitly create an array.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • If the method modifies elements of the array, the caller does not see the changes.

    Why it's wrong here

    Changes to elements are visible to the caller because they share the same array object.

  • Varargs parameters allow passing zero or more arguments of the specified type.

    Why this is correct

    Varargs (T...) accept multiple arguments or an array.

    Related concept

    Read the scenario before looking for a memorised answer.

  • If the method assigns a new array to the parameter, the caller's variable is updated.

    Why it's wrong here

    Only the local reference is changed; caller's variable still points to original array.

  • The method receives a reference to the array.

    Why this is correct

    Java passes the reference by value.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Passing null as an array argument is allowed at compile time.

    Why this is correct

    Null can be passed to any array parameter; runtime behavior may cause NullPointerException.

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates often confuse pass-by-value for object references with pass-by-reference, leading them to incorrectly believe that reassigning the parameter (Option C) or modifying elements (Option A) behaves the same way, when in fact only element modifications are visible to the caller.

Detailed technical explanation

How to think about this question

In Java, arrays are objects stored on the heap, and the variable holds a reference (memory address). When passed to a method, a copy of that reference is made (pass-by-value), so both the caller and method point to the same array object. This means element modifications are visible to the caller, but reassigning the parameter to a new array does not affect the caller's reference. Varargs parameters are compiled into an array parameter, and the compiler inserts array creation code at the call site if needed; if no arguments are passed, the array is empty (length 0), not null.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the 1Z0-811 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related 1Z0-811 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free 1Z0-811 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this 1Z0-811 question test?

Arrays and Methods — This question tests Arrays and Methods — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Varargs parameters allow passing zero or more arguments of the specified type. — Option B is correct because varargs (variable-length arguments) in Java allow a method to accept zero or more arguments of a specified type, using the syntax `Type... param`. This is syntactic sugar for an array parameter, and the method body treats it as an array. This enables flexible method invocation without requiring the caller to explicitly create an array.

What should I do if I get this 1Z0-811 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

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

Same concept, more angles

2 more ways this is tested on 1Z0-811

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Which two statements about passing arrays to methods are correct? (Select two.)

hard
  • A.Passing an array is the same as passing each element individually.
  • B.The method can change the size of the original array.
  • C.Modifying the array elements inside the method affects the original array.
  • D.If the method assigns a new array to the parameter, the original reference is updated outside the method.
  • E.The array reference is passed by value.

Why C: Options A and B are correct. The array reference is passed by value (A), so modifications to the array elements affect the original (B). Option C is false because passing an array is not the same as passing elements individually. Option D is false because the array size is fixed. Option E is false because assigning a new array to the parameter does not affect the caller's reference.

Variation 2. Which TWO statements are true about passing arrays to methods in Java?

medium
  • A.The method can reassign the original array variable to a new array.
  • B.The method can modify the elements of the array.
  • C.The method must return the array to reflect any changes.
  • D.The method receives a copy of the array reference.
  • E.The method cannot determine the size of the array.

Why B: Option B is correct because Java passes object references by value. When an array is passed to a method, the method receives a copy of the reference to the array object. This copy still points to the same array object in heap memory, so the method can modify the elements of the array through that reference. These modifications are visible to the caller because they affect the same underlying array object.

Keep practising

More 1Z0-811 practice questions

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.