Courseiva
Question 42 of 513
Working with Arrays and CollectionshardMultiple SelectObjective-mapped

1Z0-829 Working with Arrays and Collections Practice Question

Which TWO are true about the PriorityQueue class?

⚠ Common exam trap

A common mix-up: candidates confuse PriorityQueue with a FIFO queue (like LinkedList) and assume insertion order, or mistakenly think it allows nulls or provides O(1) contains() due to its heap structure.

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

It is not thread-safe.

PriorityQueue is not thread-safe; it does not synchronize access, so concurrent modifications without external synchronization can lead to inconsistent behavior. Option D is correct because PriorityQueue can accept a custom Comparator at construction time to define the ordering of elements, overriding the natural order.

Answer analysis

Option-by-option breakdown

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

  • It allows null elements.

    Why it's wrong here

    Null not allowed.

  • It orders elements based on insertion order.

    Why it's wrong here

    Orders by priority, not insertion.

  • It is not thread-safe.

    Why this is correct

    Correct, not synchronized.

  • It can be used with a custom Comparator.

    Why this is correct

    Correct.

  • It provides O(1) time for contains().

    Why it's wrong here

    O(n) for contains.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.