MCQ Areas of improvement:
Q18
Answer A Incorrect. This code segment rotates the robot right once, then attempts to move the robot forward into the black region, causing execution to terminate.
Answer B (Correct. This code segment moves the robot forward whenever there is an open square in front of it. Once there is not an open square in front of it, the robot rotates right. The robot moves forward from its initial location to the upper right corner of the grid, then rotates right, then moves forward to the bottom right corner of the grid, then rotates right, then moves forward to the bottom left corner of the grid, then rotates right, then moves forward two squares to the gray square.)
Answer C Incorrect. This code segment rotates the robot right three times until it is facing toward the top of the grid and there is a free space to its right. It then attempts to move the robot forward off the edge of the grid, causing execution to terminate.
Answer D Incorrect. This code segment moves the robot forward to the upper right corner of the grid, then rotates right two times, then moves the robot forward to the upper left corner of the grid. It then attempts to move the robot forward off the edge of the grid, causing execution to terminate.
Q33
Answer A (Correct. Without knowing the individual assignment scores, the administrator is unable to determine any of the student’s individual scores other than the lowest score.)
Answer B Incorrect. This information can be determined by calculating the difference between the sum of the scores before the lowest score was dropped and the sum of the scores after the lowest score was dropped.
Answer C Incorrect. This information can be determined by calculating the difference between the original average and the course grade after the lowest score was dropped.
Answer D Incorrect. This information can be determined by comparing each student’s original average to the course grade after the lowest score was dropped.
Q54
Answer A Incorrect. The loop should traverse all elements of originalList, not all elements of newList.
Answer B Incorrect. This change will add only odd elements from originalList to newList instead of adding even elements.
Answer C (Correct. The given code segment traverses originalList from left to right and inserts all even elements at the beginning of newList. Repeatedly inserting these elements at the beginning of newList causes newList to have the copied elements appear in reverse order compared to their order in originalList. By changing line 5 to APPEND (newList, number), even values are added to the end of newList, ensuring that they will appear in the same relative order as they did in originalList.)
Answer D Incorrect. The given code segment inserts even elements from oldList at the beginning of newList, causing the elements to appear in reverse order.
Q56
Answer A Incorrect. Version I calls GetPrediction once for each element of idList, while version II calls GetPrediction twice for each element of idList (plus one more time at the end). Therefore, version II takes longer than version I.
Answer B Incorrect. Version I calls GetPrediction once for each element of idList, while version II calls GetPrediction twice for each element of idList (plus one more time at the end). Therefore, version II takes longer than version I.
Answer C Incorrect. Version I calls GetPrediction once for each element of idList, while version II calls GetPrediction twice for each element of idList (plus one more time at the end). Therefore, version II takes more than 1 minute longer than version I.
Answer D (Correct. Version I calls the GetPrediction procedure once for each element of idList, or four times total. Since each call requires 1 minute of execution time, version I requires approximately 4 minutes to execute. Version II calls the GetPrediction procedure twice for each element of idList, and then again in the final display statement. This results in the procedure being called nine times, requiring approximately 9 minutes of execution time.)
Q60
Answer A Incorrect. For example, assume that list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80]. The first line of code creates bothList, which contains [10, 10, 20, 30, 40, 50, 60, 20, 20, 40, 60, 80]. The second line of code creates uniqueList, which contains [10, 20, 30, 40, 50, 60, 80]. The third line of code assigns to count the length of bothList (12) minus the length of bothList (7), producing the incorrect result 5.
Answer B Incorrect. For example, assume that list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80]. The first line of code creates newList1, which contains [10, 20, 30, 40, 50, 60]. The second line of code creates newList2, which contains [20, 40, 60, 80]. The third line of code creates bothList, which contains [10, 20, 30, 40, 50, 60, 20, 40, 60, 80]. The fourth line of code assigns to count the length of list1 (7) plus the length of list2 (5) minus the length of bothList (10), producing the incorrect result 2.
Answer C Incorrect. For example, assume that list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80]. The first line of code creates newList1, which contains [10, 20, 30, 40, 50, 60]. The second line of code creates newList2, which contains [20, 40, 60, 80]. The third line of code creates bothList, which contains [10, 20, 30, 40, 50, 60, 20, 40, 60, 80]. The fourth line of code assigns to count the length of newList1 (6) plus the length of newList2 (4) minus the length of bothList (10), producing the incorrect result 0.
Answer D (Correct. This code segment creates newList1, containing the unique elements from list1, and newList2, containing the unique elements from list2. These two lists are combined to form bothList. Any elements that appear in both lists are removed from bothList to form uniqueList. The correct count is the difference between the lengths of bothList and uniqueList. For example, assume that list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80]. The first line of code creates newList1, which contains [10, 20, 30, 40, 50, 60]. The second line of code creates newList2, which contains [20, 40, 60, 80]. The third line of code creates bothList, which contains [10, 20, 30, 40, 50, 60, 20, 40, 60, 80]. The fourth line of code creates uniqueList, which contains [10, 20, 30, 40, 50, 60, 80]. Since bothList contains 10 elements and uniqueList contains 7 elements, the correct result 3 is assigned to count.)
Q65
Answer A Incorrect. This code segment stores the substring ”lope” in animal. It then concatenates ”lope” and ”a”, storing the result ”lopea” in animal. Lastly, it concatenates the substring ”jack” and ”lopea”, storing the result ”jacklopea” in animal.
Answer B (Correct. This code segment stores the substring ”lope” in animal. It then concatenates ”a” and ”lope”, storing the result ”alope” in animal. Lastly, it concatenates the substring ”jack” and ”alope”, storing the result ”jackalope” in animal.)
Answer C (Correct. This code segment stores the substring ”jack” in animal. It then concatenates ”jack” and ”a”, storing the result ”jacka” in animal. Lastly, it concatenates ”jacka” and the substring ”lope”, storing the result ”jackalope” in animal.)
Answer D Incorrect. This code segment stores the substring ”jack” in animal. It then concatenates ”jack” and ”a”, storing the result ”jacka” in animal. Lastly, it concatenates the substring ”lope” and ”jacka”, storing the result ”lopejacka” in animal.
Q66
Answer A (Correct. This line should be removed. The variable count should increase by 1 when currentNum is a perfect number, so it should only be incremented in the body of the IF statement.)
Answer B Incorrect. This line should not be removed. The variable count should increase by 1 when currentNum is a perfect number, so it should be incremented in the body of the IF statement.
Answer C (Correct. This line should be removed. Every integer from start to end should be checked, so currentNum should only be incremented inside the loop but outside the body of the IF statement.)
Answer D Incorrect. This line should not be removed. Every integer from start to end should be checked, so currentNum should be incremented inside the loop but outside the body of the IF statement.
Q67
Answer A (Correct. For this code segment, count is increased to 1 the first time ”birch” is encountered in the list. However, count is reset to 0 when the code segment moves to the next list element. The last time ”birch” is encountered in the list, count is again increased to 1, causing the procedure to return 1 instead of the intended result 2.)
Answer B (Correct. For this code segment, count is increased to 1 the first time ”maple” is encountered in the list. However, count is reset to 0 when the code segment moves to the next list element. This causes the procedure to return 0 instead of the intended result 1.)
Answer C Incorrect. For this code segment, count is increased to 1 when ”oak” is encountered as the last element of the list. The loop then terminates and the procedure returns the intended result 1.
Answer D Incorrect. For this code segment, count is initialized to 0. Since ”spruce” does not appear in the list, the procedure returns the intended result 0.
What did I learn from the Quiz? Taking the multiple-choice questions exam for AP Computer Science Principles (CSP) tested my knowledge and demonstrated to me how well I understood the course concepts. The examrequired me to use problem-solving skills and creative thinking to challenge complicated problems or ones that I did not understand, and displayed how concepts from AP CSP are used in the real world.
—————————————————————————-
My next steps: I will google and research more in depth of what I am unfamiliar with as well as reviewing what I already know so I have success at the Ap exam.
What exactly I struggled on
I had a lot of trouble of code procedure and how code iterates line through line. and I made silly erorrs due to me rushing. I would have done better if i took more time to analyze teh questions I missed.