Applications of heaps (priority queues, heap sort) MCQsBy: Prof. Dr. Fazal Rehman | Last updated: May 15, 2025 20 Score: 0 Attempted: 0/20 Subscribe 1. : Which data structure is primarily used to implement a priority queue? (A) Array (B) Linked List (C) Stack (D) Heap 2. : What is the time complexity of inserting an element into a priority queue implemented using a heap of size 𝑛? (A) O(1) (B) O(log n) (C) O(n) (D) O(n log n) 3. : Which sorting algorithm uses a heap as its data structure? (A) Merge sort (B) Quick sort (C) Bubble sort (D) Heap sort 4. : What is the worst-case time complexity of heap sort for sorting 𝑛 elements? (A) O(n) (B) O(log n) (C) O(n log n) (D) O(n^2) 5. : In heap sort, what is the process used to build a max-heap from an array? (A) Bubble up (B) Bubble down (C) Heapify (D) Merge 6. : Which of the following is a primary advantage of using a priority queue? (A) Faster deletion operations (B) Guaranteed constant-time access (C) Efficient retrieval of the maximum element (D) Ability to store elements in any order 7. : Which operation is typically used to remove the maximum element from a max-heap in a priority queue? (A) Extract min (B) Extract max (C) Delete (D) Remove 8. : In a min-heap-based priority queue, what operation retrieves the minimum element without removing it? (A) Peek (B) Poll (C) Pop (D) Remove 9. : Which sorting algorithm exhibits a stable behavior (preserves the relative order of equal elements)? (A) Quick sort (B) Heap sort (C) Merge sort (D) Bubble sort 10. : Which property of heap sort makes it suitable for applications requiring in-place sorting? (A) Stable sorting (B) Adaptive sorting (C) Recursive sorting (D) In-place sorting 11. : Which operation is used to convert an unordered array into a heap in heap sort? (A) Insertion (B) Deletion (C) Heapify (D) Merge 12. : What is the main disadvantage of using a heap-based priority queue compared to other data structures? (A) Slower insertion operations (B) Limited to fixed-size elements (C) Unstable retrieval of maximum element (D) Higher memory usage 13. : Which application often requires efficient priority queue operations? (A) Sorting names alphabetically (B) Implementing a scheduler for tasks (C) Counting occurrences of elements (D) Finding shortest paths in a graph 14. : In a priority queue implemented using a min-heap, what is the root element? (A) Smallest element (B) Largest element (C) Median element (D) Arbitrary element 15. : Which data structure does not use a heap for its implementation? (A) Binary Search Tree (B) AVL Tree (C) Red-Black Tree (D) Heap Tree 16. : What is the primary benefit of using heap sort over other sorting algorithms? (A) Stable sorting (B) Adaptive sorting (C) Worst-case time complexity (D) Ease of implementation 17. : Which operation in a priority queue is similar to removing the root in a heap? (A) Peek (B) Poll (C) Push (D) Pop 18. : Which property must be maintained during the heapify process in heap sort? (A) Parent node should be greater than both child nodes. (B) Parent node should be less than both child nodes. (C) Parent node should be equal to both child nodes. (D) Parent node should be greater than or equal to both child nodes. 19. : Which operation is not typically supported directly by a heap-based priority queue? (A) Insertion (B) Deletion of arbitrary elements (C) Merge of two priority queues (D) Extracting the minimum element 20. : Which sorting algorithm is generally preferred when stable sorting is not a requirement? (A) Merge sort (B) Heap sort (C) Bubble sort (D) Insertion sort Data Structures MCQs Basic Concepts Introduction to Data Structures Abstract Data Types (ADT) MCQs Complexity Analysis MCQs Time complexity MCQs Space complexity MCQs Big O, Big Ω, Big Θ notations MCQs Linear Data Structures MCQs Arrays MCQs One-dimensional arrays MCQs Multi-dimensional arrays MCQs Operations: traversal, insertion, deletion MCQs Linked Lists MCQs Singly linked list MCQs Doubly linked list MCQs Circular linked list MCQs Stacks MCQs Stack operations (push, pop, peek) MCQs Applications of stacks (expression evaluation, recursion) MCQs Queues MCQs Queue operations (enqueue, dequeue, front, rear) MCQs Types: Simple queue, circular queue, priority queue, deque MCQs Non-Linear Data Structures MCQs Trees MCQs Binary trees MCQs Binary Search Trees (BST) MCQs AVL Trees MCQs B-trees and B+ trees MCQs Tree traversal methods (in-order, pre-order, post-order) MCQs Heaps MCQs Min-heap MCQs Max-heap MCQs Heap operations (insertion, deletion, heapify) MCQs Applications of heaps (priority queues, heap sort) MCQs Graphs MCQs Graph representation (adjacency matrix, adjacency list) MCQs Graph traversal algorithms (DFS, BFS) MCQs Shortest path algorithms (Dijkstra’s, Bellman-Ford) MCQs Minimum Spanning Tree (Kruskal’s, Prim’s) MCQs Hashing MCQs MCQs Hash Tables Hash functions MCQs Collision resolution techniques (chaining, open addressing) MCQs Applications of hashing MCQs Sorting and Searching Algorithms MCQs Sorting Algorithms MCQs Bubble sort MCQs Selection sort MCQs Insertion sort MCQs Merge sort MCQs Quick sort MCQs Heap sort MCQs Searching Algorithms MCQs Linear search MCQs Binary search MCQs Interpolation search MCQs Miscellaneous Memory Management in data structures MCQs Dynamic memory allocation MCQs Garbage collection MCQs String Manipulation Algorithms MCQs Pattern matching (KMP, Rabin-Karp) MCQs String hashing MCQs Data Structures MCQs 1 Data Structures MCQs 2 Data Structures MCQs 3 Data Structures MCQs 4 Data Structures MCQs 5 Stacks Solved MCQs Queues MCQs pointer mcqs Array MCQs Related Posts:Heap sort MCQswrite a c program to sort a 1d array using pointer by applying bubble sort techniqueHeaps MCQsSimple queue, circular queue, priority queue, deque MCQsPriority Based Process Scheduling in operating systemsProgram to Implement Priority Queue in Data Structures (C plus plus)