← IGCSE Computer Science Paper 2

Component parts of a problem: inputs

Data that goes into a system from a user, a sensor or a file, such as a typed name, a temperature reading or a line read from a stored file.

Understanding Component parts of a problem: inputs in IGCSE Computer Science Paper 2

What it does: The value comes from a sensor rather than a person, so it is a sensor input stored in the variable Temp. Each piece of data the user must give to the system is one input, so this scenario has two inputs, PlayerName and Answer. A temperature reading is captured by a sensor and sent into the system as input. A printer only produces output. The item chosen and quantity entered are data going in. The total cost is a result of a process, and the receipt is an output. Inputs are not limited to typing. They can also come from sensors, scanners and files.

Common mistakes: INPUT is a keyword followed by the variable that stores the typed data. It is not a value to assign. It should be INPUT Name. The value typed by the user is stored in Mark, so the variable Marks does not hold the input. It should be Total ← Total + Mark.

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 94–106) and word search (Modules 94–118).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which one is an input to a system?
A student types their name into a formA report printed on the screen
Matches
Inputs: total score, average mark, grade
↓
These are outputs or results of processing, not inputs. Inputs are the raw data that goes in, such as each mark entered.
Applying
Meanings
Term
input
Meaning
Data that goes into a system from a user, a sensor or a file, such as a typed name, a temperature reading or a line read from a stored file.
Practice
OUTPUT "Enter your name"
Testing
Gaps
Name
Check Answer
Spots
1OUTPUT "Enter your name"
2Name ← INPUT

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

The 'Fennec Fox' badge — Listener, 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 one is an input to a system?
A. A report printed on the screen
B. A student types their name into a form ✓
An input is data going INTO the system. Typing a name is data entering the system, but a report shown on screen is data coming out (an output).
2. A greenhouse system measures the temperature. Where does this input come from?
A. A printer
B. A sensor ✓
A temperature reading is captured by a sensor and sent into the system as input. A printer only produces output.
3. Which is an input to a program?
A. A barcode scanned at a till ✓
B. A receipt printed for the customer
Scanning a barcode sends data into the system, so it is an input. The printed receipt is an output.
4. A program opens scores.txt and reads each line. What are those lines?
A. Input from a file ✓
B. Output to a file
Reading data from a stored file brings it into the program, so it counts as input. Writing data to a file would be storage or output.
5. A school canteen system must work out the total cost of a meal. Which list shows only inputs?
A. Item chosen, quantity entered ✓
B. Total cost, receipt printed
The item chosen and quantity entered are data going in. The total cost is a result of a process, and the receipt is an output.

Match the Pairs

INPUT Name → Takes data typed in by the user and stores it in the variable Name
READFILE("scores.txt", Line) → Reads one line of data from a stored file into the variable Line
An input can be a reading from a sensor, such as a temperature sensor in a greenhouse → Temp ← ReadSensor("temperature")
Listing the inputs in a scenario: a quiz asks for a player name and an answer → INPUT PlayerName INPUT Answer
Inputs: total score, average mark, grade → These are outputs or results of processing, not inputs. Inputs are the raw data that goes in, such as each mark entered.
Inputs for an alarm: siren sounds, light flashes → A siren and a flashing light are outputs. The inputs are the data going in, such as a reading from a motion sensor.

Key Term

input
Data that goes into a system from a user, a sensor or a file, such as a typed name, a temperature reading or a line read from a stored file.

Fill in the Blanks

1. OUTPUT "Enter your name" INPUT Name
Hint: Type the keyword that takes data typed by the user into a variable.
2. OPENFILE "scores.txt" FOR READ READFILE "scores.txt", Line
Hint: Type the file mode used when data will be taken in from the file.
3. OPENFILE "scores.txt" FOR READ READFILE "scores.txt", Line
Hint: Type the keyword that reads one line of data from the open file into a variable.
4. OUTPUT "Enter your age" INPUT Age
Hint: Type the variable name that will store the value the user types, matching the prompt.
5. // A sensor reading is an input INPUT Temp
Hint: Type the word for data that goes into a system.

Spot the Error

Question 1
A OUTPUT "Enter your name"
B Name ← INPUT
C OUTPUT "Hello ", Name
Line B — INPUT is a keyword followed by the variable that stores the typed data. It is not a value to assign. It should be INPUT Name.
Question 2
A Total ← 0
B FOR Count ← 1 TO 3
C INPUT Mark
D Total ← Total + Marks
E NEXT Count
Line D — The value typed by the user is stored in Mark, so the variable Marks does not hold the input. It should be Total ← Total + Mark.
Question 3
A OPENFILE "scores.txt" FOR READ
B READFILE "scores.txt", Line
C OUTPUT Line
D CLOSE "scores.txt"
Line D — The Cambridge keyword for closing a file that was opened for reading input is CLOSEFILE, not CLOSE.
Question 4
A OPENFILE "temps.txt" FOR READ
B READFILE Temp, "temps.txt"
C CLOSEFILE "temps.txt"
Line B — READFILE needs the file name first and then the variable that stores the data read in. It should be READFILE "temps.txt", Temp.
Question 5
A DECLARE Barcode : STRING
B OUTPUT "Scan the item"
C INPUT Barcode : STRING
D OUTPUT Barcode
Line C — The data type belongs in the DECLARE statement. The INPUT line only names the variable that receives the scanned data. It should be INPUT Barcode.

Student with a class code? Join your class →