PrepGo

AP Computer Science A Practice Quiz: Algorithms with Selection and Repetition

Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026

Test your understanding with short quizzes. This quiz has 10 questions to check your progress.

Question 1 of 10

According to the provided content, what are the three fundamental building blocks of algorithms?

All Questions (10)

According to the provided content, what are the three fundamental building blocks of algorithms?

A) Input, Processing, Output

B) Sequencing, Selection, Repetition

C) Variables, Constants, Functions

D) Start, Stop, Continue

Correct Answer: B

The content explicitly states, 'The building blocks of algorithms include sequencing, selection, and repetition.'

Which algorithmic building block is defined as a choice of how execution will proceed based on a true or false decision?

A) Sequencing

B) Repetition

C) Selection

D) Patterning

Correct Answer: C

The content defines selection as occurring 'when a choice of how the execution of an algorithm will proceed is based on a true or false decision.'

An algorithm that directs a robot to polish a floor until its surface sensor detects a certain level of shininess is primarily using which concept?

A) Selection

B) Sequencing

C) Repetition

D) Representation

Correct Answer: C

The process of polishing is repeated until a desired outcome (a certain level of shininess) is reached. This is the definition of repetition.

In the everyday task of getting dressed, the instruction 'If it is cold outside, wear a jacket' is an example of what algorithmic principle?

A) Repetition

B) Selection

C) Sequencing

D) Diagramming

Correct Answer: B

The action of wearing a jacket is dependent on a true or false condition (Is it cold?). This choice-based execution is the definition of selection.

A person is following a recipe. Step 5 says, 'Stir the mixture continuously until it thickens.' This step is a real-world representation of which algorithmic building block?

A) Selection

B) Repetition

C) Sequencing

D) Decision

Correct Answer: B

The action of stirring is a process that repeats itself until a desired outcome (the mixture thickens) is reached, which is the definition of repetition.

Consider the following algorithm for a student's morning routine: 1. Wake up. 2. Check the weather. 3. If it is raining, pack an umbrella. 4. Eat breakfast. 5. Keep brushing teeth until two minutes have passed. Which part of this routine demonstrates selection?

A) Step 1: Wake up.

B) Step 3: If it is raining, pack an umbrella.

C) Step 4: Eat breakfast.

D) Step 5: Keep brushing teeth until two minutes have passed.

Correct Answer: B

Step 3 involves a choice (packing an umbrella) that is based on a true or false decision (is it raining?). This is a clear example of selection.

Using the same student morning routine algorithm: 1. Wake up. 2. Check the weather. 3. If it is raining, pack an umbrella. 4. Eat breakfast. 5. Keep brushing teeth until two minutes have passed. Which part of this routine demonstrates repetition?

A) Step 2: Check the weather.

B) Step 3: If it is raining, pack an umbrella.

C) Step 4: Eat breakfast.

D) Step 5: Keep brushing teeth until two minutes have passed.

Correct Answer: D

Step 5 describes a process (brushing teeth) that repeats until a desired outcome is reached (two minutes have passed). This is a clear example of repetition.

A game's instructions state: 'Roll the die. If you roll a 6, you get an extra turn. Otherwise, it's the next player's turn. Repeat this for every player's turn until someone wins.' The instruction 'If you roll a 6, you get an extra turn' is an example of what?

A) The overall repetition of the game loop.

B) The sequencing of the game's phases.

C) The selection process within a single turn.

D) The pattern of player order.

Correct Answer: C

The action of getting an extra turn is based on a true/false condition (did the player roll a 6?). This decision-making process within a turn is an example of selection. The overall game is a repetition, but the specific instruction is selection.

Which of the following scenarios is the BEST example of repetition as an algorithmic concept?

A) Choosing which movie to watch based on reviews.

B) Following the ordered steps to assemble a piece of furniture.

C) Dialing a phone number until someone answers the call.

D) Deciding to take the bus or walk based on the distance.

Correct Answer: C

Dialing a number is a process that may be repeated until the desired outcome (someone answers) is reached. Options A and D are examples of selection, and option B is an example of sequencing.

When a process repeats itself until a desired outcome is reached, it is known as:

A) Selection

B) Sequencing

C) Repetition

D) Conclusion

Correct Answer: C

This is the direct definition of repetition provided in the content: 'Repetition is when a process repeats itself until a desired outcome is reached.'