Advanced Topics MCQ
Code Tracing: Recursion
Code Tracing: Recursion
Question 1 of 25
Answered 0 of 25
Choose one answer.
What is printed by the recursive method call?
public class RecursionTrace
{
public static int twist(int n)
{
if (n <= 1) return n + 0;
return twist(n - 1) - twist(n - 2) + n;
}
public static void main(String[] args)
{
System.out.println(twist(5));
}
}