Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. (10 pts) Read today's lecture notes. Honestly declare how you read the notes.
    1. (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
    2. (10 pts) I read the notes carefully, but I don't really understand the following points well:
      
      
    3. (0 pts) I didn't read the notes carefully.
  2. [20pts] Assume the following declarations and fill in the table with either the type of the given expression, or "error" if appropriate.
    
    double x;
    string s;
    double* A;
    int** M;
    string** W;
    
    expressiontype
    x
    s
    A
    M
    W
    x[0]
    s[0]
    A[0]
    M[0]
    W[0]
    expressiontype
    x[0][0]
    s[0][0]
    A[0][0]
    M[0][0]
    W[0][0]
    x[0][0][0]
    s[0][0][0]
    A[0][0][0]
    M[0][0][0]
    W[0][0][0]
  3. [10pts] Consider a variable A of type int** that is initialized so we have the situation depicted in the picture: . 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 any column number.


Bring to class