

MCQOPTIONS
Saved Bookmarks
This section includes 15 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.
1. |
What is the value stored in arr[2][2] when the following code is executed? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4View Answer |
Answer» C. 3 | |
2. |
What is the space complexity of the following dynamic programming implementation of the edit distance problem where “m” and “n” are the lengths of the two strings? |
A. | O(1) |
B. | O(m + n) |
C. | O(mn) |
D. | O(n)View Answer |
Answer» D. O(n)View Answer | |
3. |
What is the time complexity of the following dynamic programming implementation of the edit distance problem where “m” and “n” are the lengths of two strings? |
A. | O(1) |
B. | O(m + n) |
C. | O(mn) |
D. | O(n)View Answer |
Answer» D. O(n)View Answer | |
4. |
Consider the following dynamic programming implementation of the edit distance problem: Which of the following lines should be added to complete the above code? |
A. | arr[i-1][j] = min |
B. | arr[i][j-1] = min |
C. | arr[i-1][j-1] = min |
D. | arr[i][j] = minView Answer |
Answer» E. | |
5. |
Consider the two strings “”(empty string) and “abcd”. What is the edit distance between the two strings? |
A. | 0 |
B. | 4 |
C. | 2 |
D. | 3 |
Answer» C. 2 | |
6. |
Consider the strings “monday” and “tuesday”. What is the edit distance between the two strings? |
A. | 3 |
B. | 4 |
C. | 5 |
D. | 6 |
Answer» C. 5 | |
7. |
What is the space complexity of the above dynamic programming implementation of the edit distance problem where “m” and “n” are the lengths of the two strings?$# |
A. | O(1) |
B. | O(m + n) |
C. | O(mn) |
D. | None of the mentioned |
Answer» E. | |
8. |
What is the time complexity of the above dynamic programming implementation of the edit distance problem where “m” and “n” are the lengths of two strings?$# |
A. | O(1) |
B. | O(m + n) |
C. | O(mn) |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
9. |
Consider the two strings “”(empty string) and “abcd”. What is the edit distance between the two strings?$ |
A. | 0 |
B. | 4 |
C. | None of the mentioned |
D. | Cannot be determined |
Answer» C. None of the mentioned | |
10. |
Consider the strings “monday” and “tuesday”. What is the edit distance between the two strings?$ |
A. | 3 |
B. | 4 |
C. | 5 |
D. | 6 |
Answer» C. 5 | |
11. |
Suppose each edit (insert, delete, replace) has a cost of one. Then, the maximum edit distance cost between the two strings is equal to the length of the larger string. |
A. | True |
B. | False |
Answer» B. False | |
12. |
In which of the following cases will the edit distance between two strings be zero? |
A. | When one string is a substring of another |
B. | When the lengths of the two strings are equal |
C. | When the two strings are equal |
D. | The edit distance can never be zero |
Answer» D. The edit distance can never be zero | |
13. |
Which of the following is an application of the edit distance problem? |
A. | Approximate string matching |
B. | Spelling correction |
C. | Similarity of DNA |
D. | All of the mentioned |
Answer» E. | |
14. |
The edit distance satisfies the axioms of a metric when the costs are non-negative. |
A. | True |
B. | False |
Answer» B. False | |
15. |
Which of the following methods can be used to solve the edit distance problem? |
A. | Recursion |
B. | Dynamic programming |
C. | Both dynamic programming and recursion |
D. | None of the mentioned |
Answer» D. None of the mentioned | |