Skip Top Navigation Bar

Evaluating Recursive Calls

Evaluating Expressions

Grab a Piece of Paper!

Draw a tracing diagram for each recursive call.

Verify your answer by running the code in the Java Playground.

Practice 1: Computing Factorial

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 2: Sum of Digits

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 3: Reverse String

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 4: Count the Number of Digits

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 5: Reverse Number

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Array Practice

If you haven't completed the tutorials on Array, you should explore them and complete the associated practice before attempting the following recursion and array questions.

Practice 6: Find Maximum in an Array

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 7: Sum of Array Elements

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.

Practice 8: Check if Array is Sorted in Ascending Order

  • Identify the base case and the recursive call.
  • Trace the provide code segment and predict the output.
  • Verify your prediction is correct by running the code in the Java Playground.