

MCQOPTIONS
Saved Bookmarks
This section includes 15 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 space complexity of the following dynamic programming implementation used to compute the nth fibonacci term? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | ExponentialView Answer |
Answer» C. O(n2) | |
2. |
What is the time complexity of the following dynamic programming implementation used to compute the nth fibonacci term? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | ExponentialView Answer |
Answer» C. O(n2) | |
3. |
Consider the following code to find the nth fibonacci term using dynamic programming: Which technique is used by line 7 of the above code? |
A. | Greedy |
B. | Recursion |
C. | Memoization |
D. | Overlapping subproblemsView Answer |
Answer» D. Overlapping subproblemsView Answer | |
4. |
Consider the following code to find the nth fibonacci term using dynamic programming: Which property is shown by line 7 of the above code? |
A. | Optimal substructure |
B. | Overlapping subproblems |
C. | Both overlapping subproblems and optimal substructure |
D. | Greedy substructureView Answer |
Answer» B. Overlapping subproblems | |
5. |
What will be the output when the following code is executed? |
A. | 34 |
B. | 55 |
C. | Compile error |
D. | Runtime errorView Answer |
Answer» C. Compile error | |
6. |
What is the space complexity of the following for loop method used to compute the nth fibonacci term? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | ExponentialView Answer |
Answer» B. O(n) | |
7. |
What is the time complexity of the following for loop method used to compute the nth fibonacci term? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | ExponentialView Answer |
Answer» C. O(n2) | |
8. |
Suppose we find the 8th term using the recursive implementation. The arguments passed to the function calls will be as follows: Which property is shown by the above function calls? |
A. | Memoization |
B. | Optimal substructure |
C. | Overlapping subproblems |
D. | GreedyView Answer |
Answer» D. GreedyView Answer | |
9. |
Consider the recursive implementation to find the nth fibonacci number: Which line would make the implementation complete? |
A. | fibo(n) + fibo(n) |
B. | fibo(n) + fibo(n – 1) |
C. | fibo(n – 1) + fibo(n + 1) |
D. | fibo(n – 1) + fibo(n – 2)View Answer |
Answer» E. | |
10. |
The following sequence is a fibonacci sequence:0, 1, 1, 2, 3, 5, 8, 13, 21,…..Which technique can be used to get the nth fibonacci term? |
A. | Recursion |
B. | Dynamic programming |
C. | A single for loop |
D. | Recursion, Dynamic Programming, For loops |
Answer» E. | |
11. |
WHAT_IS_THE_SPACE_COMPLEXITY_OF_THE_RECURSIVE_IMPLEMENTATION_USED_TO_FIND_THE_NTH_FIBONACCI_TERM??$ |
A. | O(1) |
B. | O(n) |
C. | O(n<sup>2</sup>) |
D. | O(n<sup>3</sup>) |
Answer» B. O(n) | |
12. |
What is the space complexity of the ABOVE for loop method used to compute the nth fibonacci term? |
A. | O(1) |
B. | O(n) |
C. | O(n<sup>2</sup>) |
D. | Exponential |
Answer» C. O(n<sup>2</sup>) | |
13. |
What is the time complexity of the ABOVE for loop method used to compute the nth fibonacci term ? |
A. | O(1) |
B. | O(n) |
C. | O(n<sup>2</sup>) |
D. | Exponential |
Answer» D. Exponential | |
14. |
125355638? |
A. | 5635632456 |
B. | Garbage value |
C. | Runtime error |
Answer» C. Runtime error | |
15. |
What is the time complexity of the recursive implementation used to find the nth fibonacci term? |
A. | O(1) |
B. | O(n<sup>2</sup>) |
C. | O(n!) |
D. | Exponential |
Answer» D. Exponential | |