MCQs with Options - Unit V: Searching, Sorting and Hashing Techniques
1. 1. Which of the following sorting algorithms is based on the divide and conquer
paradigm?
A. Insertion Sort
B. Quick Sort
C. Bubble Sort
D. Selection Sort
Answer: B
2. 2. What is the worst-case time complexity of Merge Sort?
A. O(n)
B. O(n log n)
C. O(n^2)
D. O(log n)
Answer: B
3. 3. Insertion sort is most efficient when:
A. Data is randomly ordered
B. Data is sorted in reverse
C. Data is already sorted
D. Data is large
Answer: C
4. 4. Quick Sort uses which of the following techniques?
A. Dynamic Programming
B. Divide and Conquer
C. Greedy
D. Backtracking
Answer: B
5. 5. Merge Sort is preferred over Quick Sort for:
A. Small datasets
B. Linked Lists
C. Arrays
D. Stack implementations
Answer: B
6. 6. Which sorting algorithm is stable?
A. Quick Sort
B. Merge Sort
C. Heap Sort
D. Selection Sort
Answer: B
7. 7. What is the average case time complexity of Quick Sort?
A. O(n)
B. O(n log n)
C. O(n^2)
D. O(log n)
Answer: B
8. 8. What is the auxiliary space complexity of Merge Sort?
A. O(n)
B. O(log n)
C. O(n log n)
D. O(1)
Answer: A
9. 9. Which sorting algorithm performs best on nearly sorted data?
A. Merge Sort
B. Insertion Sort
C. Quick Sort
D. Heap Sort
Answer: B
10. 10. Which of the following has the worst time complexity of O(n^2)?
A. Merge Sort
B. Quick Sort
C. Insertion Sort
D. None
Answer: C
11. 11. What is the primary use of hashing?
A. Sorting
B. Searching
C. Compressing
D. Encrypting
Answer: B
12. 12. What is a hash function?
A. A function that compresses data
B. A mapping from keys to indices
C. An encryption method
D. A sorting algorithm
Answer: B
13. 13. Which of the following is a common hashing technique?
A. Folding
B. Merge
C. Bitmasking
D. Shuffling
Answer: A
14. 14. The division method in hashing uses:
A. Sum of digits
B. Square of key
C. Modulus operator
D. Prime addition
Answer: C
15. 15. Which hashing technique squares the key and extracts middle digits?
A. Division
B. Folding
C. Mid Square
D. Double Hashing
Answer: C
16. 16. In folding method of hashing, the key is:
A. Halved
B. Split and added
C. Multiplied
D. Reversed
Answer: B
17. 17. A good hash function should:
A. Minimize collisions
B. Be complex
C. Use recursion
D. Be slow
Answer: A
18. 18. Which of these is NOT a collision resolution strategy?
A. Chaining
B. Open Addressing
C. Folding
D. Rehashing
Answer: C
19. 19. What is a collision in hashing?
A. When two keys have same value
B. When two keys map to same index
C. When hash table is full
D. When searching fails
Answer: B
20. 20. Which hash function is best for uniformly distributed keys?
A. Division
B. Mid Square
C. Folding
D. Depends on use case
Answer: D
21. 21. In separate chaining, collisions are resolved by:
A. Replacing values
B. Linked lists
C. Arrays
D. Trees
Answer: B
22. 22. Open addressing handles collisions by:
A. Using another table
B. Linear probing
C. Doubling table size
D. Using stacks
Answer: B
23. 23. Which technique uses probing to find next empty slot?
A. Separate Chaining
B. Open Addressing
C. Rehashing
D. Folding
Answer: B
24. 24. In linear probing, if a collision occurs, we:
A. Go to next cell
B. Use hash again
C. Restart hashing
D. Add to list
Answer: A
25. 25. Quadratic probing avoids clustering by:
A. Jumping cells quadratically
B. Using new hash
C. Restarting
D. Reordering keys
Answer: A
26. 26. Which method handles overflow in hash table using multiple hash functions?
A. Rehashing
B. Double Hashing
C. Folding
D. Mid Square
Answer: B
27. 27. Rehashing is triggered when:
A. Load factor exceeds threshold
B. All keys are stored
C. No collision
D. Key is duplicate
Answer: A
28. 28. What is the main purpose of rehashing?
A. Compress data
B. Reduce memory
C. Avoid clustering
D. Increase table size
Answer: D
29. 29. In separate chaining, each bucket is:
A. A single cell
B. A list of keys
C. An integer
D. A stack
Answer: B
30. 30. Which of the following can lead to primary clustering?
A. Linear Probing
B. Quadratic Probing
C. Chaining
D. Mid Square
Answer: A
31. 31. Hashing improves search time to:
A. O(n)
B. O(log n)
C. O(1)
D. O(n log n)
Answer: C
32. 32. What is the average time complexity of searching in a hash table?
A. O(n)
B. O(1)
C. O(n log n)
D. O(log n)
Answer: B
33. 33. In hashing, load factor is defined as:
A. Keys / Size of table
B. Size of table / Keys
C. Hash / Probing
D. Keys * Size
Answer: A
34. 34. Which of the following does not involve probing?
A. Linear Probing
B. Quadratic Probing
C. Double Hashing
D. Chaining
Answer: D
35. 35. Rehashing helps in:
A. Preventing overflow
B. Reducing collisions
C. Increasing efficiency
D. All of the above
Answer: D
36. 36. Mid Square method works well when:
A. Keys are uniform
B. Keys are sequential
C. Keys are large numbers
D. All
Answer: C
37. 37. Which sorting technique is recursive by nature?
A. Insertion Sort
B. Merge Sort
C. Bubble Sort
D. Selection Sort
Answer: B
38. 38. Which of the following sorting algorithms is not stable?
A. Merge Sort
B. Insertion Sort
C. Quick Sort
D. Bubble Sort
Answer: C
39. 39. Which hashing technique is best for text-based keys?
A. Folding
B. Mid Square
C. Polynomial Rolling Hash
D. Linear Probing
Answer: C
40. 40. Hash table is efficient for:
A. Sorting
B. Searching
C. Insertion
D. Both B and C
Answer: D