

MCQOPTIONS
Saved Bookmarks
This section includes 7 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 will be the time complexity of the following code? |
A. | O(1) |
B. | O(n) |
C. | O(log n) |
D. | O(n log n)View Answer |
Answer» D. O(n log n)View Answer | |
2. |
What is the space complexity of the given code? |
A. | O(1) |
B. | O(n) |
C. | O(log n) |
D. | O(n log n)View Answer |
Answer» B. O(n) | |
3. |
What will be the time complexity of the following code which raises an integer x to the power y? |
A. | O(n) |
B. | O(log n) |
C. | O(n log n) |
D. | O(n2)View Answer |
Answer» B. O(log n) | |
4. |
What will be the output for following code? |
A. | 9 |
B. | 6 |
C. | 8 |
D. | 5View Answer |
Answer» D. 5View Answer | |
5. |
What is the least time in which we can raise a number x to power y? |
A. | O(x) |
B. | O(y) |
C. | O(log x) |
D. | O(log y) |
Answer» B. O(y) | |
6. |
Recursive program to raise an integer x to power y uses which of the following algorithm? |
A. | Dynamic programming |
B. | Backtracking |
C. | Divide and conquer |
D. | Greedy algorithm |
Answer» C. Divide and conquer | |
7. |
O(n) |
A. | O(log n) |
B. | O(n log n) |
C. | O(n<sup>2</sup>) |
Answer» D. | |