MCQ Test 2
Collegeboard Multiple Choice Quiz 2 Score
My Score
Corrections
Question 5: A code segment will be used to swap the values of the variables a and b using the temporary variable temp. Which of the following code segments correctly swaps the values of a and b? I thought the answer was option A, but it was actually option B. This is because the value of variable b is stored in the variable a. Then the value of the variable a (which now contains the original value of the variable b) is stored in the variable temp. Finally, the value of the variable temp (which now contains the original value of the variable b) is stored in the variable b. Both a and b store the original value of b.
Question 7: A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of goats and sheep throughout the text. Consider the programmer’s goal of changing all occurrences of “goats” to “sheep” and all occurrences of “sheep” to “goats.” The programmer will use the fact that the word “foxes” does not appear anywhere in the original text. Which of the following algorithms can be used to accomplish the programmer’s goal? I thought that the answer was to First, change all occurrences of “goats” to “foxes.” Then, change all occurrences of “foxes” to “sheep.” Last, change all occurrences of “sheep” to “goats.” However this was incorrect, as you would first change all occurrences of “goats” to “foxes.” Then, change all occurrences of “sheep” to “goats.” and lastly, change all occurrences of “foxes” to “sheep.”
Question 30: The drawCircle procedure is to be used to draw the following figure on a coordinate grid. Which of the following code segments can be used to draw the figure? Out of the two answers that I selected, 1 of them was correct but the other one wasn’t. I misread the iteration in that option and realize my mistake now.
Reflection
I think I did pretty good on this test as I only missed 3 questions out of 50. This is significant improvement from my trimester 1 final, in which I got a 41/50. I felt that the questions that were more wordy and required more thinking were harder for me and the ones that I missed were due to both a lapse of concentration and misunderstanding the answer options. I plan to practice more of these before the actual ap exam.