GRADE 8 · COMPUTING · UNIT 2 · LESSON 2.8

Managing data

Length and range checks

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

Topic 2.8 · Length and range checks10 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Length and range checks

Length checks constrain character counts; range checks constrain allowed values. State whether boundaries are inclusive and test them. Back up a database before changing a field size that could truncate existing data.

Today’s two goals
  • Set appropriate bounds and test ordinary, boundary and invalid inputs.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Length and range checks. 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 rating restricted to integers from 1 to 4 inclusive, 1 and 4 are valid boundaries, while 0 and 5 are invalid. A title-length limit is a different kind of rule.

Try before your workbook

Which check suits a score from 1 to 4, and should 4 be accepted?

Explore the clues

Tap one card to find out more.

Understand the idea

Length checks constrain character counts; range checks constrain allowed values. State whether boundaries are inclusive and test them. Back up a database before changing a field size that could truncate existing data.

Concept to practise: Length and range checks.

Work through an example

For a rating restricted to integers from 1 to 4 inclusive, 1 and 4 are valid boundaries, while 0 and 5 are invalid. A title-length limit is a different kind of rule.

Try before your workbook

Which check suits a score from 1 to 4, and should 4 be accepted?

Check my readiness thinking

Use a range check with inclusive endpoints, and accept 4. A length check alone would not express the numeric rule.

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.

Choose limits that suit the purpose

A length check limits the number of characters in text. A range check limits a numeric value. Neither rule proves the entry agrees with its source.

Continue the original fictional BookNotes practice. We will keep the presence checks and generated key, then add explicit text-length rules, numeric bounds and whole-number checks. Use the supplied PresenceReady copy or your correctly configured previous version.

Keep the complete starting data and types

BookNotes has five fields: Note_ID is an AutoNumber primary key; Reader_alias and Book_title are Short Text with capacity 255; Reader_age and Reading_minutes are Number, Field Size Double. All four non-key fields are Required, and both text fields disallow zero-length strings.

These three fictional seed records are unchanged. Work on a copy and preserve them while testing new entries.
Keep the complete starting data and types — original model
Note_IDAliasAgeBook titleMinutes
1Raven12Star Atlas25
2Maple11River Tale40
3Cedar13Sky Lab35

Specify four clear classroom constraints

These limits belong to this invented practice schema. They are not universal limits on real names, readers or reading sessions. Use a fictional alias rather than a real name. Preserve the existing data before adding or changing rules.
Specify four clear classroom constraints — original model
FieldAccepted value
Reader_alias1–25 characters
Book_title1–80 characters
Reader_ageWhole number from 0 to 18 inclusive
Reading_minutesWhole number from 1 to 180 inclusive

Set explicit rules and useful messages

In Access Design View, select a field and enter its expression in Validation Rule. Enter each two-line numeric expression as a single line; keep the shown And. Add a clear Validation Text message naming the allowed values. Keep the previous presence settings.

Keep text capacity 255 here and use the explicit Len rules shown here to reject overlong entries. A smaller Field Size can limit typing or shorten imported text, so always inspect the saved value. Reference: Microsoft validation guidance.
BookNotes field validation rules
Reader_alias (Short Text, capacity 255):
Len([Reader_alias]) Between 1 And 25
Book_title (Short Text, capacity 255):
Len([Book_title]) Between 1 And 80
Reader_age (Number, Double):
Between 0 And 18 And
Int([Reader_age])=[Reader_age]
Reading_minutes (Number, Double):
Between 1 And 180 And
Int([Reading_minutes])=[Reading_minutes]

Predict duration tests around both boundaries

Test each case independently after applying all rules. Other fields use the valid new record alias Finch, age 12 and title Star Atlas. Let Note_ID generate. Predict Accept or Reject for Reading_minutes.
Predict duration tests around both boundaries — original model
Reading_minutesExpected decision
60: ordinary value{'clue': 'Decision', 'prompt': 'Minutes 60', 'answers': ['Accept']}
1: lower boundary{'clue': 'Decision', 'prompt': 'Minutes 1', 'answers': ['Accept']}
180: upper boundary{'clue': 'Decision', 'prompt': 'Minutes 180', 'answers': ['Accept']}
0: just below{'clue': 'Decision', 'prompt': 'Minutes 0', 'answers': ['Reject']}
181: just above{'clue': 'Decision', 'prompt': 'Minutes 181', 'answers': ['Reject']}
1.5: in range but fractional{'clue': 'Decision', 'prompt': 'Minutes 1.5', 'answers': ['Reject']}

Extend the test plan to the age field

Keep alias Finch, title Star Atlas and Reading_minutes 20. Cancel each test record before continuing.
Extend the test plan to the age field — original model
Reader_ageExpected decision
0: lower boundary{'clue': 'Decision', 'prompt': 'Age 0', 'answers': ['Accept']}
18: upper boundary{'clue': 'Decision', 'prompt': 'Age 18', 'answers': ['Accept']}
−1: just below{'clue': 'Decision', 'prompt': 'Age -1', 'answers': ['Reject']}
19: just above{'clue': 'Decision', 'prompt': 'Age 19', 'answers': ['Reject']}
12.5: fractional value{'clue': 'Decision', 'prompt': 'Age 12.5', 'answers': ['Reject']}

Read feedback and inspect what was saved

An error message should explain the allowed entry and help the user correct it. After a test, inspect both the message and the saved record. Preserve a full source value rather than accepting silent shortening.

Passing the rule means the value meets that rule. A fictional note with 30 minutes might pass every rule yet still disagree with its source. Keep validation and source verification separate.

Test text lengths without losing characters

A repeated character counts each time. Predict Accept or Reject under the explicit Len rules, with all other fields valid. In the native reference, a 26-character alias or 81-character title is rejected rather than saved as a shorter value.
Test text lengths without losing characters — original model
Proposed field contentExpected decision
Reader_alias: A repeated 25 times{'clue': 'Decision', 'prompt': 'Alias length 25', 'answers': ['Accept']}
Reader_alias: A repeated 26 times{'clue': 'Decision', 'prompt': 'Alias length 26', 'answers': ['Reject']}
Book_title: B repeated 80 times{'clue': 'Decision', 'prompt': 'Title length 80', 'answers': ['Accept']}
Book_title: B repeated 81 times{'clue': 'Decision', 'prompt': 'Title length 81', 'answers': ['Reject']}

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 2 learning path
  1. Lesson 2.1: Models, simulators and useful features
  2. Lesson 2.2: Data for users and model designers
  3. Lesson 2.3: Spreadsheet models and what-if changes
  4. Lesson 2.4: Goal seek and checking a target
  5. Lesson 2.5: Data requirements and completeness
  6. Lesson 2.6: Fields, records and consistent formats
  7. Lesson 2.7: Presence checks and primary keys
  8. Lesson 2.8: Length and range checks
  9. Lesson 2.9: A validated entry form
  10. Lesson 2.10: Evaluating and designing a database
  11. Lesson 2.11: Project: Presentation time!
  12. Lesson 2.12: Check your progress 2
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.

Length and range checks10 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 10 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.5 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 10 worksheets

Worksheet 1

  1. Question 1: Which describes a length check? a rule about how many characters text contains

Worksheet 2

  1. Question 2: Which field remains the automatically generated primary key? Note_ID
  2. Question 3: How many reading minutes are recorded for Raven? 25

Worksheet 3

  1. Question 4: What is the smallest allowed Reading_minutes value? 1
  2. Question 5: What is the largest allowed Reading_minutes value? 180

Worksheet 4

  1. Question 6: Why include Int(field)=field with the numeric bounds? to reject fractions that lie inside the range

Worksheet 5

  1. Question 7: Minutes 60 Accept
  2. Question 8: Minutes 1 Accept
  3. Question 9: Minutes 180 Accept
  4. Question 10: Minutes 0 Reject
  5. Question 11: Minutes 181 Reject
  6. Question 12: Minutes 1.5 Reject

Worksheet 6

  1. Question 13: Age 0 Accept
  2. Question 14: Age 18 Accept
  3. Question 15: Age -1 Reject
  4. Question 16: Age 19 Reject
  5. Question 17: Age 12.5 Reject
  6. Question 18: Would a range-only rule of 0 to 18 necessarily reject 12.5? no; 12.5 is in range

Worksheet 7

  1. Question 19: What is the strongest conclusion after an entry passes these checks? it meets the implemented rules; its truth still needs checking

Worksheet 8

  1. Question 20: Alias length 25 Accept
  2. Question 21: Alias length 26 Reject
  3. Question 22: Title length 80 Accept
  4. Question 23: Title length 81 Reject
  5. Question 24: Before lowering a text capacity on existing data, what should you do? preserve a copy and check existing lengths for possible data loss

Worksheet 9

  1. Question 25: Use the complete original BookNotes model on page 2 and a working copy of PresenceReady. Apply the four page 4 field rules and clear messages while keeping the presence rules, text capacity 255 and generated key. Predict and run the six duration, five age and four length cases on pages 5–6 and 8, plus a new record with a Null title to confirm presence remains enforced. Test independently and preserve seed data. Record actual accept/reject outcomes, messages, saved values or Pending, differences, corrections and retests. If no database tool is available, complete the paper settings and test plan and mark execution Pending. Keep source/settings/log evidence and cite it here. All four explicit rules and useful messages, required fields and no zero-length text retained. Duration60/1/180 accepted;0/181/1.5 rejected. Age0/18 accepted;-1/19/12.5 rejected. Alias25 accepted/26 rejected;title80 accepted/81 rejected;Null title rejected. Numeric Double plus Int equality prevents silently rounded fractions. Text capacity255 plus Len rules rejects overlong text without accepting a shortened value. All cases independent, seeds preserved, actual learner database evidence or honest paper/Pending, expected/actual/messages/saved-value checks and meaningful correction/retest retained. Author native DAO tests are not learner GUI completion. Grown-up review; personal evidence is required.

Worksheet 10

  1. Question 26: Explain the purpose of a length check and a range check using your own BookNotes examples. Explain why inclusive bounds, whole-number rules and presence rules are separate. Propose one additional appropriate field with a justified length or numeric rule, ordinary/boundary/invalid tests and expected outcomes. Review how you followed setup steps, observed useful error messages, explained a rule, extended it and remembered the method. For each point cite actual evidence or state what remains Pending, using descriptions rather than ratings. Record actual partner/teacher feedback or Pending, one improvement and your next step. Attach full work and cite it here. Correct length/range/presence/integer distinctions and original examples; inclusive endpoints accepted, fractional values not assumed impossible merely because bounds are whole. Additional purpose-relevant field and justified rule with ordinary/boundary/invalid tests. Evidence-based review of all five source skill areas without score/confidence rating. Clear limits of validation versus source truth, preserving data when changing capacity, actual review or Pending and an actionable improvement/next step. Retained own source, test and explanation evidence. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Length and range checks 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.