Test Key -- CS1044 Spring 2002, Test #2 FORM A: 1. 5 Trace gives I: 12 11 10 9 8 J: 0 11 21 30 38 2. 6 3. 9 while, for, do...while are interation mechanisms 4. 5 Trace gives j: 2 5 8 11 14 17 20 23 26 29... 5. 3 The eight value is 23 6. 7 mystery is 5, the values of sum are 3, 1, 5, 6, 13 7. 8 the values of sum are 5, 8, 6, 10, 11, 18 8. 4 the values of sum 5, 8; -2 terminates the loop 9. 6 sum is incremented 6 times (3 times for each of two i loops) 10. 3 sum is reset to zero after first i loop 11. 9 a reference parameter must be a variable 12. 7 must include "out of the function" 13. 3 alpha is a value parameter, beta a reference parameter or 6 the prototype must include the type of the function 14. 4 the call to DoThis changes the value of Ben in main from -5 to 95. Temp and Jerry retain their original values of 15 and 42. 15. 3 16. 8 17. 5 an integer is return when a character value parameter is passed 18. 3 the for loops writes out two Es 19. 1 N will be increased to 143, but the last N output is 71. 20. 2 the 75 character array has indices 0 through 74. 21. 5 4 values are output from Ray[4] to Ray[1] 22. 8 only 1 and 3 output Fred[0], Fred[2], Fred[4]... 23. 2 syntactically legal, but aRay[5] and bRay[5] are not allocated 24. 1 the order fo the parameters 4 and aRay should be reversed. 25. 3 since bRay[4] is 2, this is both syntactically legal and logically correct. 26. 2 arrays are passed by reference by default, no & is needed 27. 1 HowMany is an integer value parameter 28. 1 only the index needs to be initialized. 29. 2 the last index is HowMany-1 30. 3 the index is changed to Look FORM B: Q# in Form B Corresponding Q# in Form A 1 12 2 13 3 4 4 5 5 3 6 6 7 7 8 8 9 11 10 14 11 15 12 16 13 17 14 18 15 19 16 1 17 2 18 9 19(answer choice is 4) 10(answer choice is 3) 20 20 21 22 22 26 23 27 24 28 25 29 26 30 27 23 28 24 29 25 30 21