← IGCSE Computer Science Paper 2

INPUT command

INPUT followed by a variable name reads a value typed by the user and stores it in that variable. Use one variable per INPUT, and OUTPUT a prompt first.

Understanding INPUT command in IGCSE Computer Science Paper 2

What it does: The OUTPUT line prompts the user and INPUT Name stores what they type in the variable Name. Each INPUT command reads one value into one variable, so two values need two INPUT lines. Cambridge pseudocode allows one variable per INPUT, so the two names must be split over two INPUT commands.

Common mistakes: INPUT reads a value into a variable, so it needs a variable name, not a message. Use OUTPUT to show the prompt: OUTPUT "Enter your name". Cambridge pseudocode keywords are written in capital letters. It should be INPUT Score.

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 27–36) and word search (Modules 27–46).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line correctly reads a value from the user into a variable called Age?
INPUT AgeINPUT 25 Age
Matches
INPUT Length, Width
↓
Two variables are listed in one INPUT. Each INPUT must read into only one variable, so use INPUT Length then INPUT Width on separate lines.
Applying
Meanings
Term
INPUT Answer
Meaning
INPUT followed by a variable name reads a value typed by the user and stores it in that variable. Use one variable per INPUT, and OUTPUT a prompt first.
Practice
OUTPUT "Enter your name"
Testing
Gaps
Answer
Check Answer
Spots
1INPUT "Enter your name"
2INPUT Name

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

The 'Jellyfish' badge — Flow Controller, 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 line correctly reads a value from the user into a variable called Age?
A. INPUT 25 Age
B. INPUT Age ✓
INPUT is followed by just the variable name. The value the user types is stored in that variable.
2. What does INPUT Answer do?
A. Reads what the user types and stores it in Answer ✓
B. Displays the value of Answer on the screen
INPUT reads data in and stores it. OUTPUT is the command that displays a value.
3. Which is the better way to ask the user for their name?
A. OUTPUT "Enter your name" INPUT Name ✓
B. INPUT Name OUTPUT "Enter your name"
Show the prompt with OUTPUT before the INPUT, so the user knows what to type.
4. Which INPUT statement follows the rule of one variable per INPUT?
A. INPUT Height ✓
B. INPUT Height, Weight
Each INPUT reads one value into one variable. To read two values, use two INPUT statements.
5. Which command is used to take a value from the keyboard in Cambridge pseudocode?
A. OUTPUT
B. INPUT ✓
INPUT takes data in from the user. OUTPUT sends data out to the screen.

Match the Pairs

INPUT Answer → Reads a value typed by the user and stores it in the variable Answer
OUTPUT "Enter your age" → Shows a prompt message so the user knows what to type before the INPUT
Show a prompt first, then read the user's value into a variable → OUTPUT "Enter your name" INPUT Name
Use one variable per INPUT to read two separate values → INPUT Length INPUT Width
INPUT Length, Width → Two variables are listed in one INPUT. Each INPUT must read into only one variable, so use INPUT Length then INPUT Width on separate lines.
INPUT "Enter your age" → INPUT needs a variable name, not a prompt string. Use OUTPUT for the prompt and then INPUT Age to store the value.

Key Term

INPUT Answer
INPUT followed by a variable name reads a value typed by the user and stores it in that variable. Use one variable per INPUT, and OUTPUT a prompt first.

Fill in the Blanks

1. INPUT Answer
Hint: Type the keyword that reads a value typed by the user into the variable.
2. DECLARE Age : INTEGER OUTPUT "Enter your age" INPUT Age
Hint: Type the variable name that was declared above, so the typed value is stored in it.
3. OUTPUT "Enter your name" INPUT Name
Hint: Type the command that displays a prompt to the user before they enter a value.
4. DECLARE Score : INTEGER OUTPUT "Enter your score" INPUT Score
Hint: Type the keyword that takes the user's value and stores it in the variable.
5. OUTPUT "Enter a number" INPUT Number OUTPUT Number * 2
Hint: Type the variable that holds the value the user entered, so it can be used in the calculation.

Spot the Error

Question 1
A INPUT "Enter your name"
B INPUT Name
C OUTPUT "Hello ", Name
Line A — INPUT reads a value into a variable, so it needs a variable name, not a message. Use OUTPUT to show the prompt: OUTPUT "Enter your name".
Question 2
A DECLARE Score : INTEGER
B OUTPUT "Enter your score"
C Input Score
D OUTPUT "Score: ", Score
Line C — Cambridge pseudocode keywords are written in capital letters. It should be INPUT Score.
Question 3
A DECLARE Height, REAL
B OUTPUT "Enter your height"
C INPUT Height
Line A — A DECLARE needs a colon between the variable name and its data type. It should be DECLARE Height : REAL.
Question 4
A DECLARE Mark : INTEGER
B OUTPUT "Enter a mark"
C Mark ← INPUT
D OUTPUT "Mark: ", Mark
Line C — INPUT is a command followed by the variable name. It is not a value you assign with ←. It should be INPUT Mark.
Question 5
A OUTPUT "Enter your name"
B INPUT Name
C OUTPUT "Enter your age"
D INPUT Name, Age
E OUTPUT Name, Age
Line D — Use one variable per INPUT. Name was already read on line 2, so line 4 should be INPUT Age.

Student with a class code? Join your class →