• Reflection

I got a 59/67. I am pretty surprised that I got this score. Originally, I was very unconfident with many of the questions and I ended up doing poorly. This time however, I only got a few of them incorrect, meaning that my performance definitely increased. Here is a review of all the questions that I got incorrect and how I can avoid making them during the AP Test.

QUESTION 64

The following procedure is intended to return the value of x times y, where x and y are integers. Multiplication is implemented using repeated additions.

The figure presents a block of code that consists of 7 lines. Throughout the block of code there are nested blocks of code. [Begin Block] Line 1: PROCEDURE Multiply [begin block] x, y [end block] [Begin Block] Line 2: [begin block] count ← 0 [end block] Line 3: [begin block] result ← 0 [end block] [Begin Block] Line 4: REPEAT UNTIL [begin block] count ≥ y [end block] [Begin Block] Line 5: [begin block] result ← result + x [end block] Line 6: [begin block] count ← count + 1 [end block] [End Block] [End Block] Line 7: [begin block] RETURN [begin block] result [end block] [end block] [End Block] [End Block] For which of the following procedure calls does the procedure NOT return the intended value?

Select two answers.

A The figure presents a line of code. The line of code contains a nested block of code. Line 1: [begin block] Multiply [begin block] 2, 5 [end block] [end block]

B The figure presents a line of code. The line of code contains a nested block of code. Line 1: [begin block] Multiply [begin block] 2, −5 [end block] [end block]

C The figure presents a line of code. The line of code contains a nested block of code. Line 1: [begin block] Multiply [begin block] −2, 5 [end block] [end block]

D The figure presents a line of code. The line of code contains a nested block of code. Line 1: [begin block] Multiply [begin block] −2, −5 [end block] [end block]

Answer B Correct. Since y is initially negative, the loop condition count ≥ y is initially true, so the body of the loop is never executed and 0 is returned.

QUESTION 62

Assume that the Boolean variable x is assigned the value true and the Boolean variable y is assigned the value false. Which of the following will display the value true ?

Select two answers.

A The figure presents a block of code that consists of 2 lines. Throughout the code are nested blocks of code. [Begin block] Line 1: IF [begin block] x [end block] [Begin Block] Line 2: [begin block] DISPLAY [begin block] x OR y [end block] [End Block] [End Block] [End Block]

B The figure presents a block of code that consists of 2 lines. Throughout the code are nested blocks of code. [Begin block] Line 1: IF [begin block] x OR y [end block] [Begin Block] Line 2: [begin block] DISPLAY [begin block] x [end block] [End Block] [End Block] [End block]

C The figure presents a block of code that consists of 2 lines. Throughout the code are nested blocks of code. [Begin block] Line 1: IF [begin block] x OR y [end block] [Begin Block] Line 2: [begin block] DISPLAY [begin block] x AND y [end block] [End Block] [End Block] [End Block]

D The figure presents a block of code that consists of 2 lines. Throughout the code are nested blocks of code. [Begin block] Line 1: IF [begin block] x AND y [end block] [Begin Block] Line 2: [begin block] DISPLAY [begin block] x OR y [end block] [End Block] [End Block] [End block]

Answer A Correct. Since x is true, the body of the IF statement is executed. Since x OR y evaluates to true, true is displayed.

QUESTION 60

Consider two lists of numbers called list1 and list2. A programmer wants to determine how many different values appear in both lists. For example, if list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80], then there are three different values that appear in both lists (20, 40, and 60).

The programmer has the following procedures available.

Procedure Call Explanation Combine (myList1, myList2) This procedure creates a new list containing the elements from myList1 ​followed by the entries from myList2. The resulting list is returned. For example, if myList1 contains [2, 4, 6] and myList2 contains [1, 5], the procedure will return the list [2, 4, 6, 1, 5]. RemoveAllDups (myList) This procedure creates a new list containing the elements of myList with any duplicate values removed. The resulting list is returned. For example, if myList contains [3, 2, 4, 2, 2, 5, 6, 4], the procedure will return the list [3, 2, 4, 5, 6]. Which of the following can be used to assign the intended value to count ?

A bothList ← Combine (list1, list2)

uniqueList ← RemoveAllDups (bothList)

count ← LENGTH (bothList) - LENGTH (uniqueList)

B newList1 ← RemoveAllDups (list1)

newList2 ← RemoveAllDups (list2)

bothList ← Combine (newList1, newList2)

count ← LENGTH (list1) + LENGTH (list2) - LENGTH (bothList)

C newList1 ← RemoveAllDups (list1)

newList2 ← RemoveAllDups (list2)

bothList ← Combine (newList1, newList2)

count ← LENGTH (newList1) + LENGTH (newList2) - LENGTH (bothList)

D newList1 ← RemoveAllDups (list1)

newList2 ← RemoveAllDups (list2)

bothList ← Combine (newList1, newList2)

uniqueList ← RemoveAllDups (bothList)

count ← LENGTH (bothList) - LENGTH (uniqueList)

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.

QUESTION 45

Consider a game in which a player flips a fair coin three times. If all three coin flips have the same result (either all heads or all tails) the player wins. Otherwise, the player loses.

Which of the following code segments best simulates the behavior of the game?

A The figure presents two blocks of code that consist of 5 lines. Throughout the code are nested blocks of code. Line 1: [begin block] flip ← RANDOM [begin block] 0, 3 [end block] [end block] [Begin Block] Line 2: IF [begin block] flip = 3 [end block] [Begin Block] Line 3: [begin block] DISPLAY [begin block] “You lose.” [end block] [end block] [End Block] Line 4: ELSE [Begin Block] Line 5: [begin block] DISPLAY [begin block] “You win!” [end block] [end block] [End Block] [End Block]

B The figure presents two blocks of code that consist of 5 lines. Throughout the code are nested blocks of code. Line 1: [begin block] flip ← RANDOM [begin block] 0, 3 [end block] [end block] [Begin Block] Line 2: IF [Begin Block] [begin block] flip = 3 [end block] OR [begin block] flip = 0 [end block] [End Block] [Begin Block] Line 3: [begin block] DISPLAY [begin block] “You win!” [end block] [end block] [End Block] Line 3: ELSE [Begin Block] Line 4: [begin block] DISPLAY [begin block] “You lose.” [end block] [end block] [End Block] [End Block]

C The figure presents three blocks of code that consist of 7 lines. Throughout the second and third blocks of code are nested blocks of code. Line 1: [begin block] sum ← 0 [end block] [Begin Block] Line 2: REPEAT 3 TIMES [Begin Block] Line 3: [begin block] sum ← sum + RANDOM [begin block] 0, 1 [end block] [End Block] [End Block] [End block] [Begin Block] Line 4: IF [begin block] sum = 3 [end block] [Begin Block] Line 5: [begin block] DISPLAY [begin block] “You win!” [end block] [end block] [End Block] Line 6: ELSE [Begin Block] Line 7: [begin block] DISPLAY [begin block] “You lose.” [end block] [end block] [End Block] [End Block]

D The figure presents three blocks of code that consist of 7 lines. Throughout the second and third blocks of code are nested blocks of code. Line 1: [begin block] sum ← 0 [end block] [Begin Block] Line 2: REPEAT 3 TIMES [Begin Block] Line 3: [begin block] sum ← sum + RANDOM [begin block] 0, 1 [end block] [End Block] [End Block] [End block] [Begin Block] Line 4: IF [begin block] [begin block] sum = 3 [end block] OR [begin block] sum = 0 [end block] [End Block] [Begin Block] Line 5: [begin block] DISPLAY [begin block] “You win!” [end block] [end block] [End Block] Line 6: ELSE [Begin Block] Line 7: [begin block] DISPLAY [begin block] “You lose” [end block] [end block] [End Block] [End Block]

Answer C Incorrect. In this code segment, three coin flips are simulated, where one result is represented by 1 and the other result is represented by 0. The player only wins when the sum of these is 3. However, the player should also win when the sum is 0.

QUESTION 34

The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially facing toward the top of the grid.

The figure presents a robot in a grid of squares with 5 rows and 7 columns. The robot is represented by a triangle, which is initially in the bottom row of the grid in the third square from the left, facing upwards, and ends in the top row of the grid, fifth square from the left, facing upwards. The fifth square from the left in the top row of the grid is shaded gray. A path of arrows shows the robot’s movement from its initial location to the gray square. The robot moves 1 square up, turns rightward, moves 2 squares to the right, turns upwards, and moves 3 squares upwards where it ends. Consider the procedure below.

The figure presents a block of code that consists of 5 lines. Throughout the code there are nested blocks of code. [begin block] Line 1: PROCEDURE BotMover [begin block] x [end block] [Begin Block] Line 2: [begin block] MOVE_FORWARD [end block] Line 3: [begin block] REPEAT x Times [Begin Block] Line 4: [begin block] ROTATE_RIGHT [end block] [End Block] [end block] Line 5: [begin block] MOVE_FORWARD [end block] [End Block] [end block] Which of the following code segments will move the robot to the gray square along the path indicated by the arrows?

A The figure presents three blocks of code. Throughout the code there are nested blocks of code. Line 1: [begin block] BotMover [begin block] 1 [end block] [end block] Line 2: [begin block] BotMover [begin block] 1 [end block] [end block] Line 3: [begin block] BotMover [begin block] 0 [end block] [end block]

B The figure presents three blocks of code. Throughout the code there are nested blocks of code. Line 1: [begin block] BotMover [begin block] 1 [end block] [end block] Line 2: [begin block] BotMover [begin block] 2 [end block] [end block] Line 3: [begin block] BotMover [begin block] 3 [end block] [end block]

C The figure presents three blocks of code. Throughout the code there are nested blocks of code. Line 1: [begin block] BotMover [begin block] 1 [end block] [end block] Line 2: [begin block] BotMover [begin block] 3 [end block] [end block] Line 3: [begin block] BotMover [begin block] 0 [end block] [end block]

D The figure presents three blocks of code. Throughout the code there are nested blocks of code. Line 1: [begin block] BotMover [begin block] 3 [end block] [end block] Line 2: [begin block] BotMover [begin block] 1 [end block] [end block] Line 3: [begin block] BotMover [begin block] 0 [end block] [end block]

Answer D Incorrect. In this code segment, the first call to BotMover moves the robot forward one square, rotates it right three times so that it faces left, and moves it forward one square. The second call to BotMover moves the robot forward one square, rotates it right 1 times so that it faces toward the top of the grid, then moves it forward one square. The third call to BotMover moves the robot forward one square, does not rotate it, then moves it forward one square to the upper left corner of the grid.

QUESTION 20

A file storage application allows users to save their files on cloud servers. A group of researchers gathered user data for the first eight years of the application’s existence. Some of the data are summarized in the following graphs. The line graph on the left shows the number of registered users each year. The line graph on the right shows the total amount of data stored by all users each year. The circle graph shows the distribution of file sizes currently stored by all users.

The figure presents two line graphs and a circle graph titled Registered Users By Year, Total Amount of Data Stored, and File Size Distribution, respectively. The graph titled Registered Users By Year contains 8 data points. The horizontal axis is labeled Year, and the numbers 0 through 8, in increments of 1, are indicated. The vertical axis is labeled Number of Registered Users, in millions, and the numbers 0 through 800, in increments of 100, are indicated. The line begins at the point Year 1 comma 26 million users and trends upwards and to the right, passing through the following data points. Year 2 comma 53 million users; Year 3 comma 105 million users; Year 4 comma 202 million users; Year 5 comma 403 million users; Year 6 comma 504 million users; Year 7 comma 601 million users; and Year 8 comma 701 million users. The graph titled Total Amount of Data Stored contains 8 data points. The horizontal axis is labeled Year, and the numbers 0 through 8, in increments of 1, are indicated. The vertical axis is labeled Total Amount of Data Stored, in millions of gigabytes, and the numbers 0 through 8,000, in increments of 1,000, are indicated. The line begins at the point Year 1 comma 262 million gigabytes and trends upwards and to the right, passing through the following data points. Year 2 comma 505 million gigabytes; Year 3 comma 1,014 million gigabytes; Year 4 comma 2,208 million gigabytes; Year 5 comma 3,885 million gigabytes; Year 6 comma 5,110 million gigabytes; Year 7 comma 5,890 million gigabytes; and Year 8 comma 6,986 million gigabytes. The circle graph contains 6 wedges of data, as follows. Less than 10 kilobytes, 17%; 10 kilobytes to 100 kilobytes, 24%; 100 kilobytes to 1 megabyte, 25%; 1 megabyte to 10 megabytes, 10%; 10 megabytes to 100 megabytes, 22%, more than 100 megabytes, 2%. (note: 1 MB = 1,000 KB)

Which of the following best describes the average amount of data stored per user for the first eight years of the application’s existence?

A Across all eight years, the average amount of data stored per user was about 10 GB.

B Across all eight years, the average amount of data stored per user was about 100 GB.

C The average amount of data stored per user appears to increase by about 10 GB each year.

D The average amount of data stored per user appears to increase by about 100 GB each year.

Answer C Incorrect. The two line graphs are roughly the same shape, indicating that the average amount of data stored per user remained about the same across all eight years.

QUESTION 12

A color in a computing application is represented by an RGB triplet that describes the amount of red, green, and blue, respectively, used to create the desired color. A selection of colors and their corresponding RGB triplets are shown in the following table. Each value is represented in decimal (base 10).

Color Name RGB Triplet indigo (75, 0, 130) ivory (255, 255, 240) light pink (255, 182, 193)​ light yellow (255, 255, 224) magenta (255, 0, 255) neutral gray (127, 127, 112) pale yellow (255, 255, 160) vivid yellow (255, 255, 14) What is the binary RGB triplet for the color indigo?

A (00100101, 00000000, 10000010)

B (00100101, 00000000, 01000001)

C (01001011, 00000000, 10000010)

D (01001011, 00000000, 01000001)

Answer B Incorrect. The decimal equivalent of this triplet is (37, 0, 65).

In a certain computer program, two positive integers are added together, resulting in an overflow error. Which of the following best explains why the error occurs?

A The program attempted to perform an operation that is considered an undecidable problem.

B The precision of the result is limited due to the constraints of using a floating-point representation.

C The program can only use a fixed number of bits to represent integers; the computed sum is greater than the maximum representable value.

D The program cannot represent integers; the integers are converted into decimal approximations, leading to rounding errors.

Answer D Incorrect. While fractions are sometimes represented by decimal approximations that are subject to rounding errors, integers are not.