Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 111 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.

101.

Consider a variation of the balanced partition problem in which we find two subsets such that |S1 – S2| is minimum. Consider the array {1, 2, 3, 4, 5}. Which of the following pairs of subsets is an optimal solution for the above problem?

A. {5, 4} & {3, 2, 1}
B. {5} & {4, 3, 2, 1}
C. {4, 2} & {5, 3, 1}
D. {5, 3} & {4, 2, 1}
Answer» E.
102.

WHICH_OF_THE_FOLLOWING_PROBLEMS_SHOULD_BE_SOLVED_USING_DYNAMIC_PROGRAMMING??$

A. Mergesort
B. Binary search
C. Longest common subsequence
D. Quicksort
Answer» D. Quicksort
103.

Which of the following problems is NOT solved using dynamic programming?

A. 0/1 knapsack problem
B. Matrix chain multiplication problem
C. Edit distance problem
D. Fractional knapsack problem
Answer» E.
104.

When a top-down approach of dynamic programming is applied to a problem, it usually ____________?

A. Decreases both, the time complexity and the space complexity
B. Decreases the time complexity and increases the space complexity
C. Increases the time complexity and decreases the space complexity
D. Increases both, the time complexity and the space complexity
Answer» C. Increases the time complexity and decreases the space complexity
105.

In dynamic programming, the technique of storing the previously calculated values is called ___________

A. Saving value property
B. Storing value property
C. Memoization
D. Mapping
Answer» D. Mapping
106.

A greedy algorithm can be used to solve all the dynamic programming problems.

A. True
B. False
Answer» C.
107.

When dynamic programming is applied to a problem, it takes far less time as compared to other methods that don’t take advantage of overlapping subproblems.$

A. True
B. False
Answer» B. False
108.

If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called _____________

A. Dynamic programming
B. Greedy
C. Divide and conquer
D. Recursion
Answer» D. Recursion
109.

If a problem can be broken into subproblems which are reused several times, the problem possesses ____________ property.

A. Overlapping subproblems
B. Optimal substructure
C. Memoization
D. Greedy
Answer» B. Optimal substructure
110.

If an optimal solution can be created for a problem by constructing optimal solutions for its subproblems, the problem possesses ____________ property.

A. Overlapping subproblems
B. Optimal substructure
C. Memoization
D. Greedy
Answer» C. Memoization
111.

Which of the following is/are property/properties of a dynamic programming problem?

A. Optimal substructure
B. Overlapping subproblems
C. Greedy approach
D. Both optimal substructure and overlapping subproblems
Answer» E.