MCQOPTIONS
Saved Bookmarks
This section includes 7 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures Mcqs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What s happen if base condition is not defined in recursion ? |
| A. | Stack underflow |
| B. | Stack Overflow |
| C. | None of these |
| D. | Both a and b |
| Answer» C. None of these | |
| 2. |
Which of the following algorithm cannot be designed without recursion |
| A. | Tower of Hanoi |
| B. | Fibonacci Series |
| C. | Tree Traversal |
| D. | None of the above |
| Answer» E. | |
| 3. |
Infinite recursion leads to |
| A. | Overflow of run-time stack |
| B. | Underflow of registers usage |
| C. | Overflow of I/O cycles |
| D. | Underflow of run-time stack |
| Answer» B. Underflow of registers usage | |
| 4. |
What does the following function print for n = 25?void fun(int n){ if (n == 0) return; printf( %d , n%2); fun(n/2);} |
| A. | 11001 |
| B. | 10011 |
| C. | 11111 |
| D. | 00000 |
| Answer» C. 11111 | |
| 5. |
Predict output of following programConsider the following recursive function fun(x, y). What is the value of fun(4, 3)int fun(int x, int y) { if (x == 0) return y; return fun(x 1, x + y);} |
| A. | 13 |
| B. | 12 |
| C. | 9 |
| D. | 10 |
| Answer» B. 12 | |
| 6. |
What is the base case for the following code? |
| A. | Return |
| B. | Printf( %d , n) |
| C. | If(n == 0) |
| D. | My_recursive_function(n-1) |
| Answer» D. My_recursive_function(n-1) | |
| 7. |
If there is no base criteria in a recursive program, the program will . |
| A. | Not be executed |
| B. | Execute until all conditions match |
| C. | Execute infinitely |
| D. | Obtain progressive approach |
| Answer» D. Obtain progressive approach | |