1Z0-811 Java Basics and Syntax Practice Question
What is the result of: int[] arr = new int[5]; System.out.println(arr[5]);
⚠ Common exam trap
Oracle often tests the misconception that accessing an out-of-bounds index returns a default value like 0 or null, or that Java silently wraps around, when in fact it always throws an exception.
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
✓
ArrayIndexOutOfBoundsException
Java arrays are zero-indexed, meaning a valid index for an array of length 5 is 0 through 4. Accessing index 5 throws an ArrayIndexOutOfBoundsException at runtime, as it is outside the array's bounds.
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 this is correct
Correct. Runtime exception thrown.
- ✗
null
Why it's wrong here
Incorrect. Array elements are ints, not references.
- ✗
-1
Why it's wrong here
Incorrect. No default value for out-of-bounds.
- ✗
0
Why it's wrong here
Incorrect. Index 5 is out of bounds.
Go deeper
Related to this question
About these practice questions
This 1Z0-811 question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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.