11. What is the key data structure used in the Knuth-Morris-Pratt (KMP) algorithm for pattern matching? A. Hash Table B. Suffix Tree C. Failure Function D. Partial Match Table Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
12. What does the Rabin-Karp algorithm use to avoid unnecessary comparisons? A. Rolling Hash B. Partial Match Table C. Failure Function D. Boyer-Moore Heuristic Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
13. In which situation does the Knuth-Morris-Pratt (KMP) algorithm perform particularly well? A. When the pattern is very short. B. When the text is randomly structured. C. When the text contains many repetitions. D. When the pattern is long and the text is large. Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
14. Which string matching algorithm uses a heuristic to improve efficiency by skipping sections of the text? A. Rabin-Karp B. Knuth-Morris-Pratt (KMP) C. Boyer-Moore D. Naive Search Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
15. What is the primary benefit of using the Rabin-Karp algorithm? A. Lower space complexity compared to others. B. Efficient for multiple pattern matching using hashing. C. Better for single pattern matching. D. Lower space complexity compared to others. Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
16. What is the preprocessing phase in the Knuth-Morris-Pratt (KMP) algorithm used for? A. To find all possible matches. B. To sort the text. C. To create a partial match table. D. To compute hash values for patterns. Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
17. Which algorithm is considered to be the fastest for string matching in practice, especially for large texts? A. Rabin-Karp B. Knuth-Morris-Pratt (KMP) C. Naive Search D. Boyer-Moore Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
18. How does the Rabin-Karp algorithm handle collisions in hashing? A. By using a rolling hash. B. By using a secondary hash function. C. By rehashing the entire pattern. D. By using a separate data structure. Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
19. In the Boyer-Moore algorithm, what is the purpose of the bad character rule? A. To preprocess the text. B. To sort characters of the pattern. C. To check for hash collisions. D. To skip portions of the text that cannot match. Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
20. What is the time complexity of the Knuth-Morris-Pratt (KMP) algorithm for pattern matching? A. O(m*n) B. O(m log n) C. O(m + n) D. O(n) Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board