ThatQuiz Test Library Take this test now
Priority queue - Quiz
Contributed by: Batchelor
  • 1. What is the typical underlying data structure used to improve priority queue performance?
A) Stack
B) Queue
C) Hash table
D) Heap
  • 2. What is the time complexity for insertions in a heap-based priority queue?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
  • 3. How long does it take to build a heap initially from n elements?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
  • 4. Which data structure is mentioned as a variant that can provide better bounds for some operations?
A) Array
B) Linked list
C) Queue
D) Fibonacci heaps
  • 5. What is the time complexity of building a tree from a sequence of n elements using a self-balancing binary search tree?
A) O(n)
B) O(1)
C) O(n log n)
D) O(log n)
  • 6. Why does a self-balancing binary search tree with a linked list require more storage?
A) It requires more complex metadata
B) It stores duplicate data
C) It uses more memory per node due to pointers
D) It stores extra references to other nodes
  • 7. From a computational-complexity standpoint, what are priority queues congruent to?
A) Sorting algorithms
B) Searching algorithms
C) Compression algorithms
D) Graph traversals
  • 8. What determines the order of service in a priority queue?
A) Data type size
B) Associated priority
C) Memory address
D) Insertion time
  • 9. How does a priority queue serve items?
A) Randomly
B) Highest priority first
C) First in first out
D) Last in first out
  • 10. In the Java standard library, which elements have the highest priority?
A) Most recently added
B) Lowest elements
C) Oldest elements
D) Highest elements
  • 11. Are priority queues and heaps conceptually the same?
A) No, they are distinct
B) Yes, they are the same in all contexts
C) No, heaps are never used for priority queues
D) Yes, they are identical
  • 12. What is the priority behavior in a stack implementation?
A) Monotonically increasing
B) Constant
C) Monotonically decreasing
D) Undefined
  • 13. What is the priority behavior in a queue implementation?
A) Monotonically increasing
B) Static
C) Random
D) Monotonically decreasing
  • 14. What happens if two elements have the same priority in some implementations?
A) The second is always ignored
B) They are discarded
C) The order is strictly descending
D) Served in order of enqueuing
Created with That Quiz — a math test site for students of all grade levels.