Self-Review Exercises

18.1 State whether each of the following is true or false. If false, explain why.

a) A method that calls itself indirectly is not an example of recursion.

b) Recursion can be efficient in computation because of reduced memory-space usage.

c) When a recursive method is called to solve a problem, it actually is capable of solving only the simplest case(s), or base case(s).

d) To make recursion feasible, the recursion step in a recursive solution must resemble the original problem, but be a slightly larger version of it.

18.2 A __________ is needed to terminate recursion.

a) recursion step

b) break statement

c) void return type

d) base case

18.3 The first call to invoke a recursive method is __________.

a) not recursive

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.