AP Computer Science Principles Flashcards: Boolean Expressions
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Review key ideas with interactive flashcards. This set includes 19 cards to help you master important concepts.
Describe the behavior of the `NOT` operator.
The NOT operator evaluates to true if its operand is false, and it evaluates to false if its operand is true.
Card 1 of 19
All Flashcards (19)
Describe the behavior of the `NOT` operator.
The NOT operator evaluates to true if its operand is false, and it evaluates to false if its operand is true.
Evaluate the expression: `15 > 20`
The expression evaluates to `false`.
Evaluate the expression: `50 ≠ 50`
The expression evaluates to `false`.
What kind of value does a comparison using a relational operator evaluate to?
A comparison using a relational operator evaluates to a Boolean value (either true or false).
Evaluate the expression: `(true) OR (false)`
The expression evaluates to `true`.
What can serve as an operand for a logical operator?
The operand for a logical operator must be either a Boolean expression or a single Boolean value.
Under what single condition does the `AND` operator evaluate to `true`?
The AND operator evaluates to true only if both of its conditions (operands) are true.
Evaluate the expression: `100 ≥ 100`
The expression evaluates to `true`.
What are relational operators used for?
Relational operators are used to test the relationship between two entities, such as variables, expressions, or values.
What is a Boolean value?
A Boolean value is a data type that is either true or false.
List the six relational operators provided on the AP exam reference sheet.
The six relational operators are =, ≠, >, <, ≥, and ≤.
Evaluate the expression: `(1 < 0) OR (2 ≠ 2)`
The expression evaluates to `false` because both `(1 < 0)` and `(2 ≠ 2)` are false.
What are the three logical operators provided on the AP exam reference sheet?
The three logical operators are NOT, AND, and OR.
Evaluate the expression: `(true) AND (false)`
The expression evaluates to `false`.
Evaluate the expression: `NOT (true)`
The expression evaluates to `false`.
Evaluate the expression: `(5 > 3) AND (10 = 10)`
The expression evaluates to `true` because both `(5 > 3)` and `(10 = 10)` are true.
Under what single condition does the `OR` operator evaluate to `false`?
The OR operator evaluates to false only if both of its conditions (operands) are false.
Evaluate the expression: `NOT ((5 > 10) OR (3 = 3))`
This evaluates to `false`. The inner OR expression `(false OR true)` is true, and `NOT (true)` is false.
What is the primary purpose of using logical operators?
Logical operators are used to write expressions that combine multiple Boolean conditions, which evaluate to a single Boolean value.