Explore topic-wise MCQs in Data Structures and Algorithms.

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

You are given infinite coins of denominations 3, 5, 7. Which of the following sum CANNOT be achieved using these coins?

A. 15
B. 16
C. 17
D. 4
Answer» E.
2.

You are given infinite coins of denominations 5, 7, 9. Which of the following sum CANNOT be achieved using these coins?

A. 50
B. 21
C. 13
D. 23
Answer» D. 23
3.

Suppose you are given infinite coins of N denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the space complexity of a dynamic programming implementation used to solve the coin change problem?

A. O(N)
B. O(S)
C. O(N2)
D. O(S*N)
Answer» C. O(N2)
4.

You are given infinite coins of N denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the time complexity of a dynamic programming implementation used to solve the coin change problem?

A. O(N)
B. O(S)
C. O(N2)
D. O(S*N)
Answer» E.
5.

Fill in the blank to complete the code.

A. lookup[tmp] = min_coins
B. min_coins = lookup[tmp]
C. break
D. continueView Answer
Answer» C. break
6.

You are given infinite coins of denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. This problem can be solved using ____________

A. Greedy algorithm
B. Dynamic programming
C. Divide and conquer
D. Backtracking
Answer» C. Divide and conquer
7.

YOU_ARE_GIVEN_INFINITE_COINS_OF_DENOMINATIONS_1,_3,_4._WHAT_IS_THE_MINIMUM_NUMBER_OF_COINS_REQUIRED_TO_ACHIEVE_A_SUM_OF_7??$

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

You are given infinite coins of denominations 3, 5, 7. Which of the following sum CAN be achieved using these coins?$

A. 15
B. 16
C. 17
D. All of the mentioned
Answer» C. 17
9.

You are given infinite coins of denominations 5, 7, 9. Which of the following sum CANNOT be achieved using these coins?$

A. 50
B. 21
C. 13
D. 23
Answer» E.
10.

You are given infinite coins of denominations 1, 3, 4. What is the total number of ways in which a sum of 7 can be achieved using these coins if the order of the coins is not important?

A. 4
B. 3
C. 5
D. 6
Answer» C. 5
11.

Suppose you are given infinite coins of N denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the space complexity of a dynamic programming implementation used to solve the coin change problem?$

A. O(N)
B. O(S)
C. O(N<sup>2</sup>)
D. O(S*N)
Answer» D. O(S*N)
12.

You are given infinite coins of N denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the time complexity of a dynamic programming implementation used to solve the coin change problem?$

A. O(N)
B. O(S)
C. O(N<sup>2</sup>)
D. O(S*N)
Answer» C. O(N<sup>2</sup>)
13.

Suppose you have coins of denominations 1, 3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is not greater than the remaining sum. For which of the following sums, will the algorithm NOT produce an optimal answer?

A. 20
B. 12
C. 6
D. 5
Answer» D. 5
14.

You are given infinite coins of denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. This problem can be solved using ____________

A. Greedy algorithm
B. Dynamic programming
C. Divide and conquer
D. All of the mentioned
Answer» C. Divide and conquer