CS 1044 Koofer Final Exam Key 1 5 *You* are responsible for handling logic errors. 2 4 3 3 4 1 5 5 6 3 7 2 8 3 9 3 10 3 Skips the first five characters -- doesn't reach the newline. 11 5 Skips through the newline. (File reopens at the beginning.) 12 2 13 5 A<=B is true; the if..else sets D = 2; then D = D*D squares D 14 3 15 1 16 5 The loop terminates when go reaches 0 -- trace the execution. 17 4 18 4 19 8 while and for are iteration mechanisms 20 1 The switch() takes the first case; Max returns 12. 21 2 22 1 23 1 You *can* put the prototype of one function inside the body of another. 24 2 It's the file-scoped i1 and the c1 local to main(); both passed by reference. 25 1 26 3 G() doesn't change the parameter i3; note the i3 local to the loop. 27 4 G() changes the parameter c2 to 'Q' 28 3 29 4 30 2 AddEm() doesn't need to change the array contents 31 3 AddEm() does need to set the value of Sum 32 3 Sum is used as a running total 33 1 Largest valid array index would be Size - 1 34 2 This is where the running total is calculated. 35 1 36 3 37 1 38 6 You need enough room for the string plus the terminating character. 39 1 List isn't a float, it's an array of floats. 40 1 Arrays can't be compared using ==. 41 2 List[2] == 0.2 and Vector[3] == 0.0 42 3 StrFunc() returns the index at which the string passed to it occurs 43 1 in the array Names, or -1 if the string isn't found. 44 3 45 1 46 2 47 1 48 3 49 3 50 6