CIS71, Section 4 FIVE MINUTE TEST #6 October 17, 2006 (10) 1. (a) What are the preconditions of a function? (b) What are the postconditions of a function? (10) 2. Here is a function that given an integer array a with n elements returns the largest value in a. What is the loop invariant? int findMax(int a[], in n) { int who = a[0]; int k; for ( k = 1; k < n; k++ ) if ( a[k] > who ) who = a[k]; return who; } (5) 3. What is printed out by the following statements? printf("$"); int k; for ( k = 1; k <= 5; k++) printf("$"); printf("*\n"); (5) 4. What does the input function fgets do? (10) 5. Implement the function int mystrlen(const char *s) that has the same behavior as the standard function strlen (i.e. it returns the lenght of the string s).