Top MCQs on Dynamic Programming with Answers

Last Updated :
Discuss
Comments

Question 1

Consider the weights and values of items listed below. Note that there is only one unit of each item.

Question


The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is denoted by Vopt. A greedy algorithm sorts the items by their value-to-weight ratios in descending order and packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy algorithm is denoted by Vgreedy. The value of Vopt − Vgreedy is ______ . 

  • 16

  • 8

  • 44

  • 60

Question 2

In dynamic programming, the time complexity of solving a problem with overlapping subproblems using memoization is:
 

  •  O(1)

  • O(log n)

  • O(n)

  • O(n^2)

Question 3

What is the main goal of the Word Break Problem?

  • To break a given string into individual characters. 

  • To determine if a string can be segmented into a sequence of words from a dictionary. 

  • To find the longest subsequence of a string. 

  • To reverse a given string.

Question 4

The Partition Problem can be reduced to which well-known problem? 

  •  Knapsack Problem 

  • Traveling Salesman Problem

  • Subset Sum Problem 

  • Graph Coloring Problem

Question 5

The "Egg Dropping Puzzle" involves determining the minimum number of attempts needed to find the critical floor from which an egg will break when dropped. What is the time complexity of the dynamic programming approach for solving the Egg Dropping Puzzle for K eggs and N floors?

  • O(K * N)

  •  O(K + N)

  • O(K * N^2)

  • O(K^2 * N)
     

Question 6

The "Longest Increasing Subsequence" problem involves finding the length of the longest subsequence of an array in which the elements are in increasing order. What is the time complexity of the dynamic programming approach for solving the LIS problem for an array of length n?

  •  O(n)

  • O(n log n)

  • O(n^2)

  • O(2^n)

Question 7

Which of the following problems is closely related to the Subsets Sum problem and can also be solved using dynamic programming?

  • Longest Common Subsequence Problem

  • Longest Palindromic Subsequence Problem

  • Coin Change Problem

  •  Optimal Binary Search Tree Problem

Question 8

Which of the following problems is closely related to the LPS problem and can also be solved using dynamic programming?
 


 

  •  Longest Common Subsequence Problem
     

  •  Longest Increasing Subsequence Problem
     

  • Edit Distance Problem

  • Subset Sum Problem

Question 9

In the 0-1 Knapsack Problem, if an item's weight is greater than the remaining capacity of the knapsack, what action is typically taken?

  • Ignore the item and move to the next one

     

  • Remove the least valuable item from the knapsack to make space

  •  Add the fractional part of the item that can fit into the knapsack

  • Remove the most valuable item from the knapsack to make space

Question 10

The time complexity of solving the 0-1 Knapsack Problem using dynamic programming with a bottom-up approach (tabulation) is:

  • O(n)

  •  O(n log n)

  • O(n * capacity)

  • O(n * capacity^2)

There are 30 questions to complete.

Take a part in the ongoing discussion