← QCE Digital Solutions Unit 2

Pattern recognition in a problem

Spotting similarities or repeated features in sub-problems so that one solution can be reused for similar tasks, such as repeated data entry steps or similar record structures.

Understanding Pattern recognition in a problem in QCE Digital Solutions Unit 2

What it does: Pattern recognition shows that many inputs need the same check. A single function is defined once and reused for each task. A repeated entry step is a pattern. One loop that repeats input handles every item instead of writing the step again and again. Splitting a problem is decomposition. Pattern recognition is the next step: comparing the sub-problems to find what they share. The records share a similar structure (an ID, a descriptive field and a date), but they describe different entities. Spotting the similarity lets you reuse a design, not merge everything. Reusing one solution saves time and reduces errors. It also makes the solution easier to maintain.

Common mistakes: The same entry step repeats three times, so one for loop covers it. The loop header needs the keyword 'to': for i from 1 to 3. One function can be reused for every similar price. It should return the final amount (total), not just the GST part.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 2–115) and word search (Modules 2–139).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A school canteen app needs to enter data for 5 different class orders. Each order uses the same steps: enter name, enter item, enter quantity. What is this an example of?
Pattern recognition: the same data entry steps repeatValidation: checking that the data is reasonable
Matches
input name1 input name2 input name3 input name4
↓
The repeated input steps were written out one by one, so the pattern was missed. A loop should repeat one input step.
Applying
Meanings
Term
pattern recognition
Meaning
Spotting similarities or repeated features in sub-problems so that one solution can be reused for similar tasks, such as repeated data entry steps or similar record structures.
Practice
// Same steps repeat for each student
Testing
Gaps
i from 1 to 30
Check Answer
Spots
1total <- 0
2for i from 1 3

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Hedgehog' badge — First Steps, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A school canteen app needs to enter data for 5 different class orders. Each order uses the same steps: enter name, enter item, enter quantity. What is this an example of?
A. Pattern recognition: the same data entry steps repeat ✓
B. Validation: checking that the data is reasonable
Spotting that the same steps repeat for every order is pattern recognition. It means you can design one data entry solution and reuse it.
2. Which statement best describes pattern recognition in a problem?
A. Spotting similarities in sub-problems so one solution can be reused ✓
B. Splitting a problem into smaller parts without comparing them
Splitting a problem is decomposition. Pattern recognition is the next step: comparing the sub-problems to find what they share.
3. A library system stores students, books and loans. Each record has an ID, a name or title, and a date. What pattern can you spot?
A. The records are all the same, so only one table is needed
B. The records have similar structures, so one design can be reused ✓
The records share a similar structure (an ID, a descriptive field and a date), but they describe different entities. Spotting the similarity lets you reuse a design, not merge everything.
4. Why is recognising a pattern useful when solving a data-driven problem?
A. You can write one solution and reuse it for similar tasks ✓
B. You must write a separate solution for every sub-problem
Reusing one solution saves time and reduces errors. It also makes the solution easier to maintain.
5. A student must enter marks for Maths, English and Science. Each subject uses the same steps: input the mark, check it is 0 to 100, store it. What should the student do?
A. Write three completely different sets of steps
B. Design one set of steps and reuse it for each subject ✓
The three tasks follow the same pattern, so one reusable solution does the job for all of them.

Match the Pairs

for i from 1 to 30: input name → A repeated data entry step: the same input action happens for every student, so one loop can be reused
record Student: name, year, house → A similar record structure: many records share the same fields, so one design can be reused
Reusing one solution for similar tasks: the same check is needed on several inputs, so write it once as a function → define checkMark(mark)
Spotting a repeated data entry step: the same input and store steps happen for each item, so one loop covers them → while more items: input item
input name1 input name2 input name3 input name4 → The repeated input steps were written out one by one, so the pattern was missed. A loop should repeat one input step.
Make a different table design for every class, even though each class list has the same fields → The similar record structure was not recognised. One table design with the same fields can be reused for every class.

Key Term

pattern recognition
Spotting similarities or repeated features in sub-problems so that one solution can be reused for similar tasks, such as repeated data entry steps or similar record structures.

Fill in the Blanks

1. for i from 1 to 30 input mark total ← total + mark
Hint: Type the keyword that repeats the same entry steps a set number of times.
2. define calcTotal(price, qty) return price * qty
Hint: Type the keyword that creates a reusable function from a repeated pattern.
3. define calcTotal(price, qty) return price * qty cost ← calcTotal(25, 2)
Hint: Type the name of the function being reused for a similar task.
4. while count < 10 input name count ← count + 1
Hint: Type the keyword that keeps repeating the same data entry steps while a condition is true.
5. for i from 1 to 5 input mark total ← total + mark
Hint: Type the arithmetic operator that adds each repeated mark to the running total.

Spot the Error

Question 1
A total <- 0
B for i from 1 3
C input mark
D total <- total + mark
E end for
Line B — The same entry step repeats three times, so one for loop covers it. The loop header needs the keyword 'to': for i from 1 to 3.
Question 2
A define addGST(price)
B gst <- price * 0.1
C total <- price + gst
D return gst
E end define
Line D — One function can be reused for every similar price. It should return the final amount (total), not just the GST part.
Question 3
A record Person
B name: integer
C email: string
D end record
E student: Person
F teacher: Person
Line B — Students and teachers share the same record pattern, so one Person record is reused. A name is text, so its type should be string.
Question 4
A define cube(n)
B return n * n * n
C end define
D print cube(3, 5)
E print cube(5)
Line D — The function is reused for similar tasks by calling it once per value. It takes one parameter, so each call needs a single argument: cube(3).
Question 5
A for i from 1 to 5
B input name
C print age
D save name, age
E end for
Line C — Each repeat follows the same data entry pattern: input name, input age, save. Line 3 should use input to get age, otherwise age is never entered.

Student with a class code? Join your class →