Question 2
My answer was D when the actual answer was A. Since getA is not a static method, it must be called with an object of SomeClass rather than the class name.
Question 3
My answer was B when the correct answer was C. Because it wouldn't meet the first requirement it would be passed to the else statement which would result in 2.333 but in this case, the values are int so it would be rounded to be 2.
Question 6
My answer was C when the correct answer was E. To determine the positive distance between two values, we need to take the absolute value of the difference using Math.abs. Additionally, we need to check to see if the positive difference is less than or equal to the tolerance instead of greater than or equal to the tolerance
Question 23
My answer was C when the actual answer was B. List is an interface, which an ArrayList implements. Please note that List is no longer tested as part of the AP CSA exam and ArrayList will be used instead. This would be the correct answer if the remove occurred before the size was calculated in the statement animals.add(animals.size()-k, animals.remove(k)); and only one iteration of the loop occurred.
Question 28
My answer was C when the correct answer was E. At //Point A, n is the value being passed in the parameter in the original call to the method mystery, which can be any int.
Question 33
My answer was B when the correct answer was E. I am going to be completely honest I kind of guessed on this answer so I don't know how it works.
Question 40
My answer was A when the actual answer was supposed to be C. This would be the output if the System.out.println(temp); line was before the recursive call to whatsItDo(temp); When the recursive call whatsItDo(temp); is executed, the current sequence of statements are paused.