State two advantages and two disadvantages of recursion compared with iteration.
Recursion
Original Khojo Papers practice question — not from a past board paper.
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); }
No citable source has been recorded for this record. Treat it as practice material, not as fact.
This is Euclid's algorithm; the base case b = 0 is reached because the remainder strictly decreases at every call.
From the same topic and chapter, at a similar level.
State two advantages and two disadvantages of recursion compared with iteration.
Recursion
Write a recursive Java method to compute the nth term of the Fibonacci sequence, taking the first two terms as 0 and 1.
Recursion
How many times is the method called in total when fact(5) is executed, taking fact(0) as the base case?
Recursion
Write a recursive Java method to reverse a string.
Recursion
Write a recursive Java method to compute the factorial of a non-negative integer n.
Recursion
State and verify the absorption law X + X·Y = X using a truth table.
Boolean Algebra