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