# Dynamic Programming Mcqs

Our collections of Multiple choice questions and answers focuses on study of ” Dynamic Programming ” in Data Structures. These questions are chosen from a collection of most authoritative and best reference books on Data Structures. Our aim is to prepare an individual for competitive exams like NTS | GAT | ECAT | Data Warehouse jobs | Data Mining | DB administration jobs Software House and Computer Programmer jobs | University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate knowledge on Dynamic Programming comprehensively.

## 1. Complete the following code for Kadane’s algorithm:

Max_num(sum, sum + arr[idx])

Sum

Sum + arr[idx].

Max_num(sum,ans)

## 2. Complete the following dynamic programming implementation of the longest increasing subsequence problem:

Tmp_max = LIS[j].

LIS[i] = LIS[j].

LIS[j] = tmp_max

Tmp_max = LIS[i].

O(n!)

O(n^3)

O(n^2)

Exponential

O(n^2)

O(n3)

O(nlogn)

O(2^n)

1

2

3

4

## 6. Consider the following assembly line problem.For the optimal solution which should be the starting assembly line?

Line 1

Line 2

All of the mentioned

None of the mentioned

## 7. Consider the following assembly line problem.For the optimal solution, which should be the exit assembly line?

Line 1

Line 2

All of the mentioned

None of the mentioned

40

41

42

43

## 9. Consider the following code snippet:Which method is used by line 4 of the above below snippet?

Divide and conquer

Recursion

Both memoization and divide and conquer

Memoization

## 10. Consider the following code snippet:Which property is shown by line 4 of the below code snippet?

Optimal substructure

Overlapping subproblems

Both overlapping subproblems and optimal substructure

None of the mentioned

## 11. Consider the following code to find the nth fibonacci term using dynamic programming:Which property is shown by line 7 of the below code?

Optimal substructure

Overlapping subproblems

Both overlapping subproblems and optimal substructure

None of the mentioned

## 12. Consider the following code to find the nth fibonacci term using dynamic programming:Which technique is used by line 7 of the below code?

Greedy

Recursion

Memoization

None of the mentioned

## 13. Consider the following code to find the nth fibonacci term.Complete the below code.

PrevFib = curFib
curFib = curFib

PrevFib = nextFib
curFib = prevFib

PrevFib = curFib
curFib = nextFib

None of the mentioned

## 14. Consider the following code. Which of the following lines completes the below code?

Strrev(str2)

Str2 = str1

Len2 = strlen(str2)

None of the mentioned

## 15. Consider the following code.Which of the following lines should be inserted to complete the below code?

T2[i] = get_min(t2[i-1]+spent[1][i], t1[i-1]+reach[0][i-1]+spent[1][i])

T2[i] = get_min(t2[i-1]+spent[1][i], t1[i-1]+spent[1][i])

T2[i] = get_min(t2[i-1]+spent[1][i], t1[i-1]+reach[0][i-1])

None of the mentioned

0Shares
Scroll to Top