---
title: "AP CSP 3.5: Boolean Expressions"
description: "Review AP CSP Boolean expressions, including true/false values, relational operators, NOT, AND, OR, truth tables, conditionals, loops, and exam pseudocode."
canonical: "https://fiveable.me/ap-comp-sci-p/unit-3/boolean-expressions/study-guide/LkLTi80KQM04AnmNBxCq"
type: "study-guide"
subject: "AP Computer Science Principles"
unit: "Unit 3 – Algorithms & Programming Fundamentals"
lastUpdated: "2026-06-09"
---

# AP CSP 3.5: Boolean Expressions

## Summary

Review AP CSP Boolean expressions, including true/false values, relational operators, NOT, AND, OR, truth tables, conditionals, loops, and exam pseudocode.

## Guide

Boolean expressions evaluate to either true or false. You build them with relational operators (`=`, `≠`, `>`, `<`, `≥`, `≤`) to compare values, and you combine those results with logical operators (`NOT`, `AND`, `OR`). For [AP Computer Science Principles](/ap-comp-sci-p "fv-autolink"), trace each comparison carefully before deciding whether a conditional or loop runs.

## Why This Matters for the AP Computer Science Principles Exam

Boolean logic shows up constantly in AP Computer Science Principles because conditions control how programs make decisions. On multiple-choice questions, you will often need to determine the result of a [code segment](/ap-comp-sci-p/key-terms/code-segment "fv-autolink"), and that frequently means tracing what a Boolean expression evaluates to before an `IF` runs or a `REPEAT UNTIL` loop stops. The exam uses its own [pseudocode](/ap-comp-sci-p/key-terms/pseudocode "fv-autolink") on the reference sheet, so you should be able to read relational and logical operators in that notation, not just in one language.

This topic also supports your [Create performance task](/ap-comp-sci-p/key-terms/create-performance-task "fv-autolink"). When you write conditionals or loops in your own program, you are writing Boolean expressions, and your written responses need to explain how your code behaves. Knowing exactly when an [expression](/ap-comp-sci-p/key-terms/expression "fv-autolink") is true or false makes that explanation accurate.

## Key Takeaways

- A Boolean value is either true or false, and any relational or logical comparison evaluates to one of those two values.
- The relational operators on the reference sheet are `=`, `≠`, `>`, `<`, `≥`, and `≤`, and they compare two [variables](/ap-comp-sci-p/key-terms/variable "fv-autolink"), expressions, or values.
- The logical operators are `NOT`, `AND`, and `OR`, and they work on Boolean expressions or single Boolean values.
- `NOT` flips a value, `AND` is true only when both conditions are true, and `OR` is true when at least one [condition](/ap-comp-sci-p/key-terms/condition "fv-autolink") is true.
- Relational operators handle one comparison at a time, while logical operators let you combine multiple conditions into one expression.
- The reference sheet uses `=` for comparison in pseudocode, which is different from how some languages write equality.

## Boolean Values and Relational Operators

A Boolean value is either true or false. Those are the only two options. Whenever you compare two things, the result is a Boolean value.

Relational operators test the relationship between two variables, expressions, or values. The exam reference sheet provides these:

| Operator | Meaning |
|:---|:---|
| `a = b` | true if `a` equals `b` |
| `a ≠ b` | true if `a` does not equal `b` |
| `a > b` | true if `a` is greater than `b` |
| `a < b` | true if `a` is less than `b` |
| `a ≥ b` | true if `a` is greater than or equal to `b` |
| `a ≤ b` | true if `a` is less than or equal to `b` |

A comparison using a [relational operator](/ap-comp-sci-p/key-terms/relational-operator "fv-autolink") always evaluates to a single Boolean value. For example, `a = b` evaluates to true if `a` and `b` are equal; otherwise it evaluates to false.

Here is the same idea in a real language. In Python:

```
y = 5
x = 55
print (x > y)
```

This prints `True` because 55 is greater than 5.

## Logical Operators: NOT, AND, OR

Logical operators let you combine or flip conditions. They each evaluate to a Boolean value. The operand for a logical [operator](/ap-comp-sci-p/key-terms/operator "fv-autolink") is either a Boolean expression or a single Boolean value. Relational operators only test one comparison at a time, but logical operators let you work with several conditions at once.

### NOT

`NOT condition` evaluates to true if the condition is false, and false if the condition is true. It reverses the result.

```
y = 5
x = 55
print (not y >= 5)
```

This prints `False`. Since `y` equals 5, the condition `y >= 5` is true, and `NOT` reverses it to false.

### AND

`condition1 AND condition2` evaluates to true only if both conditions are true. If either one is false, the whole expression is false.

```
y = 5
x = 55
print (y >= 5 and x <= 44)
```

This prints `False`. Even though `y >= 5` is true, `x <= 44` is false, and `AND` needs both to be true.

### OR

`condition1 OR condition2` evaluates to true if at least one condition is true. That includes the case where both are true. It is only false when both conditions are false.

```
y = 5
x = 55
print (y >= 5 or x <= 44)
```

This prints `True`. The second condition is false, but the first condition is true, and `OR` only needs one.

### Quick Truth Reference

| `A` | `B` | `A AND B` | `A OR B` | `NOT A` |
|:---|:---|:---|:---|:---|
| true | true | true | true | false |
| true | false | false | true | false |
| false | true | false | true | true |
| false | false | false | false | true |

## How to Use This on the AP Computer Science Principles Exam

### Code Tracing

When a question gives you a code segment, plug in the actual values and evaluate the Boolean expression step by step. Do the relational comparisons first to get true or false, then apply `NOT`, `AND`, and `OR`. Use parentheses to keep compound expressions organized so you do not lose track of which condition is which.

### Common Trap

For `AND`, check both sides before deciding. It is easy to see one true condition and assume the whole thing is true, but `AND` requires both. For `OR`, remember a single true condition makes the whole expression true.

### Create Performance Task

Every conditional and loop you write uses a Boolean expression. When your written responses ask you to explain how part of your program works, state clearly what condition is being tested and what happens when it is true versus false. Precise Boolean reasoning makes your explanation match what the code actually does.

## Common Misconceptions

- `OR` is not exclusive. `condition1 OR condition2` is still true when both conditions are true, not only when exactly one is true.
- `AND` needs both conditions to be true. One true side is not enough.
- In the exam pseudocode, `=` is a comparison that returns a Boolean, while `←` is assignment. Mixing these up changes what a line does.
- Relational operators compare values; logical operators combine Boolean results. You usually need relational operators to produce the true or false values that logical operators then work on.
- `NOT` reverses the final Boolean result of the condition. Apply the comparison first, then flip it.

## Related AP Computer Science Principles Guides

- [3.1 Variables and Assignments](/ap-comp-sci-p/unit-3/variables-assignments/study-guide/vtJhAf5XFOkm1uHNDMvh)
- [Big Idea 3: Algorithms and Programming](/ap-comp-sci-p/unit-3/review/study-guide/eOWMqAJUdtnmttaCSlis)
- [3.12 Calling Procedures](/ap-comp-sci-p/unit-3/calling-procedures/study-guide/lwdr3yhVOtUJZhAmJ5cu)
- [3.18 Undecidable Problems](/ap-comp-sci-p/unit-3/undecidable-problems/study-guide/q0SSR2ddayx397Hy6ztA)
- [3.17 Algorithmic Efficiency](/ap-comp-sci-p/unit-3/algorithmic-efficiency/study-guide/jGSWIqW49BtrQ8dqCWFd)
- [3.2 Data Abstraction](/ap-comp-sci-p/unit-3/data-abstraction/study-guide/kMMTClSiHohfiaHMGFFE)

## Vocabulary

- **AND**: A logical operator that evaluates to true only if both conditions are true; otherwise it evaluates to false.
- **Boolean expression**: An expression that evaluates to either true or false, often composed of conditions combined with logical operators.
- **Boolean value**: A value that is either true or false, representing the result of a comparison or logical operation.
- **NOT**: A logical operator that evaluates to true if the condition is false, and evaluates to false if the condition is true.
- **OR**: A logical operator that evaluates to true if at least one condition is true; otherwise it evaluates to false.
- **logical operators**: Operators such as NOT, AND, and OR that are used to combine or modify Boolean expressions to produce a Boolean result.
- **operand**: A value or expression that a logical operator acts upon, which can be either a Boolean expression or a single Boolean value.
- **relational operators**: Symbols used to compare two variables, expressions, or values, including =, ≠, >, <, ≥, and ≤.

## FAQs

### What is a Boolean expression in AP CSP?

A Boolean expression is an expression that evaluates to either true or false. AP CSP uses Boolean expressions in comparisons, conditionals, loops, and logical expressions.

### Which relational operators are on the AP CSP reference sheet?

The AP CSP reference sheet uses =, not equal, >, <, greater than or equal to, and less than or equal to. Each comparison tests a relationship between two values and evaluates to a Boolean value.

### What do NOT, AND, and OR mean in AP CSP?

NOT flips a Boolean value, AND is true only when both conditions are true, and OR is true when at least one condition is true. These logical operators combine or change Boolean values.

### How do Boolean expressions appear on the AP CSP exam?

They often appear in code-tracing questions where you decide whether an IF statement runs or when a loop stops. Read each comparison first, then apply NOT, AND, or OR to find the final true or false value.

### What is a common mistake with Boolean expressions?

A common mistake is reading OR as if it means exactly one condition is true. In AP CSP, OR is true if condition1 is true, condition2 is true, or both are true.

### How are Boolean expressions used in the Create performance task?

When your program uses conditionals or loops, it likely uses Boolean expressions to decide what happens next. Understanding them helps you explain how your code responds to different inputs or states.

## Structured Data

```json
{"@context":"https://schema.org","@type":"FAQPage","inLanguage":"en","mainEntity":[{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/boolean-expressions/study-guide/LkLTi80KQM04AnmNBxCq#what-is-a-boolean-expression-in-ap-csp","name":"What is a Boolean expression in AP CSP?","acceptedAnswer":{"@type":"Answer","text":"A Boolean expression is an expression that evaluates to either true or false. AP CSP uses Boolean expressions in comparisons, conditionals, loops, and logical expressions."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/boolean-expressions/study-guide/LkLTi80KQM04AnmNBxCq#which-relational-operators-are-on-the-ap-csp-reference-sheet","name":"Which relational operators are on the AP CSP reference sheet?","acceptedAnswer":{"@type":"Answer","text":"The AP CSP reference sheet uses =, not equal, >, <, greater than or equal to, and less than or equal to. Each comparison tests a relationship between two values and evaluates to a Boolean value."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/boolean-expressions/study-guide/LkLTi80KQM04AnmNBxCq#what-do-not-and-and-or-mean-in-ap-csp","name":"What do NOT, AND, and OR mean in AP CSP?","acceptedAnswer":{"@type":"Answer","text":"NOT flips a Boolean value, AND is true only when both conditions are true, and OR is true when at least one condition is true. These logical operators combine or change Boolean values."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/boolean-expressions/study-guide/LkLTi80KQM04AnmNBxCq#how-do-boolean-expressions-appear-on-the-ap-csp-exam","name":"How do Boolean expressions appear on the AP CSP exam?","acceptedAnswer":{"@type":"Answer","text":"They often appear in code-tracing questions where you decide whether an IF statement runs or when a loop stops. Read each comparison first, then apply NOT, AND, or OR to find the final true or false value."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/boolean-expressions/study-guide/LkLTi80KQM04AnmNBxCq#what-is-a-common-mistake-with-boolean-expressions","name":"What is a common mistake with Boolean expressions?","acceptedAnswer":{"@type":"Answer","text":"A common mistake is reading OR as if it means exactly one condition is true. In AP CSP, OR is true if condition1 is true, condition2 is true, or both are true."}},{"@type":"Question","@id":"https://fiveable.me/ap-comp-sci-p/unit-3/boolean-expressions/study-guide/LkLTi80KQM04AnmNBxCq#how-are-boolean-expressions-used-in-the-create-performance-task","name":"How are Boolean expressions used in the Create performance task?","acceptedAnswer":{"@type":"Answer","text":"When your program uses conditionals or loops, it likely uses Boolean expressions to decide what happens next. Understanding them helps you explain how your code responds to different inputs or states."}}]}
```
