Collegeboard Test Corrections
- Score: 36/40
- Corrections for Q4
- Corrections for Q5
- Corrections for Q12
- Corrections for Q40
- Reflection
Corrections for Q4
The value of 2.33333 is incorrect because it is the result if the division used was floating point division, instead of integer division.
For it to be correct, evaluating x < 10 && y < 0 for x having the value 7 and y have a value of 3, x < 10 is true since 7 is less than 10 and y is less than 0 makes it false since 3 is not less than 0. The operator && evaluates to true when both conditions are true and evaluates to false otherwise. As a result, compiler will skip first output and execute the else statement for integer division for 7 / 3, which is 2.
Corrections for Q5
B is incorrect as this would be the output if k was initialized to 0.
The correct answer is C. As the method mystery contains a loop that starts k at 1 and iterates, incrementing k by 1 until k exceeds n, which is 6. In each iteration, the Integer value k * k + 3 is added to the ArrayList seq. As the iterations continue {4, 7, 12, 19, 28, 39} is formed.
Corrections for Q12
D is incorrect. This would be the return value if k was incremented by 1 instead of 2 and the loop condition was changed to k < input.length()- 1.
The correct answer is C. The value of the loop control variable k starts at 1 and is incremented by 2 as long as it is less than input.length. The input is “computer”, so input.length is 8. The values of k are 1, 3, 5, 7, and then when k is 9, the loop terminates. The statement input.substring (k, k + 1) will return the value of input at index k. Output is “o”, “p”, “t”, and “r”. The value “optr” is returned.
Corrections for Q40
Answer D is incorrect. When whatsItDo(“W”) is called, nothing is printed since the print occurs in the if statement which does not execute. All previous recursive method calls print a substring of str and not str.
C is correct. The call whatsItDo(“WATCH”) assigns to temp a substring of “WATCH” starting at 0 and ending at 4 – 1 or 3, which is “WATC”. Next the call whatsItDo(“WATC”) is made. The call whatsItDo(“WATC”), sets its local temp to “WAT” and calls whatsItDo(“WAT”). The call whatsItDo(“WAT”), sets its local temp to “WA” and calls whatsItDo(“WA”). The call whatsItDo(“WA”), sets its local temp to “W” and calls whatsItDo(“W”). The call whatsItDo(“W”) reaches the base case and doesn’t do anything since the length of “W” is 1. Then we need to finish the call to whatsItDo(“WA”), which prints the value of its local temp, “W”.
Reflection
Taking AP CSP last year, I wanted to further my computer science education by taking AP CSA the sequential year. The Java syntax was really different than the python syntax I learned last year but it was still very interesting. I believe that our group dynamic was really nice and I also learned from my team members.
What I want to get better at is working with backend and try making my own API next trimester.