Boolean Expressions and Comparison Operators · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.

True, false, and in between

Computing · Programming · ages 14-15
Name ______________________   Date ____________
  1. When score is 12, the test score > 10 is true.

    Circle one:   True   False

  2. Which values can a Boolean hold?

    • Any whole number
    • True or False
    • Any text
  3. What does True and True give?

    • True
    • False
    • It crashes
  4. Which rewrite keeps the meaning of not age < 13?

    • age >= 13
    • age <= 13
    • age == 13
  5. Which condition is true only for numbers from 5 to 9?

    • n >= 5 or n <= 9
    • not n >= 5
    • n >= 5 and n <= 9
  6. Entry needs cspGrade >= 75 or progGrade >= 75. When is a student in?

    • Both grades reach 75
    • At least one grade reaches 75
    • Neither grade reaches 75
  7. Which rewrite keeps the meaning of not (a > b)?

    • a <= b
    • a < b
    • a == b
  8. Mia writes if score = 10 when she means to compare scores. What happens?

    • The program stores 10 instead of comparing
    • The program compares correctly
    • The program skips the line safely
LightMySky · lightmysky.comW1-mt_0aIh-DPCZ4-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

True, false, and in between W1-mt_0aIh-DPCZ4-s1

  1. True · 12 is bigger than 10, so the comparison answers true.
  2. True or False · A Boolean is a truth value, so only true or false fit.
  3. True · and needs both sides true, and here both are true.
  4. age >= 13 · Flipping under-13 gives 13 and up, which is >= 13.
  5. n >= 5 and n <= 9 · Both halves must hold, so only and with both bounds works.
  6. At least one grade reaches 75 · or needs only one side true, so one strong grade is enough.
  7. a <= b · not bigger-than covers equal and smaller, which is <=.
  8. The program stores 10 instead of comparing · One equals sign stores, so the test never really compares.
Worksheet · LightMySky