• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Dynamic Programming with Answers

Question 1

We use dynamic programming approach when

  • We need an optimal solution

  • The solution has optimal substructure

  • The given problem can be reduced to the 3-SAT problem

  • It\'s faster than Greedy

Question 2

An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array A[0 :n-1] is given below. Let Li denote the length of the longest monotonically increasing sequence starting at index i in the array. 
 

[caption width="800"]Equation[/caption]


Which of the following statements is TRUE?

  • The algorithm uses dynamic programming paradigm

  • The algorithm has a linear complexity and uses branch and bound paradigm

  • The algorithm has a non-linear polynomial complexity and uses branch and bound paradigm

  • The algorithm uses divide and conquer paradigm.

Question 3

Which of the following is NOT a characteristic of dynamic programming?

  • Memoization, which involves storing the results of expensive function calls and reusing them.

  • Breaking a problem into smaller overlapping subproblems.

  • Solving problems in a sequential manner.

  • Dynamic programming can be used for problems where the solution has an optimal substructure.

Question 4

What is the time complexity of Bellman-Ford single-source shortest path algorithm on a complete graph of n vertices?

  • θ(n2)

  • θ(n2 log n)

  • θ(n3)

  • θ(n3 log n)

Question 5

What happens when a top-down approach of dynamic programming is applied to any problem?
  • It increases both, the time complexity and the space complexity
  • It increases the space complexity and decreases the time complexity.
  • It increases the time complexity and decreases the space complexity
  • It decreases both, the time complexity and the space complexity

Question 6

Let A1, A2, A3, and A4 be four matrices of dimensions 10 x 5, 5 x 20, 20 x 10, and 10 x 5, respectively. The minimum number of scalar multiplications required to find the product A1A2A3A4 using the basic matrix multiplication method is

  • 1500

  • 2000

  • 500

  • 100

Question 7

Consider a sequence F00 defined as : F00(0) = 1, F00(1) = 1 F00(n) = 10 ∗ F00(n – 1) + 100 F00(n – 2) for n ≥ 2 Then what shall be the set of values of the sequence F00 ?
  • (1, 110, 1200)
  • (1, 110, 600, 1200)
  • (1, 2, 55, 110, 600, 1200)
  • (1, 55, 110, 600, 1200)

Question 8

The following paradigm can be used to find the solution of the problem in minimum time: Given a set of non-negative integer, and a value K, determine if there is a subset of the given set with sum equal to K:
  • Divide and Conquer
  • Dynamic Programming
  • Greedy Algorithm
  • Branch and Bound

Question 9

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

[caption width="800"]Question[/caption]


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 10

Consider two strings A = "qpqrr" and B = "pqprqrp". Let x be the length of the longest common subsequence (not necessarily contiguous) between A and B and let y be the number of such longest common subsequences between A and B. Then x + 10y = ___.

  • 33

  • 23

  • 43

  • 34

There are 30 questions to complete.

Last Updated :
Take a part in the ongoing discussion