← IGCSE Computer Science Paper 2

Standard methods of solution

A tried-and-tested algorithm for a common task, such as totalling, counting, max/min, average, linear search or bubble sort, that programmers reuse instead of inventing a new solution.

Understanding Standard methods of solution in IGCSE Computer Science Paper 2

What it does: Comparing each element with the target and setting a Found flag is the reusable linear search pattern. Comparing neighbours and starting a swap with a temporary variable is the core step of bubble sort, a standard sorting method. Standard methods such as totalling or linear search are reused because they are already known to work. Counting adds 1 to a counter each time an item meets the condition. Bubble sort is for putting items in order. The maximum method keeps the largest value seen so far. An average gives a middle value, not the highest. Average = Total / Count, so you need the total and the number of items.

Common mistakes: A running total must start at 0. Starting at 1 makes every answer one too high. The line should be Total ← 0. In Cambridge pseudocode a value is stored with the assignment arrow ←. The = sign is a comparison. The line should be Count ← 0.

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 275–285) and word search (Modules 275–295).

Take this worksheet further — free with Cloodit

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

Learning
Duo
What is a standard method?
A tried-and-tested algorithm for a common task that programmers reuseA brand new algorithm invented fresh for every problem
Matches
Count ← Count + Marks[i]
↓
Counting should add 1 each time, not add the value. This adds the mark itself, so it totals instead of counting.
Applying
Meanings
Term
standard method
Meaning
A tried-and-tested algorithm for a common task, such as totalling, counting, max/min, average, linear search or bubble sort, that programmers reuse instead of inventing a new solution.
Practice
Total ← 0
Testing
Gaps
Total ← Total Mark[i]
Check Answer
Spots
1DECLARE Total : INTEGER
2Total ← 1

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

The 'Badger' badge — Determined Digger, 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. What is a standard method?
A. A brand new algorithm invented fresh for every problem
B. A tried-and-tested algorithm for a common task that programmers reuse ✓
Standard methods such as totalling or linear search are reused because they are already known to work.
2. Which task uses the standard method of totalling?
A. Adding up all the marks in an array ✓
B. Finding where the name Zoe is stored
Totalling keeps a running sum: Total ← Total + Mark inside a loop. Finding a name is a linear search.
3. Which standard method fits this problem: 'How many students scored over 50?'
A. Counting ✓
B. Bubble sort
Counting adds 1 to a counter each time an item meets the condition. Bubble sort is for putting items in order.
4. Which standard method fits this problem: 'Find the highest temperature this week'?
A. Finding the maximum ✓
B. Calculating the average
The maximum method keeps the largest value seen so far. An average gives a middle value, not the highest.
5. Which standard method fits this problem: 'Is the item 'Pen' in the list?'
A. Totalling
B. Linear search ✓
A linear search checks each item in turn and uses a Found flag to say whether the target was seen.

Match the Pairs

Total ← Total + Marks[i] → Totalling: adds each array value to a running total inside a loop
IF Marks[i] > Max THEN Max ← Marks[i] → Finding the maximum: keeps the largest value seen so far
Linear search is a standard method that checks each item in turn until the target is found → IF Names[i] = Target THEN Found ← TRUE
Bubble sort is a standard method that swaps neighbouring items that are in the wrong order → IF Nums[i] > Nums[i + 1] THEN Temp ← Nums[i]
Count ← Count + Marks[i] → Counting should add 1 each time, not add the value. This adds the mark itself, so it totals instead of counting.
FOR i ← 1 TO 10 Total ← 0 Total ← Total + Marks[i] NEXT i → Total is reset to 0 inside the loop, so it is wiped every time. The standard method sets it to 0 once before the loop.

Key Term

standard method
A tried-and-tested algorithm for a common task, such as totalling, counting, max/min, average, linear search or bubble sort, that programmers reuse instead of inventing a new solution.

Fill in the Blanks

1. Total ← 0 FOR i ← 1 TO 10 Total ← Total + Mark[i]
Hint: Type the arithmetic operator that adds each item to the running total.
2. FOR i ← 1 TO 10 IF Mark[i] > 50 THEN Count ← Count + 1 NEXT i
Hint: Type the number that the counter goes up by each time an item meets the condition.
3. Max ← Mark[1] IF Mark[i] > Max THEN Max ← Mark[i]
Hint: Type the comparison operator that checks whether the new item is bigger than the current maximum.
4. Found ← FALSE FOR i ← 1 TO 10 IF Name[i] = Target THEN Found ← TRUE
Hint: Type the Boolean value stored in the flag when the target is found.
5. Temp ← Num[j] Num[j] ← Num[j + 1] Num[j + 1] ← Temp
Hint: Type the variable that holds the saved value so the swap in a bubble sort can be completed.

Spot the Error

Question 1
A DECLARE Total : INTEGER
B Total ← 1
C FOR i ← 1 TO 5
D Total ← Total + Num[i]
E NEXT i
Line B — A running total must start at 0. Starting at 1 makes every answer one too high. The line should be Total ← 0.
Question 2
A Count = 0
B FOR i ← 1 TO 10
C IF Mark[i] >= 50 THEN
D Count ← Count + 1
E ENDIF
F NEXT i
Line A — In Cambridge pseudocode a value is stored with the assignment arrow ←. The = sign is a comparison. The line should be Count ← 0.
Question 3
A Max ← Num[1]
B FOR i ← 2 TO 10
C IF Num[i] < Max THEN
D Max ← Num[i]
E ENDIF
F NEXT i
Line C — To find the maximum, replace Max when an item is bigger than it. Using < finds the minimum instead. The line should be IF Num[i] > Max THEN.
Question 4
A Min ← 0
B FOR i ← 2 TO 10
C IF Num[i] < Min THEN
D Min ← Num[i]
E ENDIF
F NEXT i
Line A — Min must start as the first item in the array. If it starts at 0, no positive value is ever smaller, so the minimum stays 0. The line should be Min ← Num[1].
Question 5
A Found ← FALSE
B FOR i ← 0 TO 5
C IF Names[i] = Target THEN
D Found ← TRUE
E ENDIF
F NEXT i
Line B — A linear search must check every element from the first. Cambridge arrays start at index 1, so index 0 does not exist. The line should be FOR i ← 1 TO 5.

Student with a class code? Join your class →