Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [10 pts] We would like you to self-test how much you retained from the lecture. Write the correct solution to the Mandatory Practice Problems. Debug your code until it runs correctly. Circle below how you wrote your code.
    1. (10 pts) I was able to write the code without referring to anything.
    2. (10 pts) I had to look at the notes, but still I was able to write the code without looking at the solution.
    3. (10 pts) I had to look at solutions to finish to code.
    4. (0 pts) I didn't do this.
    If you had to look at the solution, briefly describe what you missed but understand now.
    
    
    
    
  2. [10pts] Complete the code below that creates a variable A and allocates and initializes so that we have the situation depicted in the picture.
    
    
    int** A;
    
    A =                                ;
    
    for (           ;              ;             ) 
    {
    
      A[  ] =                    ; 
    
      for(              ;              ;                )
      {
          A[i][j] =                            ;
      }
    }
    
  3. [10pts] Write a complete definition of function print_col that could be called like this print_col(A,5,4,1) (assuming the above situation) to print the index 1 column of the array A. Thus, the call print_col(A,5,4,1) would produce the output shown below.
      1
      11
      21
      31
      41

    Note: the function should work for any 2D array of ints with proper dimensions and column number