GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.13

Computational thinking and programming

Grouping, precedence and review

Read a little. Try the workbook. Check your answers. Choose one section below to get started.

Topic 1.13 · Grouping, precedence and review12 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Grouping, precedence and review

Parentheses make intended grouping explicit. In Python, not binds before and, and and before or, but grouping is often clearer than relying on precedence. Grouping can change the truth value.

Today’s two goals
  • Read brackets before combining conditions; justify how changing grouping can change the chosen branch.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Grouping, precedence and review. Use the supplied program and data models for precise workbook facts.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Work through an example

With A true, B false and C false, (A OR B) AND C is false, while A OR (B AND C) is true. The same three values can therefore support different expressions.

Try before your workbook

With A false, B true and C true, what is (A OR B) AND C? Show the intermediate result.

Explore the clues

Tap one card to find out more.

Understand the idea

Parentheses make intended grouping explicit. In Python, not binds before and, and and before or, but grouping is often clearer than relying on precedence. Grouping can change the truth value.

Concept to practise: Grouping, precedence and review.

Work through an example

With A true, B false and C false, (A OR B) AND C is false, while A OR (B AND C) is true. The same three values can therefore support different expressions.

Try before your workbook

With A false, B true and C true, what is (A OR B) AND C? Show the intermediate result.

Check my readiness thinking

A OR B is true; true AND C is true. Work from the grouped expression rather than reading it as an unspecified sequence.

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.

Make the grouping visible

Parentheses show which results belong together. Changing the grouping can change the final Boolean result and the selected branch, even when the input values stay the same.

In this workbook, comparison results become Boolean operands. Use the declared Boolean precedence NOT, then AND, then OR to interpret an ungrouped expression. Prefer explicit parentheses when communicating a policy.

Distinguish precedence from execution claims

Compare these explicitly Boolean expressions:
X = A OR ((NOT B) AND C)
Y = (A OR (NOT B)) AND C

The ungrouped A OR NOT B AND C has X’s grouping under our convention. Precedence describes grouping; it does not mean every part is always evaluated in a fixed chronological order. Python may skip a later operand once an AND/OR result is determined.
Distinguish precedence from execution claims — original model
Priority among Boolean operatorsOperation
HigherNOT
NextAND
LowerOR

Compare all combinations: A is False

Use X = A OR ((NOT B) AND C) and Y = (A OR (NOT B)) AND C. Each row uses the same inputs for both expressions. Write True or False.
Compare all combinations: A is False — original model
ABCX resultY result
FalseFalseFalse{'clue': 'True or False', 'prompt': 'A=False, B=False, C=False: X', 'answers': ['False', 'false']}{'clue': 'True or False', 'prompt': 'A=False, B=False, C=False: Y', 'answers': ['False', 'false']}
FalseFalseTrue{'clue': 'True or False', 'prompt': 'A=False, B=False, C=True: X', 'answers': ['True', 'true']}{'clue': 'True or False', 'prompt': 'A=False, B=False, C=True: Y', 'answers': ['True', 'true']}
FalseTrueFalse{'clue': 'True or False', 'prompt': 'A=False, B=True, C=False: X', 'answers': ['False', 'false']}{'clue': 'True or False', 'prompt': 'A=False, B=True, C=False: Y', 'answers': ['False', 'false']}
FalseTrueTrue{'clue': 'True or False', 'prompt': 'A=False, B=True, C=True: X', 'answers': ['False', 'false']}{'clue': 'True or False', 'prompt': 'A=False, B=True, C=True: Y', 'answers': ['False', 'false']}

Compare all combinations: A is True

Keep the same definitions of X and Y. These four rows complete the eight possible Boolean input triples. Look for rows where changing the grouping changes the result.
Compare all combinations: A is True — original model
ABCX resultY result
TrueFalseFalse{'clue': 'True or False', 'prompt': 'A=True, B=False, C=False: X', 'answers': ['True', 'true']}{'clue': 'True or False', 'prompt': 'A=True, B=False, C=False: Y', 'answers': ['False', 'false']}
TrueFalseTrue{'clue': 'True or False', 'prompt': 'A=True, B=False, C=True: X', 'answers': ['True', 'true']}{'clue': 'True or False', 'prompt': 'A=True, B=False, C=True: Y', 'answers': ['True', 'true']}
TrueTrueFalse{'clue': 'True or False', 'prompt': 'A=True, B=True, C=False: X', 'answers': ['True', 'true']}{'clue': 'True or False', 'prompt': 'A=True, B=True, C=False: Y', 'answers': ['False', 'false']}
TrueTrueTrue{'clue': 'True or False', 'prompt': 'A=True, B=True, C=True: X', 'answers': ['True', 'true']}{'clue': 'True or False', 'prompt': 'A=True, B=True, C=True: Y', 'answers': ['True', 'true']}

Connect grouping with complete comparisons

For this original example, set A to the result of pages > 20, B to category == "reference", and C to available > 0. Pages and available are whole-number task data; category is compared exactly.

Use pages = 24, category = "story", available = 0. Do not silently change the inputs while moving parentheses.
Connect grouping with complete comparisons — original model
OperandComplete comparison
Apages > 20
Bcategory == "reference"
Cavailable > 0

Review assignments before a simple decision

An earlier calculation changes the value used by the condition. Trace the assignments first. Our <- symbol assigns, while > compares.
ORIGINAL REVIEW PLAN
total <- 4
total <- total * 3
IF total > 11 THEN
    OUTPUT "Above limit"
ELSE
    OUTPUT "At or below limit"
ENDIF

Review an ordered two-input comparison

Inputs left and right are integers, received in that order. Quoted text is output literally; a variable’s name inside quotes does not substitute its value.
ORIGINAL COMPARISON PLAN
INPUT left
INPUT right
IF left == right THEN
    OUTPUT "Equal"
ELSEIF left > right THEN
    OUTPUT "Left larger"
ELSE
    OUTPUT "Right larger"
ENDIF

Review a menu with an unmatched choice

The theatre menu accepts integer choice 1 for Matinee or 2 for Evening. This original version has no initial prompt output and no ELSE. To give every other integer an explicit outcome, add ELSE followed by OUTPUT "Unknown choice" before ENDIF.
ORIGINAL MENU AS WRITTEN
INPUT choice
IF choice == 1 THEN
    OUTPUT "Matinee"
ELSEIF choice == 2 THEN
    OUTPUT "Evening"
ENDIF

Use eight skill areas to review your evidence

Use these original skill statements for the final evidence record. Skill IDs are references, not marks.
Use eight skill areas to review your evidence — original model
IDSkill to demonstrate
1Identify the conditional keywords under our convention.
2Identify a condition, its True actions and any optional False actions.
3Trace a simple IF, including skipped actions.
4Trace IF THEN ELSE and its continuation.
5Trace ordered ELSEIF, skipped tests and fallback.
6Follow a condition using AND.
7Follow a condition using inclusive OR.
8Follow a condition using NOT.

Choose useful evidence and a next action

Choose useful evidence and a next action — original model
EvidenceWhat it can show
Complete truth tableAll Boolean combinations for the stated expressions.
CounterexampleOne case that disproves a claimed equivalence.
Boundary and route testsBehaviour at chosen limits and alternatives.
Saved plan or program revisionThe actual logic being checked.
Actual discussion or PendingWhat collaboration took place, without invention.

Files for this activity

Use these original PaxaKids practice files with the matching workbook. Work on a local copy in the appropriate editor. Some examples deliberately contain faults to investigate; a downloaded file is not a completed practical test.

Paxa the Fox

Try one step with Paxa!

Trace code in the stated order and preserve exact spelling and case. Use fictional data. Label a prediction, paper trace, simulator run and physical-device test separately; an unperformed test stays Pending. Save personal responses before leaving.

Our Unit 1 learning path
  1. Lesson 1.1: Recall algorithms and representations
  2. Lesson 1.2: Purpose and conventions of pseudocode
  3. Lesson 1.3: Input, output and strings
  4. Lesson 1.4: Identifiers and assignment
  5. Lesson 1.5: Arithmetic and translation
  6. Lesson 1.6: Trace and review a sequence
  7. Lesson 1.7: Conditions and two-way flow
  8. Lesson 1.8: IF THEN and indentation
  9. Lesson 1.9: IF THEN ELSE and decision diagrams
  10. Lesson 1.10: Ordered ELSEIF and fallback ELSE
  11. Lesson 1.11: Match flowchart and pseudocode branches
  12. Lesson 1.12: AND, OR and NOT
  13. Lesson 1.13: Grouping, precedence and review
  14. Lesson 1.14: Why software searches
  15. Lesson 1.15: A successful linear search
  16. Lesson 1.16: An unsuccessful search and termination
  17. Lesson 1.17: Practise and communicate the search
  18. Lesson 1.18: Translate conditions into Python
  19. Lesson 1.19: One-branch IF programs
  20. Lesson 1.20: Two-way IF ELSE programs
  21. Lesson 1.21: Ordered ELIF choices
  22. Lesson 1.22: Ranges and independent decisions
  23. Lesson 1.23: Boolean operators in Python
  24. Lesson 1.24: Design and test recommendations
  25. Lesson 1.25: Trace, debug and reflect
  26. Lesson 1.26: Choose data types and recognise Boolean literals
  27. Lesson 1.27: Set and use Boolean flags
  28. Lesson 1.28: Explain and identify constants
  29. Lesson 1.29: Express constants in three algorithm forms
  30. Lesson 1.30: Use a fixed factor in a calculation
  31. Lesson 1.31: Cast to Boolean and validate an empty response
  32. Lesson 1.32: Recall calls and trace return values
  33. Lesson 1.33: Supply parameters and reuse library code
  34. Lesson 1.34: Choose and import libraries responsibly
  35. Lesson 1.35: Round with floor and ceiling
  36. Lesson 1.36: Use pi and investigate another mathematical feature
  37. Lesson 1.37: Generate random choices within bounds
  38. Lesson 1.38: Investigate random real values and review library use
  39. Lesson 1.39: Retrieve test tables and predict selection outcomes
  40. Lesson 1.40: Decompose everyday problems
  41. Lesson 1.41: Decompose programs and organise shared work
  42. Lesson 1.42: Develop through repeated build/test cycles
  43. Lesson 1.43: Predict and verify algorithm outcomes
  44. Lesson 1.44: Choose representative and boundary tests
  45. Lesson 1.45: Build, execute and review a test plan
  46. Lesson 1.46: Recall physical inputs and compare transmission media
  47. Lesson 1.47: Configure a radio group and agree a message scheme
  48. Lesson 1.48: Send and receive numbers and strings
  49. Lesson 1.49: Trace numeric message sequences
  50. Lesson 1.50: Transmit text and use received data in conditions
  51. Lesson 1.51: Diagnose and extend a message protocol
  52. Lesson 1.52: Review communication and evidence of testing
  53. Lesson 1.53: Project 1: Adventure story
  54. Lesson 1.54: Project 2: Fire, Water, Earth
  55. Lesson 1.55: Check your progress 1
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 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.

Grouping, precedence and review12 student pages · original artwork

Opening your PDF…

Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.

TAKE YOUR PRACTICE OFFLINE

3. Download the student worksheet

All 12 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.3 MiB · No answer key included

Download worksheet PDF ↓

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 12 worksheets

Worksheet 1

  1. Question 1: What can changing parentheses change? which Boolean results combine and the final decision
  2. Question 2: Why add explicit grouping to a complex condition? to make the intended policy easier to read

Worksheet 2

  1. Question 3: Which grouping matches A OR NOT B AND C under this convention? X
  2. Question 4: For A=True, B=False, C=False, what are X and Y? X True; Y False

Worksheet 3

  1. Question 5: A=False, B=False, C=False: X False / false
  2. Question 6: A=False, B=False, C=False: Y False / false
  3. Question 7: A=False, B=False, C=True: X True / true
  4. Question 8: A=False, B=False, C=True: Y True / true
  5. Question 9: A=False, B=True, C=False: X False / false
  6. Question 10: A=False, B=True, C=False: Y False / false
  7. Question 11: A=False, B=True, C=True: X False / false
  8. Question 12: A=False, B=True, C=True: Y False / false

Worksheet 4

  1. Question 13: A=True, B=False, C=False: X True / true
  2. Question 14: A=True, B=False, C=False: Y False / false
  3. Question 15: A=True, B=False, C=True: X True / true
  4. Question 16: A=True, B=False, C=True: Y True / true
  5. Question 17: A=True, B=True, C=False: X True / true
  6. Question 18: A=True, B=True, C=False: Y False / false
  7. Question 19: A=True, B=True, C=True: X True / true
  8. Question 20: A=True, B=True, C=True: Y True / true
  9. Question 21: Across both tables, how many input triples give different X and Y results? 2

Worksheet 5

  1. Question 22: Write True or False for A. True / true
  2. Question 23: Write True or False for B. False / false
  3. Question 24: Write True or False for C. False / false

Worksheet 6

  1. Question 25: What is total after the multiplication assignment? 12
  2. Question 26: Which exact message is displayed? Above limit
  3. Question 27: Which statement about the False alternative is accurate? it is included here, but a simple IF may omit it

Worksheet 7

  1. Question 28: For left=6, right=9, which message appears? Right larger
  2. Question 29: For left=8, right=8, which message appears? Equal
  3. Question 30: When does Left larger appear? left is greater than right after equality was False

Worksheet 8

  1. Question 31: As written, what happens for choice = 3? no output
  2. Question 32: After the stated fallback repair, what happens for choice = 3? Unknown choice

Worksheet 9

This page introduces the activity. There are no marked responses on this sheet.

Worksheet 10

  1. Question 33: Which evidence supports a claim that X and Y differ? the same inputs giving different results
  2. Question 34: If partner comparison has not occurred, what should the record say? Pending, with any completed individual trace cited

Worksheet 11

  1. Question 35: Write an original compound condition using complete comparisons, NOT, AND and OR. Create two valid groupings by moving parentheses while keeping operands and operator order the same. Find one set of input values where the results differ and one where they agree; show each comparison’s Boolean value and both final results. State a policy that one grouping implements and explain why the other differs. Check with a manual trace or actual program, and compare with a partner if available. Record the exact revision, method and any peer or device step still Pending. Accept original complete comparisons and syntactically meaningful groupings, same input values used for each comparison. Example A OR ((NOT B) AND C) versus (A OR (NOT B)) AND C: A True, B False, C False gives True/False; A False,B False,C True gives True/True. One policy requires C for every acceptance (Y), while X allows A without C. Require accurate intermediate truth values and same operand/operator order; comparisons instantiated with actual data. Actual trace/run and partner evidence honest or Pending, no claim that brackets merely change stored input values or every subexpression always executes. No numeric grading. Grown-up review; personal evidence is required.

Worksheet 12

  1. Question 36: For skill IDs 1–8 on page 9, record Ready, Practising or Pending and cite exact evidence. In the notes, identify one learning need, a next action and a success check. Use actual work; do not invent practical or partner completion. All eight source summary areas retained in order, through original paraphrases. Require honest nonnumeric status and precise evidence for each; source component correction makes False action optional. Evidence can cite exact trace row, condition, page or saved program, with Pending for missing practical evidence. Notes identify a specific learning need, next action and how improvement will be checked. No automatic claim all skills mastered or invented partner/device result. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Grouping, precedence and review with this free Grade 8 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

Closed answers are checked in your browser. Drawings and written explanations 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.

Book page references identify the related teaching topic. File-management and responsible-data preparation are original PaxaKids material; orientation or contents pages are not presented as teaching citations for those skills. 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.