Overview

Pretty easy not gonna lie.





Q14 Comparing loop algorithms

Consider the two programs below.

Which of the following best compares the values displayed by programs A and B?

A: Program A and program B display identical values.

B: Program A and program B display the same values in different orders.

C: Program A and program B display the same number of values, but the values differ.

D: Program A and program B display a different number of values.

My Answer: Program A and program B display a different number of values.

Correct Answer: Program A and program B display the same number of values, but the values differ.

Explanation: The programs each display ten values, but each value displayed by program B is one greater than the corresponding value from program A. Program A displays 1 2 3 4 5 6 7 8 9 10 and program B displays 2 3 4 5 6 7 8 9 10 11.



Q21 Comparing robot algorithms

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

Consider the procedures below.

Which of the following code segments will move the robot to the gray square?

My Answer: A

Correct Answer: B

Explanation: This code segment moves the robot forward two squares, rotates it right three times so that the robot faces the top of the grid, and then moves the robot forward three squares to the gray square.