Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 13 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[3][3] when the below code is executed?

A. 1
B. 2
C. 3
D. 4View Answer
Answer» D. 4View Answer
2.

What is the space complexity of the above implementation of Wagner–Fischer algorithm where “m” and “n” are the lengths of the two strings?

A. O(1)
B. O(n+m)
C. O(mn)
D. O(nlogm)
Answer» D. O(nlogm)
3.

What is the time complexity of the Wagner–Fischer algorithm where “m” and “n” are the lengths of the two strings?

A. O(1)
B. O(n+m)
C. O(mn)
D. O(nlogm)
Answer» D. O(nlogm)
4.

Consider the following implementation of the Wagner–Fischer algorithm: Which of the following lines should be inserted to complete the above code?

A. arr[i][j] = min
B. min = arr[i-1][j-1] – 1;
C. min = arr[i-1][j-1].
D. min = arr[i-1][j-1] + 1;View Answer
Answer» D. min = arr[i-1][j-1] + 1;View Answer
5.

What is the edit distance between the strings “abcd” and “acbd” when the allowed operations are insertion, deletion and substitution?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
6.

Wagner–Fischer algorithm is used to find ____________

A. Longest common subsequence
B. Longest increasing subsequence
C. Edit distance between two strings
D. Longest decreasing subsequence
Answer» D. Longest decreasing subsequence
7.

Wagner–Fischer is a ____________ algorithm.

A. Brute force
B. Greedy
C. Dynamic programming
D. Recursive
Answer» D. Recursive
8.

What is the space complexity of the above implementation of Wagner–Fischer algorithm where “m” and “n” are the lengths of the two strings?#

A. O(1)
B. O(n+m)
C. O(mn)
D. O(nlogm)
Answer» B. O(n+m)
9.

What is the time complexity of the Wagner–Fischer algorithm where “m” and “n” are the lengths of the two strings?$

A. O(1)
B. O(n+m)
C. O(mn)
D. O(nlogm)
Answer» D. O(nlogm)
10.

For which of the following pairs of strings is the edit distance maximum?

A. sunday & monday
B. monday & tuesday
C. tuesday & wednesday
D. wednesday & thursday
Answer» E.
11.

What is the edit distance between the strings “abcd” and “acbd” when the allowed operations are insertion, deletion and substitution?$

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
12.

Wagner–Fischer algorithm is used to find ____________$

A. Longest common subsequence
B. Longest increasing subsequence
C. Edit distance between two strings
D. All of the mentioned
Answer» D. All of the mentioned
13.

Wagner–Fischer is a ____________ algorithm.

A. Brute force
B. Greedy
C. Dynamic programming
D. Recursive
Answer» D. Recursive