GRADE 7 · COMPUTING · UNIT 1 · LESSON 1.12
Block it out: Moving from blocks to text
Sub-routines
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S TRACE, REASON AND TEST
Sub-routines
Book extension, project or review · original companion practice
A sub-routine groups a named task so a larger algorithm can call it when needed. A main flowchart can choose a routine, pass control to it and then continue. Keep unsupported menu choices separate from valid operations, and check each routine as well as the route that calls it.
- Explain how a main algorithm can call named sub-routines for repeated or separate tasks.
- Trace a calculator flowchart through the main program and the selected sub-routine.

Explore the clues
Tap one card to find out more.
Understand the idea
A sub-routine groups a named task so a larger algorithm can call it when needed. A main flowchart can choose a routine, pass control to it and then continue. Keep unsupported menu choices separate from valid operations, and check each routine as well as the route that calls it.
Concept to practise: Sub-routines.
Work through an example
A menu uses 1 for Add and 2 for Subtract. With values 10 and 4, selecting 2 calls Subtract and produces 6. Selecting 3 must follow the unsupported-choice path; it must not silently call Add.
Try before your workbook
The menu uses 1 for Add and 2 for Subtract. What should happen for inputs 8 and 5 with choice 1, and what must the algorithm do with choice 7?
Check my readiness thinking
Choice 1 calls Add and returns 13. Choice 7 follows the specified unsupported-choice path. A routine's calculation and the decision selecting it are distinct parts of the algorithm.
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.
Give separate tasks clear names
A sub-routine groups steps that perform a task. A main algorithm can call it when needed. Keeping a task in one named place can make the design easier to read, reuse and change.
Follow the main calculator
| Condition | Action |
|---|---|
| operation == 1? | Call Add |
| operation == 2? | Call Subtract |
| Otherwise | Output Unsupported |
Read each routine’s job
| Routine | Calculation |
|---|---|
| Add | result = a + b |
| Subtract | result = a - b |
Predict four basic-calculator cases
| Case | a | b | operation |
|---|---|---|---|
| A | 8 | 3 | 2 |
| B | 14 | 7 | 1 |
| C | 4 | 9 | 3 |
| D | 6 | 12 | 1 |
Plan two more operations
| Choice | Routine | Calculation |
|---|---|---|
| 1 | Add | result = a + b |
| 2 | Subtract | result = a - b |
| 3 | Multiply | result = a * b |
| 4 | Divide | result = a / b |
Find the comparison-chart faults
| Condition | Action |
|---|---|
| a > b? | Second bigger |
| b > a? | Equal |
| Otherwise | Output First bigger |

Try one step with Paxa!
Trace code carefully and preserve exact spelling, case and order. Use invented practice data. Save personal responses before leaving.
Our Unit 1 learning path
- Lesson 1.1: Comparing Scratch and Python
- Lesson 1.2: Using Python
- Lesson 1.3: Using Python IDLE in Script mode
- Lesson 1.4: Variables
- Lesson 1.5: Adding more information to a program
- Lesson 1.6: Data types – string, integer and real
- Lesson 1.7: Casting
- Lesson 1.8: Flowcharts and algorithms
- Lesson 1.9: BIDMAS in Python
- Lesson 1.10: Error detection and correction
- Lesson 1.11: Making choices IF THEN ELSE in flowcharts
- Lesson 1.12: Sub-routines
- Lesson 1.13: Random questions and a star number
- Lesson 1.14: Final project
- Lesson 1.15: Evaluation
- Lesson 1.16: 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 8 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.
Student worksheet only · PDF · 7.9 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 8 worksheets
Worksheet 1
- Question 1: What does a sub-routine contain? steps for a named task
- Question 2: Why might a main algorithm call the same routine twice? to reuse its steps
- Question 3: Which flowchart symbol marks a call to a sub-routine? a rectangle with extra vertical side lines
Worksheet 2
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 3
- Question 4: Which routine does operation 2 call? Subtract
- Question 5: What does the Add routine calculate? a + b
- Question 6: Where does control go after a called routine returns? to the main algorithm’s continuation
Worksheet 4
- Question 7: What is output in case A? 5 / 5.0
- Question 8: What is output in case B? 21 / 21.0
- Question 9: What is output in case C? Unsupported
- Question 10: What is output in case D? 18 / 18.0
Worksheet 5
- Question 11: Where must a and b be entered? before a routine uses them
- Question 12: Which value of b must be excluded for ordinary division? 0
Worksheet 6
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 7
- Question 13: Draw the Multiply and Divide sub-routines. Attach an extended main flowchart that uses operation 1 to add, 2 to subtract, 3 to multiply and 4 to divide; other choices output Unsupported. Keep input before calculation and show return/continuation clearly. Trace (6,4,3), (15,6,4) and unsupported choice 9; peer-check the routes. Use a non-zero second number for division. Retain Add/Subtract routines from page C. Main inputs a,b,operation; checks options and calls only the matching named routine; unsupported option gives message then Stop. Multiply: result = a*b; output result; return. Divide: result = a/b; output result; return. Expected new tests 24;2.5;Unsupported. Existing add/sub traces remain 5,21,Unsupported in basic version,18; after extension former choice3 becomes supported. Require extended main as attached sheet/file and both new routine charts here, branch labels and call names, trace evidence and peer correction. Non-zero divisor stipulated; explicit zero guard accepted as extension. Grown-up review; personal evidence is required.
Worksheet 8
- Question 14: Redraw the faulty comparison chart from page F so it correctly reports First bigger, Second bigger or Equal. Keep both inputs before the decisions. Trace (12,5), (4,9) and (7,7), explain each output-label repair and record your peer checker’s findings. Correct first decision a>b: True output First bigger. False then test b>a: True output Second bigger, False output Equal. All routes merge to Stop. Equivalent correct decision order accepted with matching labels. Expected traces First bigger, Second bigger, Equal. In the faulty original adaptation, those same cases wrongly output Second bigger, Equal, First bigger. Require explanation linking each repaired label to the matching comparison and both True/False route labels; peer trace equality as well as unequal inputs. This is an original redrawing of the curriculum repair context, not a publisher figure. Grown-up review; personal evidence is required.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing 7 Student’s Book — pages 36–38
- PaxaKids Grade 7 Computing Lesson 1.12: Sub-routines — pages 1–8
Computing for your homeschool day
Explore 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.
