Recursion Advanced

Download Q&A
Q. In a recursive function, what is the purpose of the return statement?
  • A. To terminate the program
  • B. To return control to the caller
  • C. To call the function again
  • D. To print the output
Q. What happens if a recursive function does not have a base case?
  • A. It will run indefinitely
  • B. It will return a default value
  • C. It will throw an error
  • D. It will terminate successfully
Q. What is tail recursion?
  • A. Recursion where the last operation is a recursive call
  • B. Recursion that does not use any stack
  • C. Recursion that calls itself multiple times
  • D. Recursion that has no base case
Q. What is the time complexity of a recursive function that divides the problem size by half at each step?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(2^n)
Q. Which of the following is a base case in a recursive function?
  • A. The case that leads to infinite recursion
  • B. The case that stops the recursion
  • C. The case that calls the function again
  • D. The case that doubles the input size
Q. Which of the following is an example of a problem that can be solved using divide and conquer?
  • A. Binary search
  • B. Fibonacci sequence
  • C. Linear search
  • D. Bubble sort
Q. Which of the following is true about recursive algorithms?
  • A. They always run faster than iterative algorithms
  • B. They can be less memory efficient due to call stack
  • C. They cannot be used for sorting
  • D. They are always easier to understand
Q. Which of the following problems can be solved using recursion?
  • A. Finding the maximum element in an array
  • B. Calculating the factorial of a number
  • C. Sorting an array
  • D. All of the above
Showing 1 to 8 of 8 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely