13.9 Exercises, Problems, and Projects

13.9.1 Multiple Choice Exercises

  1.   1. A recursive method

    • ❑ is always a static method.

    • ❑ is never a static method.

    • ❑ may or may not be static.

  2.   2. A recursive method

    • ❑ is always a method with a void return value.

    • ❑ is always a value-returning method.

    • ❑ can be either of the above.

  3.   3. When formulating a recursive solution, what should we consider?

    • ❑ base cases and general case

    • ❑ base cases only

    • ❑ general case only

  4.   4. A recursive method

    • ❑ is a method containing a loop.

    • ❑ calls itself.

    • ❑ is part of the java.recursion package.

  5.   5. When coding a class that includes a recursive method, we need to import the java.recursion package.

    • ❑ true

    • ❑ false

  6.   6. If the base case of a ...

Get Java Illuminated, 5th 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.