

MCQOPTIONS
Saved Bookmarks
This section includes 3 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structure knowledge and support exam preparation. Choose a topic below to get started.
1. |
How many times is the function recursive_search_num() called when the following code is executed? |
A. | 5 |
B. | 6 |
C. | 7 |
D. | 8View Answer |
Answer» C. 7 | |
2. |
Consider the following recursive implementation of linear search: Which of the following recursive calls should be added to complete the above code? |
A. | recursive_search_num(arr, num+1, idx, len); |
B. | recursive_search_num(arr, num, idx, len); |
C. | recursive_search_num(arr, num, idx+1, len); |
D. | recursive_search_num(arr, num+1, idx+1, len);View Answer |
Answer» D. recursive_search_num(arr, num+1, idx+1, len);View Answer | |
3. |
What is the time complexity of the following code used to search an element in an array? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n3)View Answer |
Answer» C. O(n2) | |