Game Preview

Recursion in Java

  •  English    6     Public
    Write the codes for recursive methods and determine its result.
  •   Study   Slideshow
  • The _________________ is the instance where a recursive method will return a value rather than calling itself.
    base case
  •  10
  • Where is/are the recursive call(s) in the getArea() method?
    line #4
  •  10
  • What value is returned from a call to mystery(1,5)?
    5
  •  10
  • What value is returned from a call to mystery(3,6)?
    18
  •  10
  • What is printed for the call myPrint(8)?
    8
  •  10
  • Complete the code for the recursive method printSum, which is intended to return the sum of digits from 1 to n.
    (n + printSum(n - 1))
  •  10