Design and Analysis of Algorithms MCQs with Answers
Practice important Design and Analysis of Algorithms MCQs with answers and explanations.
Chapter: 4
Q61:
Which of the following is NOT a sorting algorithm?
A. Bubble Sort
B. Insertion Sort
C. Selection Sort
D. Queue Sort
Correct Answer:
D
Chapter: 4
Q62:
What is the time complexity of Bubble Sort in the worst case?
A. Θ(n log n)
B. Θ(n^2)
C. Θ(n)
D. Θ(log n)
Correct Answer:
B
Chapter: 4
Q63:
Which of the following is true about Selection Sort?
A. It finds the largest element each pass
B. It finds the smallest element each pass
C. It uses recursion
D. It is a parallel algorithm
Correct Answer:
B
Chapter: 4
Q64:
What does a min-heap store at its root node?
A. The largest key
B. The smallest key
C. The average key
D. The first inserted key
Correct Answer:
B
Chapter: 4
Q65:
What is the principal operation in maintaining heap order called?
A. BuildHeap
B. Heapify
C. Sortify
D. ReHeap
Correct Answer:
B
Chapter: 4
Q66:
In a binary heap, the left child of a node at index i is located at which index?
A. i/2
B. i+2
C. 2*i
D. 2*i + 1
Correct Answer:
C
Chapter: 4
Q67:
Which sorting algorithm has a time complexity of Θ(n log n) in the best and worst cases?
A. Quick Sort
B. Merge Sort
C. Selection Sort
D. Bubble Sort
Correct Answer:
B
Chapter: 4
Q68:
In Heapsort, after removing the maximum item, what step is performed next?
A. Insert item at root
B. Replace it with last leaf
C. Insert item at end
D. Swap items at random
Correct Answer:
B
Chapter: 4
Q69:
What is the purpose of the ‘Heapify’ procedure?
A. To keep the heap sorted
B. To restore heap order
C. To delete nodes from the heap
D. To remove duplicates
Correct Answer:
B
Chapter: 4
Q70:
In a min-heap, which of the following is always true for any two nodes X and Y?
A. X < Y
B. X > Y
C. Parent of X is greater than Y
D. Parent of X is smaller than Y
Correct Answer:
D
Chapter: 4
Q71:
The sorting algorithm used to ensure elements are arranged in increasing order is?
A. Binary Search
B. Selection Sort
C. Heapsort
D. BFS
Correct Answer:
C
Chapter: 4
Q72:
Which algorithm does not use pointers while storing nodes?
A. Merge Sort
B. Heapsort
C. Quick Sort
D. Insertion Sort
Correct Answer:
B
Chapter: 4
Q73:
What does the 'left(i)' function return in a binary heap?
A. Index of the right child
B. Index of the left child
C. Index of the parent
D. Index of the root
Correct Answer:
B
Chapter: 4
Q74:
In Heapsort, what is the main purpose of the ‘heapify’ process?
A. To ensure binary order
B. To restore the heap property
C. To delete root node
D. To increase node height
Correct Answer:
B
Chapter: 4
Q75:
What is the expected height of a complete binary heap with n nodes?
A. Θ(log n)
B. Θ(n)
C. Θ(n^2)
D. Θ(1)
Correct Answer:
A
Chapter: 4
Q76:
Which of the following is NOT a characteristic of Heapsort?
A. Utilizes a heap data structure
B. Worst case is Θ(n^2)
C. Can be done in-place
D. Requires heapify
Correct Answer:
B
Chapter: 4
Q77:
The Heapify function restores heap order starting from which node?
A. Left child
B. Root node
C. Right child
D. Last leaf
Correct Answer:
B
Chapter: 4
Q78:
What is the main strategy behind Quicksort?
A. Divide and conquer
B. Merge and sort
C. Divide and merge
D. Insert and delete
Correct Answer:
A
Chapter: 4
Q79:
Which algorithm is primarily based on the partitioning of data around a pivot?
A. Mergesort
B. Quicksort
C. Heapsort
D. Bubblesort
Correct Answer:
B
Chapter: 4
Q80:
In Quicksort, the array is divided based on the value of a ______.
A. midpoint
B. pivot
C. median
D. last element
Correct Answer:
B