CIS71, Section 4 FIVE MINUTE TEST #9 November 7, 2006 (10) 1. (a) We want to open the file temp.txt for input. Write the necessary code. (b) We want instead to write to temp.txt. Write the necessary code. (10) 2. Given the definitions typedef struct Foo {int x; double y} foo; Declare an array of 5 foo and initialize it to all 0s. (10) 3. foo is as defined in question 2. What is printed out by the following code void moo(foo a) { a.x = 3; a.y = 2.7; } foo b = {1, 3.1}; moo(b); foo c = b; printf("b.x=%d, b.y=%lf, c.x=%d, c.y=%ld\n", b.x, b.y, c.x, c.y); (10) 4. foo is as defined in question 2. Write the function void avg(int n, foo a[n]) which prints out the average value of the x filed and the average value of the y field for the elements in array a.