GRADE 7 · COMPUTING · UNIT 6 · LESSON 6.4
Sequencing and pattern recognition: Getting the message across
Boolean selection and sub-routines
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S TRACE, REASON AND TEST
Boolean selection and sub-routines
Boolean selection chooses actions from true or false conditions. A subroutine groups named steps; after a call finishes, control returns to the following step. A loop is needed to repeat input monitoring.
- Predict outcomes for AND, inclusive OR and NOT conditions in flowcharts and MicroPython.
- Construct or correct a selection flowchart using explicit true and false branches.

Explore the clues
Tap one card to find out more.
Understand the idea
Boolean selection chooses actions from true or false conditions. A subroutine groups named steps; after a call finishes, control returns to the following step. A loop is needed to repeat input monitoring.
Concept to practise: Boolean selection and sub-routines.
Work through an example
A main loop can call countdown when A OR B is true and show a sad image otherwise. The subroutine name must match its call, and its sequence must match the plan. A blocking output can delay the next input check.
Try before your workbook
With A = False and B = True, does inclusive OR call the routine? What happens when the routine reaches its final output?
Check my readiness thinking
The condition is true, so the routine is called. After its last specified action it returns to the main algorithm. Do not invent an extra delay after the final output; trace only the waits stated in the routine.
Your original programs and learning models
These original PaxaKids program and data models support your workbook. Some examples deliberately contain faults to investigate. Follow their headings and preserve exact code case, punctuation and order. Traces and supplied records are not claims of physical testing.
Combine conditions and reuse a sequence
A named subroutine groups steps that can be called from the main algorithm. After it finishes, control returns to the point after the call.
Predict every Boolean case
| A | B | A AND B | A OR B | NOT B |
|---|---|---|---|---|
| False | False | False | False | True |
| False | True | False | True | False |
| True | False | False | True | True |
| True | True | True | True | False |
Read a complete AND monitoring program
Original program model
from microbit import *
while True:
a = button_a.is_pressed()
b = button_b.is_pressed()
if a and b:
display.scroll("Boolean")
else:
display.clear()
sleep(30)Compare the complete OR and NOT programs
INCLUSIVE OR
from microbit import *
while True:
a = button_a.is_pressed()
b = button_b.is_pressed()
if a or b:
display.scroll("Boolean")
else:
display.clear()
sleep(30)NOT B
from microbit import *
while True:
a = button_a.is_pressed()
b = button_b.is_pressed()
if not b:
display.scroll("Boolean")
else:
display.clear()
sleep(30)Trace the countdown subroutine
- countdown
- Display 3
- Wait 1 second
- Display 2
- Wait 1 second
- Display 1
- Wait 1 second
- Display 0
- Return
See the main monitoring structure
Decision: A or B pressed?
True branch
- countdown
False branch
- Show SAD
Inspect the original editable repair task
| Part | Current plan in the Paxa file |
|---|---|
| Main condition | A AND B pressed? |
| True branch call | pulse_hearts |
| False branch | Clear the display |
| Separate routine name | heart_pulse |
| Routine steps | Large heart; wait600ms; small heart; wait600ms; Return. |
Practice files for this lesson
Save a copy of these original PaxaKids learner files before editing in suitable software. Some code and datasets deliberately need completion or repair. Downloading a file does not run it. Use invented data; record actual tests separately from predictions. Native software practice files are not print-optimised; use the student PDF for printing.

Try one step with Paxa!
Use supplied fictional records. Do not disclose personal details, upload private photos or bypass browser warnings to complete an activity. Save personal responses before leaving.
Our Unit 6 learning path
- Lesson 6.1: Prototyping
- Lesson 6.2: Pattern recognition
- Lesson 6.3: Patterns between text-based programming languages
- Lesson 6.4: Boolean selection and sub-routines
- Lesson 6.5: Project plans and test plans
- Lesson 6.6: Identifying errors and debugging
- Lesson 6.7: Sequences and lights
- Lesson 6.8: Creating a moving sequence of lights
- Lesson 6.9: Extending a light sequence
- Lesson 6.10: Light brightness
- Lesson 6.11: Loading-screen and name-sequence extensions
- Lesson 6.12: Final project: Sound-triggered visual alarm
- Lesson 6.13: Evaluation
- Lesson 6.14: What can you do?
For grown-ups: using this lesson
Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.
Read one explanation, discuss the model and try the readiness check before the workbook. Choose “Mark lesson finished” when ready. Optional account progress saves lesson position and completion across devices; save personal responses before leaving.
2. Fill in your workbook
Read the teaching and the complete workbook instructions. Choose, write or draw; Answer list offers larger controls. Trace code precisely and distinguish predictions from actual tests. Review designs, explanations and drawings with a grown-up.
Opening your PDF…
Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.
You’ve completed the checked activities.
TAKE YOUR PRACTICE OFFLINE
3. Download the student worksheet
All 9 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.
Student worksheet only · PDF · 8.2 MiB · No answer key included
TRY FIRST, THEN CHECK TOGETHER
Download the student worksheet →4. Answers & guidance
Finished your try? Open the guide and compare one worksheet at a time. Your own words may be different and still explain the right idea.
Shown on this webpage only. There is no answer-key download, and this guide is left out when printing the page.
Show answers for all 9 worksheets
Worksheet 1
- Question 1: A and B are both True. What is A or B? True
- Question 2: What happens after a subroutine returns? the caller continues after its call
Worksheet 2
- Question 3: A only is held. Which condition is True? a or b
- Question 4: B is held. What is not b? False
- Question 5: Neither button is held. What is a and b? False
Worksheet 3
- Question 6: What happens for A held and B released? the display clears
- Question 7: What makes this repeated monitoring? the reads and selection are inside while True
Worksheet 4
- Question 8: Both buttons are held. What does the OR program do? scrolls Boolean
- Question 9: Neither button is held. What does the NOT B program do? scrolls Boolean
Worksheet 5
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 6
- Question 10: When does the main algorithm display SAD? when neither sampled button is held
Worksheet 7
- Question 11: Why is the named routine connection wrong? the call and defined routine names do not match
Worksheet 8
- Question 12: In draw.io, open SubroutineActivity_Paxa.drawio. Explain what activates its main True branch and when the display clears. Repair the mismatched subroutine name so the large-heart/small-heart routine can be called; preserve its return to monitoring. On three new pages, create flowcharts for ANDprogram_Paxa.py, ORprogram_Paxa.py and NOTprogram_Paxa.py. Include every True/False path and the monitoring loop. Save and identify your edited diagram file. Original fault main call pulse_hearts versus routine heart_pulse; rename either to match consistently. Both A and B activate routine, neither or only one clears. Routine outputs HEART, waits600ms, HEART_SMALL, waits600ms, returns to caller then monitoring. Three Boolean program charts read current a/b each cycle, test a and b / a or b / not b respectively, True scroll Boolean, False clear, wait30ms, loop. AND requires both; inclusive OR includes both; NOT tests B not A. Correct decision/output/call symbols, labelled branches and unambiguous return. Actual editable file/evidence or clearly pending app steps. Do not claim a GUI test from XML validation alone. Grown-up review; personal evidence is required.
Worksheet 9
- Question 13: With a partner, trace the countdown for A only, B only, both and neither; explain when the routine runs and when SAD appears. Predict each Boolean program’s outputs for all four button combinations and compare them with actual tests, or mark testing Pending. Explain how a reusable light-sequence routine could support a visual alarm, and justify an AND or OR rule using more than one relevant input. Distinguish a one-time selection from repeated monitoring and record the discussion honestly. All six source tasks retained across final work: countdown trace and triggers/inactive SAD; editable repair activation/clear/name fix; all3Boolean charts; partner reuse/multipleinput application. Countdown any heldbutton starts3,2,1,0 with3x1s waits; neitherSAD; heldbutton can retrigger after return. Boolean programs True scroll Boolean / False clear: AND FFFT, OR FTTT, NOTB TFTF in00,01,10,11 order. Actual evidence orPending, no board claim. Alarm example A enabled AND sound condition requires both; OR alternative triggers ifeither; relevant justification, routine call/return and repeated reads. V2 required if using built-in microphone, soundeventversuslevel semantics explicit if chosen. No numeric scores. Grown-up review; personal evidence is required.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing 7 Student’s Book — pages 196–200
- PaxaKids Grade 7 Computing Lesson 6.4: Boolean selection and sub-routines — pages 1–9
Computing for your homeschool day
Explore Boolean selection and sub-routines with this free Grade 7 Computing lesson. Read one idea together, try the fillable workbook and return to review at your own pace. Download the same student worksheet PDF for pencil-and-paper practice.
Fit learning around your family’s day. There is no timer and no sign-up is needed to use the lesson. An optional account saves your lesson position and completion across devices. Workbook responses and drawings stay in this tab; save a copy of your responses before leaving.
Understand your results
Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.
Choose Review Answers after trying the activity. The guide stays on the webpage; the worksheet download contains only the student pages.
For programme background, visit the Cambridge Lower Secondary Computing overview. PaxaKids provides independent original companion practice.
The book pages identify the related teaching topic. The explanations, characters, programs and exercises here are original PaxaKids companion practice. Practical tasks require the appropriate editor and, where applicable, suitable equipment. A design or paper trace is not a verified hardware result. Only completed, reviewed lessons are listed.
Explore the Cambridge Lower Secondary Computing curriculum for programme background. PaxaKids is an independent learning resource.
