CIS1057 FIVE MINUTE TEST #9 November 16, 2010 (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. We are given the integer variable x and and a double variable y. We want to store their values in the C string char c[32]. Write the required code.