Skip to main content
AP CSP course

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

Combining conditions

By the end you can:

  • Evaluate AND,OR and NOT.
  • Translate a rule with multiple requirements.
  • Construct an equivalent negated condition.

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

AND requires both parts true; OR requires at least one part true and includes the case where both are true. NOT reverses a Boolean value. Evaluate the component comparisons explicitly when debugging, because a passing result can conceal a wrong operator for other combinations.

A compound rule should match the intended set of inputs. Negating a conjunction changes AND to OR and negates each component:NOT(A AND B)is equivalent to(NOT A)OR(NOT B). Use a complete small truth table rather than relying on one example or on informal everyday meanings of “or”.

Worked example

Compare age≥14 AND places>0 with a faulty OR version.

  1. (13,2):false AND true is false, but OR gives true.
  2. (14,0):true AND false is false, but OR again gives true.
  3. (14,1):both give true, so that case alone cannot expose the defect.

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: OR means exactly one part is true.

Logical OR is inclusive: it is also true when both parts are true.

Guided practice

Write the ineligible condition equivalent to NOT(age≥14 AND places>0).

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

Independent transfer

A free ticket requires member true and unpaid false. Write the condition and give a failing counterexample to OR.

Exit check

Why should a test suite include cases with exactly one true component?

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 condition matches membership with no unpaid fee?

    Select one answer.

  2. Question 2 of 2Which TWO are equivalent to NOT(a AND b)?

    Select exactly two answers (0 of 2 selected).

Your practice so far

Check an answer to see its rationale.

Teacher guidance and scoring