

MCQOPTIONS
Saved Bookmarks
This section includes 13 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. |
What is the value stored in arr[2][3] when the following code is executed? |
A. | 64000 |
B. | 60000 |
C. | 24000 |
D. | 12000View Answer |
Answer» C. 24000 | |
2. |
What is the space complexity of the following dynamic programming implementation of the matrix chain problem? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n3)View Answer |
Answer» D. O(n3)View Answer | |
3. |
What is the time complexity of the following dynamic programming implementation of the matrix chain problem? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n3)View Answer |
Answer» E. | |
4. |
Consider the following dynamic programming implementation of the matrix chain problem: Which of the following lines should be inserted to complete the above code? |
A. | arr[row][k] – arr[k + 1][col] + mat[row – 1] * mat[k] * mat[col]; |
B. | arr[row][k] + arr[k + 1][col] – mat[row – 1] * mat[k] * mat[col]; |
C. | arr[row][k] + arr[k + 1][col] + mat[row – 1] * mat[k] * mat[col]; |
D. | arr[row][k] – arr[k + 1][col] – mat[row – 1] * mat[k] * mat[col];View Answer |
Answer» D. arr[row][k] – arr[k + 1][col] – mat[row – 1] * mat[k] * mat[col];View Answer | |
5. |
Which of the following is the recurrence relation for the matrix chain multiplication problem where mat[i-1] * mat[i] gives the dimension of the ith matrix? |
A. | dp[i,j] = 1 if i=j dp[i,j] = min{dp[i,k] + dp[k+1,j]} |
B. | dp[i,j] = 0 if i=j dp[i,j] = min{dp[i,k] + dp[k+1,j]} |
C. | dp[i,j] = 1 if i=j dp[i,j] = min{dp[i,k] + dp[k+1,j]} + mat[i-1]*mat[k]*mat[j]. |
D. | dp[i,j] = 0 if i=j dp[i,j] = min{dp[i,k] + dp[k+1,j]} + mat[i-1]*mat[k]*mat[j]. |
Answer» E. | |
6. |
WHAT_IS_THE_TIME_COMPLEXITY_OF_THE_ABOVE_DYNAMIC_PROGRAMMING_IMPLEMENTATION_OF_THE_MATRIX_CHAIN_PROBLEM??$ |
A. | O(1) |
B. | O(n) |
C. | O(n<sup>2</sup>) |
D. | O(n<sup>3</sup>) |
Answer» D. O(n<sup>3</sup>) | |
7. |
What_is_the_space_complexity_of_the_above_dynamic_programming_implementation_of_the_matrix_chain_problem?$ |
A. | O(1) |
B. | O(n) |
C. | O(n<sup>2</sup>) |
D. | O(n<sup>3</sup>) |
Answer» B. O(n) | |
8. |
64000 |
A. | 70000 |
B. | 120000 |
C. | 150000 |
Answer» D. | |
9. |
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? |
A. | O(n!) |
B. | O(n<sup>3</sup>) |
C. | O(n<sup>2</sup>) |
D. | Exponential |
Answer» E. | |
10. |
Consider the matrices P, Q, R and S which are 20 x 15, 15 x 30, 30 x 5 and 5 x 40 matrices respectively. What is the minimum number of multiplications required to multiply the four matrices? |
A. | 6050 |
B. | 7500 |
C. | 7750 |
D. | 12000 |
Answer» D. 12000 | |
11. |
Consider the matrices P, Q and R which are 10 x 20, 20 x 30 and 30 x 40 matrices respectively. What is the minimum number of multiplications required to multiply the three matrices? |
A. | 18000 |
B. | 12000 |
C. | 24000 |
D. | 32000 |
Answer» B. 12000 | |
12. |
Consider the two matrices P and Q which are 10 x 20 and 20 x 30 matrices respectively. What is the number of multiplications required to multiply the two matrices? |
A. | 10*20 |
B. | 20*30 |
C. | 10*30 |
D. | 10*20*30 |
Answer» E. | |
13. |
Which of the following methods can be used to solve the matrix chain multiplication problem? |
A. | Dynamic programming |
B. | Brute force |
C. | Recursion |
D. | All of the mentioned |
Answer» E. | |