Courseiva
Arrays and MethodseasyMultiple ChoiceObjective-mapped

1Z0-811 Arrays and Methods Practice Question

Given the array declaration: int[] data = new int[5];, what is the value of data[2] after initialization?

⚠ Common exam trap

Oracle often tests the distinction between default values for primitives (e.g., `0` for `int`) versus objects (`null`) and the misconception that array elements are initialized to their index number or left uninitialized.

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

0

In Java, when an array of primitive type `int` is created using `new int[5]`, all elements are automatically initialized to the default value for `int`, which is `0`. Therefore, `data[2]` (the third element) holds the value `0` after initialization.

Answer analysis

Option-by-option breakdown

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

  • 2

    Why it's wrong here

    Index 2 is the third element, but no assignment has been made.

  • 0

    Why this is correct

    Default value for int array elements.

  • false

    Why it's wrong here

    false is default for boolean, not int.

  • null

    Why it's wrong here

    null is default for object references, not primitives.

About these practice questions

Courseiva writes every 1Z0-811 question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.