AP Computer Science Principles Practice Quiz: Conditionals
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Test your understanding with short quizzes. This quiz has 15 questions to check your progress.
Question 1 of 15
All Questions (15)
A) To repeat a set of instructions multiple times.
B) To store data for later use.
C) To determine which parts of an algorithm are executed based on a condition.
D) To break down a large problem into smaller, manageable parts.
Correct Answer: C
The content explicitly states that 'Selection determines which parts of an algorithm are executed based on a condition being true or false.'
A) Sequential statements
B) Boolean expressions
C) Execution blocks
D) Conditional statements
Correct Answer: D
The text states, 'Conditional statements, or "if-statements," affect the sequential flow of control...'
A) They always execute statements in a fixed, unchangeable order.
B) They affect the sequential flow of control by executing different statements based on a Boolean value.
C) They stop the algorithm's execution permanently.
D) They reverse the order of all subsequent statements.
Correct Answer: B
The content specifies that conditional statements 'affect the sequential flow of control by executing different statements based on the value of a Boolean expression.'
A) An error occurs.
B) A different, unspecified action is taken.
C) No action is taken based on this specific instruction.
D) The algorithm asks for the temperature again.
Correct Answer: C
This algorithm represents an IF(condition) structure. The content states that in this structure, 'a block of statements is executed if the condition is true, and no action is taken if the condition is false.'
A) The IF structure
B) A Boolean expression
C) The IF-ELSE structure
D) Sequential flow of control
Correct Answer: C
The content describes the IF-ELSE structure as one where 'one block of statements is executed if the condition is true, and a second block is executed if the condition is false,' which perfectly matches the scenario.
A) Sequential execution only
B) Selection
C) A Boolean value
D) A programming language
Correct Answer: B
This is a natural language expression of an algorithm that uses selection. It chooses between two different paths (display dashboard vs. display login page) based on a condition (is the user logged in?).
A) A number
B) A string of text
C) A Boolean (true or false)
D) A block of statements
Correct Answer: C
The content states that conditional statements execute based on 'the value of a Boolean expression,' which means the condition must resolve to either true or false.
A) Only the IF-ELSE structure uses a Boolean condition.
B) The IF structure can execute multiple blocks of statements, while IF-ELSE can only execute one.
C) The IF-ELSE structure provides a specific block of code to execute when the condition is false, while the IF structure does not.
D) The IF structure is used for selection, while the IF-ELSE structure is not.
Correct Answer: C
The content defines the IF structure as taking 'no action' if the condition is false, whereas the IF-ELSE structure executes a 'second block' if the condition is false. This is the fundamental difference.
A) The text "Complete" is displayed.
B) The program produces an error.
C) The program displays "Not Complete".
D) No action is taken by this statement.
Correct Answer: D
This is an `IF(condition)` structure. Since the condition `isFinished IS true` evaluates to false, the block of statements is skipped, and no action is taken, as per the definition from the exam reference sheet.
A) Both "Minor" and "Adult" are displayed.
B) "Minor" is displayed.
C) "Adult" is displayed.
D) Neither message is displayed.
Correct Answer: C
The condition `age < 18` is evaluated. Since 25 is not less than 18, the condition is false. In an IF-ELSE structure, the second block (the ELSE block) is executed when the condition is false. Therefore, "Adult" is displayed.
A) Sequencing
B) Iteration
C) Selection
D) Abstraction
Correct Answer: C
The first and third points of the provided content directly define this process as 'selection'.
A) An IF-ELSE structure to check for sales > 10000 and do nothing in the ELSE block.
B) An IF structure to check for sales > 10000.
C) A sequential structure that gives every employee a bonus and then takes it away if sales are too low.
D) An IF structure to check for sales <= 10000.
Correct Answer: B
The logic requires an action for one case (sales > 10000) and no action for the other. The IF structure is designed for exactly this, as it executes a block for a true condition and does nothing for a false one. Using an IF-ELSE with an empty ELSE block is less efficient.
A) First, wake up. Then, brush your teeth. Finally, eat breakfast.
B) If the alarm rings, get out of bed.
C) If it is a weekday, go to work; otherwise, stay home.
D) While you are hungry, continue eating.
Correct Answer: C
This option provides a condition (is it a weekday?), an action for when it's true (go to work), and an alternative action for when it's false (otherwise, stay home). This directly maps to the IF-ELSE structure.
A) Block of statements
B) Selection structure
C) Sequential flow
D) Boolean expression
Correct Answer: D
The content states that conditional statements execute 'based on the value of a Boolean expression.' This expression is the condition itself which is evaluated.
A) An IF structure, because it only needs to check if the number is even.
B) An IF-ELSE structure, because there are two distinct outcomes (even or odd) based on a single condition.
C) Two separate IF structures, one to check for even and one to check for odd.
D) Only sequential statements are needed.
Correct Answer: B
A number is either even or it is odd; there is no other possibility. This is a perfect use case for the IF-ELSE structure, where one action (print 'even') is taken if the condition is true, and a second action (print 'odd') is taken if it is false.