The questions below are meant to stimulate the preparation of the final exam. They cover some of the most important but not all topics in the course. You must review all course materials: textbook, exercises, lecture notes, quizzes, and exams.
void distribute ( int N, float data[], int m, float freq[], int h );
/* on return, the array freq contains the following m numbers :
freq[0] counts the numbers in data less than zero,
freq[1] counts the numbers in data less than h, and >= 0,
freq[2] counts the numbers in data less than 2*h, and >= h,..,
freq[i] counts the numbers in data less than i*h, and >= (i-1)*h,..,
freq[m-1] counts the numbers in data >= (m-2)*h. */
Give a definition for distribute.
int count_occurrences ( int n, char s[], char c );
/* returns number of occurrences of c in s */
For example, if s = { 'l','a','s','t',' ','d','a','y' },
then int_occurrences(8,s,'a') returns two.
double max ( int n, double *a );
/* returns the maximal value in the array a */
double dotprod ( int n, double x[], double y[] );
/* returns the sum of the elements in x componentwise
multiplied with those in y */
Change the prototype and rewrite you definition using only pointers.
float *multiply ( int n, int m, float *a, float *x );
/* multiplies the nxm-matrix a with the m-vector x */
You must allocate memory for the result.
FINAL EXAM is in Lecture Center C6 on Monday 3 December 2001 from 1:00 till 3:00PM.
Please let me know as soon as possible if you cannot attend the exam and need to schedule a makeup.
Incomplete grades are only given in exceptional cases. At least the two following conditions must be satisfied: the student is in good standing (has decent scores on midterm exams, projects, and quizzes) and the student is unable to take an exam during the finals week.