                          Computer Science 101
                               Quiz B      Name ______________________


1. Suppose table[k] = 44 and table[k + 1] = 22 and the following statements
   are executed:

       table[k] = table[k + 1];
       table[k + 1] = table[k];

   After these two statments are executed what values will be held in:

   table[k]     =                 table[k + 1] =

2. Suppose table[k] = 44 and table[k + 1] = 22 and the following statements
   are executed:

         temp = table[k + 1];
         table[k] = table[k + 1];
         table[k + 1] = temp

   After these two statments are executed what values will be held in:

   table[k]     =                 table[k + 1] =

3. Suppose table[k] = 44 and table[k + 1] = 22 and the following statements
   are executed:

       temp = table[k];
       table[k] = table[k + 1];
       table[k + 1] = temp

   After these two statments are executed what values will be held in:

   table[k]     =                 table[k + 1] =


4. Consider the "swapper" function in which the program proceeds from
   index 0 comparing each adjacent pair of values in the array and swapping
   values if table[k] > table[k + 1].  What is the correct output for this
   input:
          4  19  3  4  25  1  7





5. Suppose we want to SORT an array of N elements so that the values are
   in strictly increasing order. We can do this by:

   a. calling the "swapper" function    b. calling the swapper function
      once                                 N times


   c. no amount of calling swapper
      will ever sort the array.


