CS 2401 Quiz #5

Name: ____________________________________________________

Date: Monday, September 20, 2010.

1. Please answer the following questions about the reading assignment:

1a. An array has a variable size: once the size is declared, it can be changed (True or False):

1a. A vector has a variable size: once the size is declared, it can be changed (True or False):

1c. An enumerated type has a variable size: once the number of elements of this type is declared, it can be changed (True or False):

2. Write a recursive program for printing the following pattern of n lines:

                      * * * *
              * * *    * * *
       * *     * *      * *
   *    *       *        *     ...


n = 1  n = 2  n = 3    n = 4
Start with an algorithm, then transform this algorithm into a code, and trace this code for n = 3, for which your program should print the following pattern:
              * * *
               * *
                *