Practice question · Select all that apply
Select every statement the lesson supports about choosing recursion over iteration.
Hints
- The lesson says the choice is about clarity and cost, which options claim something stronger?
- One tempting option would mean recursion is more powerful, not merely more convenient.
Show the answer
- A. Recursion can express naturally-recursive problems such as trees more clearly
- B. Each recursive call carries overhead and occupies space on the call stack
- C. Iteration is usually more memory-efficient for simple repetition
Why
Anything recursive can be written iteratively and vice versa, so neither is more capable; the real differences are clarity for nested problems against the per-call time and stack cost. Believing recursion can do more than iteration is the misconception the lesson corrects, and 'always shorter' is a style claim the lesson never makes.
Practise Recursion and Iterative Alternatives
The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Recursion and Iterative Alternatives
- The lesson's factorial function is called as factorial(3). Order the events by when they happen in time.
- Every recursive function can be rewritten as a loop, and every loop can be rewritten recursively. Why does…
- A recursive function that would need a million frames crashes in Python and runs fine in a language with…
- A recursive function that has a base case cannot recurse forever.