Title: Chapter 14 Review
Course: Programming Fundamentals II (TEMPLATE)

COSC 1337 - Programming Fundamentals II

Chapter 14 Review Exercises

I recommend that you review the chapter by doing these exercises. I will NOT grade these exercises.

The exam will cover only sections 14.1-14.4.

Consider reviewing the Checkpoint questions from this chapter.
Answers to Checkpoint questions are in Appendix P (on the CD that came with your textbook).

Review Questions and Exercises: 3, 5, 7a.
Answers to Review Questions and Exercises are in Appendix Q (on the CD that came with your textbook).

Other Questions

1. Given the recursive factorial function from the textbook:

int factorial( int num )
{
   if ( num == 0 )
      return 1;
   else
      return num * factorial( num - 1 );
}

What is the base case for this function?

What is the recursive case for this function?

Given the call:

cout << factorial(5) << endl;


How many times does the factorial function execute (how many calls are there to factorial including the original call)?

2. Given the recursive message function from the textbook:

void message( int times )
{
   if ( times > 0 )
   {
      cout << "This is a recursive function.\n";
      message( times - 1 );
   }
}

What is the base case for this function?

What is the recursive case for this function?

Answers to Other Questions are here.

© Austin Community College 2016. The content on this page is licensed under a
Creative Commons Attribution 4.0 International License.
Last updated: July 26, 2013