1Z0-829 Working with Arrays and Collections Practice Question
Which THREE statements are true about HashSet in Java 17? (Choose three.)
⚠ Common exam trap
Candidates often confuse HashSet's lack of ordering with the ability to hold duplicates, or assume that 'constant-time performance' means guaranteed O(1) regardless of hash collisions, but the exam expects you to know that it is amortized constant-time under typical conditions.
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
✓
Does not maintain insertion order
HashSet is backed by a HashMap, which uses hash codes to store elements in buckets. The iteration order depends on the hash values and bucket distribution, which can change when the set is resized, so insertion order is not preserved.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Does not maintain insertion order
Why this is correct
Order is not guaranteed.
- ✗
Allows duplicate elements
Why it's wrong here
No duplicates allowed.
- ✗
Is thread-safe
Why it's wrong here
Not synchronized.
- ✓
Has constant-time performance for basic operations
Why this is correct
Average O(1) for add, remove, contains.
- ✓
Allows at most one null element
Why this is correct
HashSet permits null.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-829 question from scratch — 513 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 →
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.