NEOCODE

String Matching Algorithms MCQs

1. What is the worst-case time complexity of the Naive String Matching algorithm?

2. Which algorithm uses a rolling hash function to improve the average-case performance of string matching?

3. What is the worst-case time complexity of the Knuth-Morris-Pratt (KMP) algorithm?

4. What is the purpose of the prefix function Pi in the KMP algorithm?

5. Which of the following is true about the Rabin-Karp Algorithm?

6. What is the main advantage of the KMP algorithm over the Naive Algorithm?

7. In the Rabin-Karp Algorithm, what is the purpose of reducing the hash value modulo q ?

8. What is the time complexity of computing the prefix function Pi in the KMP algorithm?

9. Which of the following is a spurious hit in the Rabin-Karp Algorithm?

10. What is the key idea behind the KMP algorithm?

11. What is the primary disadvantage of the Naive String Matching algorithm?

12. In the Rabin-Karp Algorithm, what is the purpose of the rolling hash function?

13. What is the role of the modulus q in the Rabin-Karp Algorithm?

14. Which of the following is true about the KMP algorithm?

15. What is the time complexity of the Rabin-Karp Algorithm in the worst case?

16. What is the purpose of the prefix function Pi in the KMP algorithm?

17. Which of the following is true about the Rabin-Karp Algorithm?

18. What is the time complexity of the KMP algorithm's matching phase?

19. Which of the following is a key advantage of the Rabin-Karp Algorithm over the Naive Algorithm?

20. What is the purpose of the prefix function Pi in the KMP algorithm?