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].

3.
Consider the brute force implementation in which we find all the possible ways of multiplying the given set of n matrices. What is the time complexity of this implementation?

O(n!)

O(n^3)

O(n^2)

Exponential

4.
Consider the brute force implementation of the rod cutting problem in which all the possible cuts are found and the maximum value is calculated. What is the time complexity of this brute force implementation?

O(n^2)

O(n3)

O(nlogn)

O(2^n)

5.
Consider the following array: {1, 3, 5, 8, 9, 2, 6, 7, 6}What is the minimum number of jumps required to reach the end of the array?

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

8.
Consider the following assembly line problem.What is the minimum time required to build the car chassis?

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
0
Scroll to Top