PrepGo

AP Computer Science A Flashcards: Compound 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 10 cards to help you master important concepts.

What is the order of precedence for the logical operators?
The order of precedence for evaluation is ! (not) first, followed by && (and), and then || (or).
Card 1 of 10

All Flashcards (10)

What is the order of precedence for the logical operators?
The order of precedence for evaluation is ! (not) first, followed by && (and), and then || (or).
Determine the result of the expression: `!false || false`
The result is true. The ! operator has precedence, so `!false` becomes `true`, and `true || false` is `true`.
When does short-circuit evaluation occur with the || (or) operator?
Short-circuit evaluation occurs with the || operator when the first Boolean expression evaluates to true, as the entire expression's result is guaranteed to be true.
What is short-circuit evaluation?
Short-circuit evaluation occurs when the result of a logical operation (&& or ||) can be determined by evaluating only the first Boolean expression, causing the second to be skipped.
What are the three logical operators used with Boolean expressions?
The logical operators are ! (not), && (and), and || (or).
In the expression `false && (someMethod())`, will `someMethod()` be evaluated? Why or why not?
No, `someMethod()` will not be evaluated due to short-circuit evaluation. Since the first expression is false, the result of the && operation is already determined to be false.
When does short-circuit evaluation occur with the && (and) operator?
Short-circuit evaluation occurs with the && operator when the first Boolean expression evaluates to false, as the entire expression's result is guaranteed to be false.
Determine the result of the expression: `true && false`
The result of the expression is false.
In the expression `true || (someMethod())`, will `someMethod()` be evaluated? Why or why not?
No, `someMethod()` will not be evaluated due to short-circuit evaluation. Since the first expression is true, the result of the || operation is already determined to be true.
What is a compound Boolean expression?
A compound Boolean expression is an expression that uses logical operators to combine two or more Boolean values, resulting in a single Boolean value.