COM1201 Spring 1997 Professor Fell QUIZ 2
Problem 1: (7.5 points) Write the body of the function:

template <class T>
int Max (T Arr[], int n){
// precondition: n is the number of valid elements in Arr[]
// postcondition: returns the index of the maximum value in Arr[]





};

Problem 2: (7.5 points) Fill in the following table:
DecimalBinaryHex
1023  
  10100101  
   C5
42   
  111

Problem 3: (5 points) For the following code segment, show the values of x, y, *p, *q at the five places indicated.

int x = 3; 
int  y = 5;
int *p = &x; int *q = &y; // 1a. x, y, *p, *q *p += y; // 1b. x, y, *p, *q y = x + *p; // 1c. x, y, *p, *q q = p; // 1d. x, y, *p, *q p = &y; // 1e. x, y, *p, *q

Last Updated: April 11, 1997 12:29 pm by

Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM1101/QUIZ/Q2/quiz2.html