1Z0-829 Working with Arrays and Collections Practice Question
Which method of Collection interface returns a primitive int?
⚠ Common exam trap
Watch out — candidates often confuse `isEmpty()` (which returns `boolean`) with `size()` (which returns `int`), or mistakenly think `toArray()` returns a primitive array, but it returns an `Object[]` or a generic array, not a primitive `int[]`.
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
✓
size()
The `size()` method is the only one in the `Collection` interface that returns a primitive `int`, representing the number of elements in the collection. All other methods listed return either a `boolean` or an array of objects, making D the correct answer.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
contains(Object o)
Why it's wrong here
Returns boolean.
- ✗
isEmpty()
Why it's wrong here
Returns boolean.
- ✗
toArray()
Why it's wrong here
Returns Object[].
- ✓
size()
Why this is correct
Returns int.
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.