1Z0-829 Working with Arrays and Collections Practice Question
What will be the result of the following code? Object[] arr = new Integer[5]; arr[0] = "String";
⚠ Common exam trap
The trap here is that candidates see the reference type `Object[]` and assume the array can hold any `Object`, forgetting that the actual runtime type of the array object determines what can be stored, leading them to pick Option A or D.
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
✓
ArrayStoreException at runtime
The code creates an array of type `Integer[]` referenced by an `Object[]` variable. At runtime, the array's actual component type is `Integer`, so attempting to store a `String` violates the array's type constraint and throws an `ArrayStoreException`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Successfully stores "String"
Why it's wrong here
Array is Integer[].
- ✓
ArrayStoreException at runtime
Why this is correct
Runtime type is Integer[], incompatible.
- ✗
Compilation error
Why it's wrong here
Line compiles: Object[] can hold String.
- ✗
ClassCastException
Why it's wrong here
ArrayStoreException is thrown.
Go deeper
Related to this question
About these practice questions
One of 513 original 1Z0-829 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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-829 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-829 exam.