Skip to main content
AP CSP course

C25 · Topic 3.5 · 40 minutes · AAP-2.E, AAP-2.F

Comparisons and Boolean values

By the end you can:

  • Evaluate relational comparisons.
  • Translate inclusive boundary language.
  • Distinguish equality tests from assignment.

Before this lesson: topics 3.1, 3.3.

Boolean
A true/false value.
Logical expression
An expression combining Boolean values with operations such as AND,OR and NOT.

Understand

A comparison produces a Boolean result rather than a numerical amount. Translate the wording precisely:“at least 14” includes 14, while “greater than 14” does not. An input exactly on the threshold is a useful test because it separates inclusive and strict comparisons.

In AP pseudocode, the assignment arrow stores a value, while=evaluates equality inside a condition. Do not read an equality test as changing either operand. Use the current state to evaluate each comparison and state the Boolean result before deciding which branch executes.

Worked example

The fictional eligibility rule requires age at least 14 and places greater than 0.

  1. Age 13 makes age≥14 false.
  2. Age 14 makes age≥14 true, including the boundary.
  3. Places 0 makes places>0 false; the age requirement alone is not the entire rule.

Explore each concept

Choose a concept, change its inputs and follow the explanation. Each example models the stated rule or scenario; completing it is practice rather than evidence of mastery.

  • All six relational operators
  • AND, OR and NOT
  • De Morgan equivalence and assignment
Open this example on its own

Change it · step through · explain

Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.

Ready · Make a prediction

Ready to explore: Relations, truth tables and NOT
  1. a (0–100)14Waiting
  2. b (0–100)14Waiting
  3. ExplorerelationsWaiting

Ready to explore: Relations, truth tables and NOT

Why: Change an input, predict the first effect, then advance one step.

Try this: Change one input or choose another listed case. Predict the effect, reset and compare the states and governing rule.

Step through and experiment

Change it · step through · explain

Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.

Ready · Make a prediction

Ready to experiment
  1. Input 114Waiting
  2. Input 20Waiting

Ready to experiment

Why: Predict the first change, then advance one step.

Try this: Compare ages 13 and 14 with places 0 and 1.

Check a misconception

Claim: “At least 14” means strictly older than 14.

The endpoint 14 is included, so the comparison is≥14.

Guided practice

Evaluate age≥14 and places>0 separately for(14,0).

Work with a partner. Make a prediction, compare your reasoning, then identify the rule that supports your answer.

Independent transfer

Give a pair of comparisons that describes values between 5 and 8 inclusive.

Exit check

Does evaluating x=5 assign 5 toxin AP pseudocode?

Write your reasoning before comparing with a classmate. If your teacher assigned this task, submit it through My classes to save your work and receive feedback.

Check yourself

  1. Question 1 of 2Which includes the boundary described by “at most 30”?

    Select one answer.

  2. Question 2 of 2Ifx 7, which TWO comparisons are true?

    Select exactly two answers (0 of 2 selected).

Your practice so far

Check an answer to see its rationale.

Teacher guidance and scoring