Heap sort MCQsBy: Prof. Dr. Fazal Rehman | Last updated: May 15, 2025 38 Score: 0 Attempted: 0/38 Subscribe 1. : What is the primary purpose of Heap Sort? (A) To search for an element (B) To sort an array (C) To merge two arrays (D) To partition data 2. : What is the time complexity of Heap Sort in the worst case? (A) O(n) (B) O(n log n) (C) O(n^2) (D) O(log n) 3. : Which data structure is used to implement Heap Sort? (A) Stack (B) Queue (C) Heap (D) Array 4. : What is the space complexity of Heap Sort? (A) O(1) (B) O(n) (C) O(n log n) (D) O(log n) 5. : How does Heap Sort differ from other sorting algorithms? (A) It is not based on comparisons. (B) It uses a divide and conquer approach. (C) It builds a heap data structure. (D) It is a stable sorting algorithm. 6. : What type of heap is commonly used in Heap Sort? (A) Min-Heap (B) Max-Heap (C) Binary Tree (D) Fibonacci Heap 7. : What is the main advantage of Heap Sort over Quick Sort? (A) It is stable. (B) It does not require additional memory. (C) It has better worst-case performance. (D) It is faster on average. 8. : What is the first step in the Heap Sort algorithm? (A) Sorting the array (B) Building the heap (C) Performing the merge (D) Partitioning the array 9. : In a Max-Heap, which of the following statements is true? (A) The parent node is less than or equal to its children. (B) The parent node is greater than or equal to its children. (C) All nodes have two children. (D) It is a complete binary tree. 10. : What happens during the heapify process? (A) The heap is sorted. (B) The heap property is restored. (C) The array is merged. (D) Elements are randomly shuffled. 11. : What is the effect of using a Min-Heap in Heap Sort? (A) It results in sorting in ascending order. (B) It results in sorting in descending order. (C) It makes the algorithm unstable. (D) It has no effect on the sorting order. 12. : What is the time complexity of building a heap? (A) O(n) (B) O(n log n) (C) O(log n) (D) O(n^2) 13. : Which of the following best describes the overall process of Heap Sort? (A) Build a heap, extract elements, and then sort. (B) Build a tree, perform an in-order traversal. (C) Sort by repeatedly swapping adjacent elements. (D) Merge sorted arrays. 14. : What is the maximum height of a binary heap? (A) O(1) (B) O(log n) (C) O(n) (D) O(n log n) 15. : Which of the following is not a property of a heap? (A) Complete binary tree (B) Parent is greater than children in Max-Heap (C) Parent is less than children in Min-Heap (D) The height can be less than log n 16. : What will be the output of Heap Sort on the array [4, 10, 3, 5, 1]? (A) [10, 5, 4, 3, 1] (B) [1, 3, 4, 5, 10] (C) [10, 4, 5, 3, 1] (D) [1, 4, 3, 5, 10] 17. : In Heap Sort, what is done after the heap is built? (A) The elements are added to the heap. (B) The largest element is extracted and placed in sorted order. (C) The array is divided into subarrays. (D) The heap is merged with another heap. 18. : What type of sorting algorithm is Heap Sort classified as? (A) Comparison-based sorting (B) Non-comparison based sorting (C) Adaptive sorting (D) Hybrid sorting 19. : Which step is repeated until the heap is empty in Heap Sort? (A) Merging (B) Heapifying (C) Extracting the maximum (D) Building the heap 20. : What is the purpose of the “sift down” operation in Heap Sort? (A) To build the heap (B) To restore the heap property (C) To merge two heaps (D) To sort the array 21. : Which of the following statements about Heap Sort is true? (A) It is a stable sorting algorithm. (B) It is an in-place sorting algorithm. (C) It is inefficient for large datasets. (D) It can sort linked lists efficiently. 22. : How is the time complexity of Heap Sort affected by the size of the input? (A) It increases linearly with the size. (B) It is constant regardless of input size. (C) It increases logarithmically with the size. (D) It increases proportionally to n log n. 23. : What is the primary disadvantage of Heap Sort compared to Quick Sort? (A) It requires more space. (B) It is always slower. (C) It is not stable. (D) It cannot handle large datasets. 24. : Which of the following operations is not performed in Heap Sort? (A) Building the heap (B) Extracting the maximum (C) Merging two heaps (D) Restoring heap property 25. : What will be the output of applying Heap Sort on the array [8, 4, 7, 3, 2]? (A) [2, 3, 4, 7, 8] (B) [8, 7, 4, 3, 2] (C) [3, 4, 7, 8, 2] (D) [2, 4, 3, 7, 8] 26. : What is the initial step in the Heap Sort algorithm? (A) Extracting elements (B) Heapifying the array (C) Merging two sorted arrays (D) Finding the median 27. : In a Min-Heap, which statement is true? (A) The parent node is greater than its children. (B) The parent node is less than its children. (C) It is not a complete binary tree. (D) It can have missing nodes. 28. : How does the performance of Heap Sort compare to Merge Sort in practice? (A) Heap Sort is generally faster. (B) Merge Sort is generally faster. (C) They perform equally well in all scenarios. (D) It depends on the specific implementation. 29. : What is the effect of using a binary heap for sorting? (A) It allows for quicker search operations. (B) It provides a method for in-place sorting. (C) It guarantees a stable sort. (D) It allows for parallel processing. 30. : What is the process of “sifting up” in a heap? (A) Adding a new element to the heap (B) Removing the maximum element (C) Adjusting the heap after insertion (D) Sorting the elements 31. : What happens to the structure of a heap during Heap Sort? (A) It becomes unbalanced. (B) It is preserved. (C) It is destroyed. (D) It is rebuilt from scratch. 32. : Which of the following sorting algorithms is not comparison-based? (A) Heap Sort (B) Quick Sort (C) Counting Sort (D) Merge Sort 33. : What is a key factor in determining the efficiency of Heap Sort? (A) Choice of data structure (B) Input data size (C) Memory allocation (D) Pivot selection 34. : Which operation is required to convert an array into a heap? (A) Heapify (B) Partition (C) Merge (D) Sort 35. : What kind of trees are heaps? (A) Full binary trees (B) Complete binary trees (C) Balanced binary trees (D) Degenerate trees 36. : How is the root node in a Max-Heap related to its children? (A) It is less than both children. (B) It is equal to one child and greater than the other. (C) It is greater than or equal to both children. (D) It has no relation. 37. : What is the effect of reducing the size of the heap during Heap Sort? (A) It improves performance. (B) It has no effect. (C) It increases complexity. (D) It helps maintain the heap property. 38. : In Heap Sort, what is done after the largest element is extracted from the heap? (A) The heap is rebuilt. (B) The remaining elements are sorted. (C) The heap property is restored. (D) The sorted array is finalized. 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:Applications of heaps (priority queues, heap sort) MCQswrite a c program to sort a 1d array using pointer by applying bubble sort techniqueMemory management (stack, heap, static)(MCQs)Heap operations (insertion, deletion, heapify) MCQsMax-heap MCQsMin-heap MCQs