Name: ____________________________________________________ Alpha: _____________ Section: ________

Describe help received: _________________________________________________________________

See the bottom for how to submit your work.

Due: Before 0800 on next class day

  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] Consider the following code snippet.
    
    struct Grades
    {
      double* A;
      int N;
      string name;
    };
    
    int main()
    {
      int n;
      Grades* A = readfrom("data.txt", n);
      cout << "There are " << n << " entries" << endl;
      sort(A, n);
      int k = search(A[0].A, 20, 75.5);
      cout << A[0].A[k];
      return 0;
    }
    
    1. [14pts] For each expression on the right, if it were used inside the main function, what would be the type of the expression? Write the type, or write "error" if it will cause a compilation (syntax) error.
    expressiontype
    A
    A.name
    A.name[0]
    A.A
    A.A[0]
    A.N
    A.N[0]
    A[0]
    A[0].name
    A[0].name[0]
    A[0].A
    A[0].A[0]
    A[0].N
    A[0].N[0]
    1. [6pts] For each function used in the above code, write the prototype that would match the function.
      // write below the prototype of readfrom
      
      
      // write below the prototype of sort
      
      
      // write below the prototype of search
      
      
      
Bring to class