GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.39

Computational thinking and programming

Retrieve test tables and predict selection outcomes

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

Topic 1.39 · Retrieve test tables and predict selection outcomes8 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Retrieve test tables and predict selection outcomes

Create expected results independently before testing a selection algorithm. Retrieve the right test case and apply the exact comparisons in order. Expected and actual results belong in separate columns.

Today’s two goals
  • Compare expected and actual outcomes for a three-way number comparison.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Retrieve test tables and predict selection 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

For a stated eligibility interval 5 <= age <= 9, the expected outcomes at 4, 5, 9 and 10 are reject, accept, accept and reject. Those expectations come from the requirement.

Try before your workbook

Which value checks the lower included boundary: 4 or 5, and what should happen?

Explore the clues

Tap one card to find out more.

Understand the idea

Create expected results independently before testing a selection algorithm. Retrieve the right test case and apply the exact comparisons in order. Expected and actual results belong in separate columns.

Concept to practise: Retrieve test tables and predict selection outcomes.

Work through an example

For a stated eligibility interval 5 <= age <= 9, the expected outcomes at 4, 5, 9 and 10 are reject, accept, accept and reject. Those expectations come from the requirement.

Try before your workbook

Which value checks the lower included boundary: 4 or 5, and what should happen?

Check my readiness thinking

Use 5 for the included boundary and expect accept. Also use 4 just below it to check that the comparison does not admit too much.

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 first, then compare with evidence

Testing checks what a program actually does for selected inputs. An expected result is a justified prediction made before a run; an actual result is what was observed. Comparing them helps reveal problems in the code, the prediction or the test setup.

This workbook begins the software-development topic with a three-way integer comparison. A test table keeps the input, expected output, actual output and comparison together.

Read a complete three-way comparison

This is an original Paxa example parallel to the curriculum activity. Enter a valid integer each time. The first condition asks whether the reference is greater than the input, so its message describes the input as lower. An elif is considered only if the first condition is False.
Original Paxa comparison program
reference = 12
number = int(input("Enter an integer: "))
if reference > number:
    print("Input is lower")
elif number > reference:
    print("Input is higher")
else:
    print("Input is equal")

Prepare the five required predictions

Trace the page 2 program without running it. Write its exact final message for each input. The first row checks equality; the others check larger and smaller inputs. These rows are a test plan, not evidence that execution has occurred.
Prepare the five required predictions — original model
Test inputExpected final message
12{'clue': 'Exact message', 'prompt': 'Prediction for input 12', 'answers': ['Input is equal']}
24{'clue': 'Exact message', 'prompt': 'Prediction for input 24', 'answers': ['Input is higher']}
13{'clue': 'Exact message', 'prompt': 'Prediction for input 13', 'answers': ['Input is higher']}
7{'clue': 'Exact message', 'prompt': 'Prediction for input 7', 'answers': ['Input is lower']}
3{'clue': 'Exact message', 'prompt': 'Prediction for input 3', 'answers': ['Input is lower']}

Check the change around the reference

The neighbouring integers 11, 12 and 13 check the transitions immediately around reference 12. Use the complete page 2 program and write each expected final message. More test-data categories follow later in the topic.
Check the change around the reference — original model
InputExpected final message
11{'clue': 'Exact message', 'prompt': 'Neighbouring input 11', 'answers': ['Input is lower']}
12{'clue': 'Exact message', 'prompt': 'Neighbouring input 12', 'answers': ['Input is equal']}
13{'clue': 'Exact message', 'prompt': 'Neighbouring input 13', 'answers': ['Input is higher']}

Interpret a provided example log honestly

The table below is a supplied simulated log for reading practice, not your execution record. In its second row the predictor made a mistake; the shown program still follows the stated comparison rule. A mismatch needs investigation before deciding what to change.
Interpret a provided example log honestly — original model
InputPredicted messageSimulated actual message
13Input is higherInput is higher
3Input is higherInput is lower

Use a useful test table and state its limits

Test-table headings can vary with a program’s purpose. A useful record identifies the test input, its reason or description, expected result, actual result and comparison. It may also include test-data type, corrections and retests.

Five matching results support those five cases. They do not prove correct behaviour for every possible input. This example assumes valid integer text; handling other entries is a separate requirement.

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.

Retrieve test tables and predict selection outcomes8 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 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 · 8.1 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 8 worksheets

Worksheet 1

  1. Question 1: When should an expected output be recorded? before running the test
  2. Question 2: What belongs in an actual-output column? what the program really displayed, or Pending if unrun

Worksheet 2

  1. Question 3: What value is assigned to reference? 12
  2. Question 4: For input 7, is reference > number True or False? True
  3. Question 5: Write the exact final message for input 7. Input is lower

Worksheet 3

  1. Question 6: Prediction for input 12 Input is equal
  2. Question 7: Prediction for input 24 Input is higher
  3. Question 8: Prediction for input 13 Input is higher
  4. Question 9: Prediction for input 7 Input is lower
  5. Question 10: Prediction for input 3 Input is lower

Worksheet 4

  1. Question 11: Neighbouring input 11 Input is lower
  2. Question 12: Neighbouring input 12 Input is equal
  3. Question 13: Neighbouring input 13 Input is higher
  4. Question 14: When the first condition is True, what happens to the elif and else? they are skipped in this selection
  5. Question 15: For input 12, why does the else run? both greater-than comparisons are False

Worksheet 5

  1. Question 16: How should the first row be classified? prediction matches the supplied observation
  2. Question 17: What caused the second row’s stated mismatch? the prediction conflicts with the comparison rule
  3. Question 18: What should replace that second prediction after investigation? Input is lower

Worksheet 6

  1. Question 19: Which field explains what a test is intended to check? description or reason
  2. Question 20: What can five matching tests establish directly? the observed cases matched their predictions
  3. Question 21: What is the honest status before a test is run? Pending

Worksheet 7

  1. Question 22: Recreate the complete page 2 program. Before running, record predictions for all five inputs shown here. Run each as a fresh test and compare the actual final message with the prediction; use Pending for unperformed runs. Keep the program, complete outputs and any mismatch investigation. If the prediction was wrong, explain the corrected reasoning; if code differed from the specification, correct it and retest. Correct complete three-way program with reference 12, valid integer input, lower/higher/equal messages in the correct orientation. Expected outputs for 12/24/13/7/3 are Input is equal/higher/higher/lower/lower. Each fresh test retains the initial input prompt and final printed message in the full record; table may hold the final message only. Predictions recorded before actual executions, actual results or Pending, match/mismatch only when observed. Investigate errors in prediction, data entry or implementation rather than assuming any disagreement proves a code bug. Retain source, correction and retest. Grown-up review; personal evidence is required.

Worksheet 8

  1. Question 23: Change the reference value from 12 to 15 in a separate version. Predict results for 14, 15 and 16 before running. Supply complete code, a test table with expected and actual final messages or Pending, and any correction and retest. Explain why the equality branch is still needed and how the comparison messages relate to the input. Review individually or with a partner; identify your contribution and one useful next step without claiming unperformed work. Complete changed reference=15 program. Inputs 14/15/16 yield Input is lower/Input is equal/Input is higher; first condition reference>number handles lower, elif number>reference handles higher, else equality. Predictions precede runs, full source and table retain actual-or-Pending and genuine correction/retest evidence. Explain equality would otherwise be misclassified if treated as always higher or lower. Own contribution, actual individual/partner review and next step; no invented peer exchange or execution. Sample tests support their cases rather than prove universal correctness. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Retrieve test tables and predict selection 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.