GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.43

Computational thinking and programming

Predict and verify algorithm outcomes

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

Topic 1.43 · Predict and verify algorithm outcomes9 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Predict and verify algorithm outcomes

Predict each algorithm outcome from the requirement and then compare it with the actual trace or run. A correct-looking final number can hide a wrong branch or missed output. Record exact outcomes where they matter.

Today’s two goals
  • Trace changing state and conditional input paths; compare predictions with execution.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Predict and verify algorithm outcomes. 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

If a program should print Low for values below 8 and High otherwise, input 8 should print High. A program printing Low at 8 disagrees with the boundary requirement.

Try before your workbook

What should inputs 7 and 9 produce under that rule?

Explore the clues

Tap one card to find out more.

Understand the idea

Predict each algorithm outcome from the requirement and then compare it with the actual trace or run. A correct-looking final number can hide a wrong branch or missed output. Record exact outcomes where they matter.

Concept to practise: Predict and verify algorithm outcomes.

Work through an example

If a program should print Low for values below 8 and High otherwise, input 8 should print High. A program printing Low at 8 disagrees with the boundary requirement.

Try before your workbook

What should inputs 7 and 9 produce under that rule?

Check my readiness thinking

They should produce Low and High. Include the boundary 8 as well, and compare actual results with these independent expectations.

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.

Predict both output and changing state

A prediction can describe printed output or a stored value after an algorithm finishes. Follow assignments and the selected branch in their actual order. A value printed early may differ from its final value.

After predicting, trace a pseudocode algorithm or run a complete program to compare results. Keep the prediction distinct from the observation; mark any unperformed execution Pending. Iterative development uses this evidence while adding and correcting small parts.

Read a complete original movement program

This independent Paxa model starts at 8. Enter a nonnegative integer move. It prints Reached: before selecting one branch. A penalty or bonus changes position and prints Final:. Other branches leave position unchanged. A finish may be reached or passed in this model; its rules differ from the previous exact-finish game.
Original Paxa movement and state example
position = 8
print("Enter spaces to move")
moves = int(input())
position = position + moves
print("Reached:", position)
if position >= 24:
    print("Finish reached")
elif position == 23:
    print("One space left")
elif position >= 18:
    position = position - 3
    print("Penalty: back 3")
    print("Final:", position)
elif position == 14 or position == 15:
    position = position + 2
    print("Bonus: forward 2")
    print("Final:", position)
else:
    print("No bonus")

Trace the five required movement cases

For each fresh run of page 2, write the position printed after Reached: and the stored position at the end. The end value is requested even when that branch does not print a Final: line.
Trace the five required movement cases — original model
Move inputReached valueEnd position
10{'clue': 'Integer', 'prompt': 'Reached for move 10', 'answers': ['18']}{'clue': 'Integer', 'prompt': 'End for move 10', 'answers': ['15']}
16{'clue': 'Integer', 'prompt': 'Reached for move 16', 'answers': ['24']}{'clue': 'Integer', 'prompt': 'End for move 16', 'answers': ['24']}
21{'clue': 'Integer', 'prompt': 'Reached for move 21', 'answers': ['29']}{'clue': 'Integer', 'prompt': 'End for move 21', 'answers': ['29']}
1{'clue': 'Integer', 'prompt': 'Reached for move 1', 'answers': ['9']}{'clue': 'Integer', 'prompt': 'End for move 1', 'answers': ['9']}
7{'clue': 'Integer', 'prompt': 'Reached for move 7', 'answers': ['15']}{'clue': 'Integer', 'prompt': 'End for move 7', 'answers': ['17']}

Check order, feedback and single-branch behaviour

Use page 2 for the exact messages. A move of 10 first reaches 18, then receives the three-space penalty and ends at 15. The later bonus test is skipped because the penalty branch was already selected.

Read a complete conditional-input shopping program

This original example uses fictional token prices. Each item asks a yes/no question. Only exact yes, Yes or YES reads a quantity and adds its cost. Other replies skip that quantity. Quantities are valid nonnegative integers. The final print uses Python’s ordinary numeric display, without fixed decimal padding.
Original Paxa three-item total
ITEM1_COST = 12.5
ITEM2_COST = 8.0
ITEM3_COST = 6.0
total = 0
answer = input("Buy item 1? ")
if answer == "yes" or answer == "Yes" or answer == "YES":
    quantity = int(input("Quantity: "))
    total = total + quantity * ITEM1_COST
answer = input("Buy item 2? ")
if answer == "yes" or answer == "Yes" or answer == "YES":
    quantity = int(input("Quantity: "))
    total = total + quantity * ITEM2_COST
answer = input("Buy item 3? ")
if answer == "yes" or answer == "Yes" or answer == "YES":
    quantity = int(input("Quantity: "))
    total = total + quantity * ITEM3_COST
print("Total:", total)

Predict all four complete input paths

The comma-separated entries below are typed in order, one at each input request. A quantity appears only after an accepted yes reply. Use page 5 and give the complete final line, including Total: and Python’s shown numeric form.
Predict all four complete input paths — original model
PathInput entries in orderExpected final line
Ayes, 4, NO, YES, 5{'clue': 'Full final line', 'prompt': 'Shopping total path A', 'answers': ['Total: 80.0']}
BNO, Yes, 3, yes, 7{'clue': 'Full final line', 'prompt': 'Shopping total path B', 'answers': ['Total: 66.0']}
CNO, NO, NO{'clue': 'Full final line', 'prompt': 'Shopping total path C', 'answers': ['Total: 0']}
DYES, 2, YES, 1, YES, 3{'clue': 'Full final line', 'prompt': 'Shopping total path D', 'answers': ['Total: 51.0']}

Predict how many quantity inputs are read

Count only Quantity: requests in each page 6 path. All three buy questions still occur.
Predict how many quantity inputs are read — original model
PathQuantity requests
A{'clue': 'Integer', 'prompt': 'Quantity reads path A', 'answers': ['2']}
B{'clue': 'Integer', 'prompt': 'Quantity reads path B', 'answers': ['2']}
C{'clue': 'Integer', 'prompt': 'Quantity reads path C', 'answers': ['0']}
D{'clue': 'Integer', 'prompt': 'Quantity reads path D', 'answers': ['3']}

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.

Predict and verify algorithm outcomes9 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 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 · 7.2 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 9 worksheets

Worksheet 1

  1. Question 1: Which value should an end-state prediction report? the value after all executed updates
  2. Question 2: What does iterative development involve? repeated small changes, tests and corrections

Worksheet 2

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

Worksheet 3

  1. Question 3: Reached for move 10 18
  2. Question 4: End for move 10 15
  3. Question 5: Reached for move 16 24
  4. Question 6: End for move 16 24
  5. Question 7: Reached for move 21 29
  6. Question 8: End for move 21 29
  7. Question 9: Reached for move 1 9
  8. Question 10: End for move 1 9
  9. Question 11: Reached for move 7 15
  10. Question 12: End for move 7 17

Worksheet 4

  1. Question 13: For move 10, write the exact final printed line. Final: 15
  2. Question 14: For move 15, write the exact final printed line. One space left
  3. Question 15: For move 16, write the exact final printed line. Finish reached
  4. Question 16: Does the penalty result 15 receive the bonus in the same run? no, later elif branches are skipped

Worksheet 5

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

Worksheet 6

  1. Question 17: Shopping total path A Total: 80.0
  2. Question 18: Shopping total path B Total: 66.0
  3. Question 19: Shopping total path C Total: 0
  4. Question 20: Shopping total path D Total: 51.0

Worksheet 7

  1. Question 21: Quantity reads path A 2
  2. Question 22: Quantity reads path B 2
  3. Question 23: Quantity reads path C 0
  4. Question 24: Quantity reads path D 3
  5. Question 25: After NO to item 1, what is the next requested input? Buy item 2?
  6. Question 26: Is mixed-case yEs an accepted yes reply in this version? no, only the three exact stated spellings are accepted

Worksheet 8

  1. Question 27: Use the complete page 2 program. Before tracing, predict the full sequence of printed lines and the final stored position for all five page 3 inputs. Follow the assignments and exactly one selected branch to check each prediction; distinguish this paper trace from any actual Python execution. Explain the move-10 penalty and why its result does not trigger a later bonus. Keep the original predictions, traces, observed program output or Pending, and any correction and retest. Five fresh cases:10 reaches18, penalty back3, Final15;16 reaches24 Finish reached/end24;21 reaches29 Finish reached/end29;1 reaches9 No bonus/end9;7 reaches15 bonus forward2 Final17. Every full output begins Enter spaces to move then Reached: n. Source-equivalent states and actual output order correct; one ordered branch only, no repeated testing after penalty15. Distinguish justified prediction, step-by-step trace and actual run or Pending. Retain corrections and retests, no invented execution or numerical learner scores. Grown-up review; personal evidence is required.

Worksheet 9

  1. Question 28: Recreate or use the complete page 5 shopping program. Predict the final line for each of the four page 6 input paths before running. Record the full input sequence, quantity requests and actual outputs or Pending, and compare with your predictions. Explain how a NO reply changes the next input request and why the accumulated total is not reset for each item. Preserve any mismatch investigation, correction and retest. Review individually or with a partner, stating your contribution and one next step. Complete original program or equivalent with costs12.5/8.0/6.0, total initially integer0, three independent item checks, exact yes/Yes/YES acceptance and conditional valid integer quantities. Paths A/B/C/D final Total:80.0/66.0/0/51.0, quantity-read counts2/2/0/3. Prompt sequence maintained, skipped quantities not entered, accumulated total retained. Full predictions before actual/Pending observations; original mismatch and explained correction/retest retained. Mixed yEs not accepted in current code; do not silently apply lower/strip without a changed requirement. Actual review/own contribution and next step without invented partner performance. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Predict and verify algorithm outcomes 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.