COMP11 Fall 2002 Answers to Sample Questions for Exam 3 Question 1 nums[] = {6,4,3,1,2} days[0-2] = {"Mon", "Mon", "Wed"} s = "Tufts"; Question 2 A. A = 7, 12, 51, 3, 66, 81 B. Yes C. A = 3, 7, 51, 66, 12, 81 D. Yes Question 3 string lowest (Student s[], int size, double min) { string name = "none"; double low; // assign low a high enough number (max+1) low = s[0].gpa; for (int i=1;i= min)) { low = s[i].gpa; name = s[i].name; } return name; } Question 4 void InPrint(int A[], int N) { if (N==1) { cout << A[0] << endl; return; } if (N==2) { cout << A[0] << " " << A[1] << endl; return; } // N >= 3 cout << A[0] << " " << A[N-1] << " "; // You can avoid using & if you use 2 arguments with start/end // here we move the start point using the & InPrint(&A[1],N-2); } Question 5 msort sorts each row of the array separately Question 6 int main() { int l, max=0; ifstream inp; string fname; cout << "Please enter input file name\n"; cin >> fname; inp.open(fname.c_str()); if (inp.fail()) exit(-1); do { l = getlength(inp); if (max> id >> name >> age; if (f.fail()) return -1; return name.length(); }