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 LIS[5] after the following program is executed? |
| A. | 2 |
| B. | 3 |
| C. | 4 |
| D. | 5View Answer |
| Answer» D. 5View Answer | |
| 2. |
What is the space complexity of the following dynamic programming implementation used to find the length of the longest increasing subsequence? |
| A. | O(1) |
| B. | O(n) |
| C. | O(n2) |
| D. | O(nlogn)View Answer |
| Answer» C. O(n2) | |
| 3. |
What is the time complexity of the following dynamic programming implementation used to find the length of the longest increasing subsequence? |
| A. | O(1) |
| B. | O(n) |
| C. | O(n2) |
| D. | O(nlogn)View Answer |
| Answer» D. O(nlogn)View Answer | |
| 4. |
Complete the following dynamic programming implementation of the longest increasing subsequence problem: |
| A. | tmp_max = LIS[j] |
| B. | LIS[i] = LIS[j] |
| C. | LIS[j] = tmp_max |
| D. | tmp_max = LIS[i] View Answer |
| Answer» B. LIS[i] = LIS[j] | |
| 5. |
The number of increasing subsequences with the longest length for the given sequence are: {10, 9, 8, 7, 6, 5} |
| A. | 3 |
| B. | 4 |
| C. | 5 |
| D. | 6 |
| Answer» E. | |
| 6. |
Find the length of the longest increasing subsequence for the given sequence: {-10, 24, -9, 35, -21, 55, -41, 76, 84} |
| A. | 5 |
| B. | 4 |
| C. | 3 |
| D. | 6 |
| Answer» E. | |
| 7. |
Find the longest increasing subsequence for the given sequence: {10, -10, 12, 9, 10, 15, 13, 14} |
| A. | {10, 12, 15} |
| B. | {10, 12, 13, 14} |
| C. | {-10, 12, 13, 14} |
| D. | {-10, 9, 10, 13, 14} |
| Answer» E. | |
| 8. |
The longest increasing subsequence problem is a problem to find the length of a subsequence from a sequence of array elements such that the subsequence is sorted in increasing order and it’s length is maximum. This problem can be solved using __________ |
| A. | Recursion |
| B. | Dynamic programming |
| C. | Brute force |
| D. | Recursion, Dynamic programming, Brute force |
| Answer» E. | |
| 9. |
WHAT_IS_THE_TIME_COMPLEXITY_OF_THE_ABOVE_DYNAMIC_PROGRAMMING_IMPLEMENTATION_USED_TO_FIND_THE_LENGTH_OF_THE_LONGEST_INCREASING_SUBSEQUENCE??$ |
| A. | O(1) |
| B. | O(n) |
| C. | O(n<sup>2</sup>) |
| D. | O(nlogn) |
| Answer» C. O(n<sup>2</sup>) | |
| 10. |
What is the space complexity of the ABOVE dynamic programming implementation used to find the length of the longest increasing subsequence?$ |
| A. | O(1) |
| B. | O(n) |
| C. | O(n<sup>2</sup>) |
| D. | O(nlogn) |
| Answer» E. | |
| 11. |
In the brute force implementation to find the longest increasing subsequence, all the subsequences of a given sequence are found. All the increasing subsequences are then selected and the length of the longest subsequence is found. What is the time complexity of this brute force implementation? |
| A. | O(n) |
| B. | O(n<sup>2</sup>) |
| C. | O(n!) |
| D. | O(2<sup>n</sup>) |
| Answer» E. | |
| 12. |
For any given sequence, there will ALWAYS be a unique increasing subsequence with the longest length. |
| A. | True |
| B. | False |
| Answer» C. | |
| 13. |
The longest increasing subsequence problem is a problem to find the length of a subsequence from a sequence of array elements such that the subsequence is sorted in increasing order and it’s length is maximum. This problem can be solved using __________ |
| A. | Recursion |
| B. | Dynamic programming |
| C. | Brute force |
| D. | All of the mentioned |
| Answer» E. | |