CS 1401, Quiz 8

Date: Monday, October 30, 2006
Name (please type legibly, ideally in block letters): ______________________________________________________________________

1. Write a piece of code that, given an array h of real numbers, computes the average value of elements in this array.

2. To check the correctness of the code you wrote in Problem 1, write a piece of code that defines a new array h consisting of 2 elements of type double and assigns, to elements of this array, values 1.0 and 2.0. Trace step-by-step how the piece of code you wrote in Problem 1 will compute the average value of this array.