The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 Test 4 Solution November 20, 2002 1. F 2. T 3. F 4. F 5. F 6. T 7. T 8. F 9. B 10. a 11. b 12. d 13. c 14. d 15. d 16. c 17. d 18. d 19. driver 20. scope 21. selection 22. Overflow 23. Promotion 24. selection 25. cout << oneBoard.dimensionds.width; 26. a. enum Degrees {CHE, CE, CPE, EE, ISE, MAE, OPE}; b. Degrees Convert (string Major) { Degrees result; switch(toupper(Major[0])) { case 'C' : switch(toupper(Major[1])) { case 'H' : result = CHE; break; case 'E' : result = CE; break; case 'P' : result = CPE; break; } case 'E' : result = EE; break; case 'I' : result = ISE; break; case 'M' : result = MAE; break; case 'O' : result = OPE; break; } } c. Degrees myDegree; string myMajor; myDegree = Convert(myMajor); 27. x = 3 after the call to DoReference x = 16 after the call to DoValue x = 17 after the call to DoLocal x = 7 after the call to DoGlobal 28. person.name.first = "Beverly"; person.name.last = "Johnson"; person.address.city = "La Crosse"; person.address.state = "WI"; person.address.zipCode = 54601; 29. int summation (int num) { int result = 0; if (num < 0 ) result = -1; else for (; num > 0; num--) result = result + num; return result; }