AP Computer Science Principles Flashcards: Conditionals
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Review key ideas with interactive flashcards. This set includes 11 cards to help you master important concepts.
What is "selection" in the context of an algorithm?
Selection is a process that determines which parts of an algorithm are executed based on a condition being true or false.
Card 1 of 11
All Flashcards (11)
What is "selection" in the context of an algorithm?
Selection is a process that determines which parts of an algorithm are executed based on a condition being true or false.
How do conditional statements affect the sequential flow of control in a program?
They alter the sequential flow by executing different statements based on the value of a Boolean expression, rather than just executing in order.
Describe the `IF-ELSE` structure from the exam reference sheet.
The `IF-ELSE` structure executes one block of statements if a condition is true, and a second, different block of statements if the condition is false.
Without using a programming language, express an algorithm for deciding to take an umbrella.
If it is raining, then take an umbrella. Otherwise, leave the umbrella at home.
In a simple `IF(condition)` statement, what happens if the condition evaluates to false?
If the condition is false, no action is taken and the block of statements within the IF statement is skipped.
What is the key difference between an `IF` and an `IF-ELSE` statement?
An `IF` statement only provides code to execute when the condition is true, whereas an `IF-ELSE` statement provides code for both the true and false outcomes.
An algorithm needs to display "Welcome!" if a user is logged in, and "Please log in." if they are not. Which structure is more appropriate: `IF` or `IF-ELSE`?
The `IF-ELSE` structure is more appropriate because it provides two distinct paths of execution, one for when the condition (user is logged in) is true and another for when it is false.
What kind of expression is evaluated within a conditional statement to determine which path to take?
A Boolean expression is evaluated, which results in a value of either true or false.
What is another term for conditional statements?
Conditional statements are also known as "if-statements."
According to the provided content, what are the two main skills related to selection that you must be able to perform?
You must be able to write conditional statements and determine the result of given conditional statements.
Describe the `IF(condition)` structure from the exam reference sheet.
The `IF(condition)` structure contains a block of statements that is executed only if the specified condition is true.