← IGCSE Computer Science Paper 2

Requirements of a program

A statement of something the program must do or provide so that the problem is solved. It is specific, comes from the problem and the user, and is used later to test the program.

Understanding Requirements of a program in IGCSE Computer Science Paper 2

What it does: The requirement (store each mark out of 100) comes directly from what the user needs to solve the problem. Because the requirement is specific, a test can be written to check whether the finished program meets it. A requirement states what the program must do or provide. It does not say which language or tool is used. A specific requirement gives exact details, such as the range 11 to 18, so it can be tested. 'Sensibly' is too vague.

Common mistakes: The requirement says marks outside 0 to 100 must be rejected. A mark can never be below 0 AND above 100 at once, so nothing would be rejected. It should use OR. 'Fast and easy to use' is vague and cannot be tested. A requirement must be specific, for example 'open in under 3 seconds'.

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 1–16) and word search (Modules 1–26).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which statement best describes a requirement of a program?
The programming language the program is written inSomething the program must do or provide so the problem is solved
Matches
Requirement: The program must be fast and nice.
↓
The requirement is not specific. 'Fast' and 'nice' are vague and cannot be tested.
Applying
Meanings
Term
requirement
Meaning
A statement of something the program must do or provide so that the problem is solved. It is specific, comes from the problem and the user, and is used later to test the program.
Practice
// Requirement 1: The program must ask the user to enter a mark
Testing
Gaps
The program ask the user for a name.
Check Answer
Spots
2INPUT Mark
3IF Mark<0 AND Mark>100 THEN

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

The 'Gulper Eel' badge — Deep Streak, 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. Which statement best describes a requirement of a program?
A. Something the program must do or provide so the problem is solved ✓
B. The programming language the program is written in
A requirement states what the program must do or provide. It does not say which language or tool is used.
2. Which is written as a clear requirement for a school quiz program?
A. The program must mark each answer as correct or incorrect ✓
B. The program should be good at quizzes
A clear requirement states exactly what the program must do. 'Good at quizzes' is vague and cannot be checked.
3. Which requirement is specific enough to be checked?
A. The program must reject any age that is not between 11 and 18 ✓
B. The program must handle ages sensibly
A specific requirement gives exact details, such as the range 11 to 18, so it can be tested. 'Sensibly' is too vague.
4. Where do the requirements of a program come from?
A. Whatever the programmer finds easiest to code
B. The problem to be solved and what the user needs ✓
Requirements come from the problem and the user, not from what is easiest for the programmer.
5. A user says: 'I need to see my total shopping bill.' What requirement follows from this?
A. The program must use a FOR loop to add numbers
B. The program must calculate and output the total cost of all items ✓
The requirement describes what the program must provide (the total). Using a FOR loop is a design choice, not a requirement.

Match the Pairs

The program must calculate the total cost of the items in the basket. → A clear requirement: a specific statement of something the program must do.
The program should be good and easy to use. → A weak requirement: it is vague and cannot be checked or tested.
Requirements come from the problem and the user: the user says what they need the program to do. → A teacher says: 'I need the program to store each student's mark out of 100.'
Requirements are used later to test the program: each one can be checked against the finished program. → Requirement: reject any age below 0 or above 120. Test: enter 150 and check it is rejected.
Requirement: The program must be fast and nice. → The requirement is not specific. 'Fast' and 'nice' are vague and cannot be tested.
Requirement: The program will use a FOR loop and an array. → This describes how to code the solution, not what the program must do. It does not come from the problem or the user.

Key Term

requirement
A statement of something the program must do or provide so that the problem is solved. It is specific, comes from the problem and the user, and is used later to test the program.

Fill in the Blanks

1. The program must ask the user for a name.
Hint: Type the word that shows a requirement is something the program has to do.
2. // R1: Age must be 0 to 120 IF Age >= 0 AND Age <= 120 THEN
Hint: Type the relational operator that makes the age at most the upper limit in the requirement.
3. // Test the program against each requirement
Hint: Type the word for a statement of what the program must do, which is used later to test the program.
4. R2: The program must OUTPUT the average.
Hint: Type the pseudocode command that shows a result to the user.
5. Requirements come from the problem and from the user
Hint: Type the word for the person who will use the program and says what they need.

Spot the Error

Question 1
A // Req: mark must be 0 to 100
B INPUT Mark
C IF Mark<0 AND Mark>100 THEN
D OUTPUT "Invalid"
E ENDIF
Line C — The requirement says marks outside 0 to 100 must be rejected. A mark can never be below 0 AND above 100 at once, so nothing would be rejected. It should use OR.
Question 2
A Problem: forgotten homework
B Req 1: show homework due today
C Req 2: let a teacher add tasks
D Req 3: be fast and easy to use
Line D — 'Fast and easy to use' is vague and cannot be tested. A requirement must be specific, for example 'open in under 3 seconds'.
Question 3
A Problem: a school shop is slow
B Guess what the app should do
C Req 1: record each sale
D Req 2: show the total price
Line B — Requirements come from the problem and from the user. The analyst should ask the staff, not guess what they want.
Question 4
A // Req: output Mark1 + Mark2
B INPUT Mark1
C INPUT Mark2
D OUTPUT Mark1 * Mark2
Line D — The requirement says to output the total of the two marks, which needs +. Using * multiplies them, so the program does not meet the requirement.
Question 5
A Req: age must be 11 to 16
B Test: enter 10, expect accept
C Test: enter 11, expect accept
D Test: enter 17, expect reject
Line B — Requirements are used later to test the program. The requirement says ages must be 11 to 16, so 10 should be rejected, not accepted.

Student with a class code? Join your class →