Recursion and Iteration (OCR A-Level Computer Science): Quizzes
📚Quizzes
Practise the questions
12 questions from this quiz
ShowHide
Practise the questions
12 questions from this quiz
What is recursion?
What is recursion?
A function that calls itself
What is the base case in recursion?
What is the base case in recursion?
The condition that stops recursion
What does the call stack do in recursion?
What does the call stack do in recursion?
Stores current state of each call
What determines when an iterative loop continues?
What determines when an iterative loop continues?
The loop condition
How does recursion compare to iteration in memory usage?
How does recursion compare to iteration in memory usage?
Uses more memory due to call stack
How does iteration compare to recursion in performance?
How does iteration compare to recursion in performance?
Generally faster and more efficient
What error can occur if a recursive function lacks a base case?
What error can occur if a recursive function lacks a base case?
Stack overflow
What is the main risk with iteration if the loop condition is incorrect?
What is the main risk with iteration if the loop condition is incorrect?
Infinite loops
For which type of problem is recursion a natural fit?
For which type of problem is recursion a natural fit?
Tree traversal
Why is iteration better for large data sets?
Why is iteration better for large data sets?
Avoids stack overflow issues
What is a drawback of iteration for complex problems?
What is a drawback of iteration for complex problems?
Less intuitive to implement
What is the purpose of trace tables?
What is the purpose of trace tables?
Track variable values at each step
