The University of Alabama in Huntsville Electrical & Computer Engineering CPE 112 02 Fall 2001 Test 2 Solution 1. False 2. True 3. True 4. True 5. False 6. True 7. False 8. True 9. e 10. b 11. c 12. e 13. b 14. d 15. c 16. c 17. d 18. b 19. c 20. e 21. ((testScore >= 90) && (testScore <= 100)) 22. postcondition 23. Syntax 24. metalanguage 25. whitespace 26. Echo printing 27. he_time_fo, where _ is blank 28. if (temp > 85) cout << "Swimming" << endl; else if (temp > 70) cout << "Tennis" << endl; else if (temp > 32) cout << "Golf" << endl; else if (temp > 0) cout << "Skiing" << endl; else cout << "Dancing" << endl; 29. Inputs: Three coefficients (a, b, and c) Outputs: Two solutions (sol1 and sol2), and the three coefficients Algorithm: Get Coefficients Echo Print Coefficients sol1 = -b + sqrt(b*b - 4*a*c)/(2*a) sol2 = -b - sqrt(b*b - 4*a*c)/(2*a) Print sol1, sol2 30. corrected code if (typeA || typeB) { if (typeA && typeB) cout << "Type AB"; } else cout << "Type O";