Answers to the midterm 1 from Brehob, Winter '05 Muliple guess 1. c (x is declared an int) 2. e 3. c 4. a 5. e 6. b 7. d 8. d 9. c 10. d Short answer 1. 7 12 2. yes, yes, no, no 3. 3 (the line break was part of the answer) 13 4. double piestimate double sum = 0; int i=1; while (i<=nterms) { term = 1.0/(i*i); ... } Coding 1. int x; int sum=0; for (x = 1; x <= MAX; x = x + 2) { sum = sum + x; } 2. Time convert_from_seconds(int sec) { Time tmp; tmp.hours=sec/3600; tmp.minutes=(sec%3600)/60; tmp.seconds=sec%60; return(tmp); } 3. See hob.cpp, hob1.cpp, and hob2.cpp