← IGCSE Computer Science Paper 2

Pseudocode INPUT and OUTPUT

INPUT reads a value from the user into the variable Name. OUTPUT displays a value or message on screen, such as OUTPUT "Hello" or OUTPUT Name.

Understanding Pseudocode INPUT and OUTPUT in IGCSE Computer Science Paper 2

What it does: Without quotes, OUTPUT shows the contents of the variable Name, so the stored value appears. A prompt is displayed with OUTPUT before INPUT so the user knows what to type; INPUT then stores it in Age. Cambridge pseudocode writes keywords such as INPUT and OUTPUT in capitals. OUTPUT followed by text in quotes displays exactly that message on screen.

Common mistakes: INPUT must be followed by a variable name, not a string in quotes. It should be INPUT Name so the value typed is stored in Name. Quotes make OUTPUT display the word Age as text. To display the value stored in the variable, write OUTPUT Age with no quotes.

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 123–134) and word search (Modules 123–145).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line reads a value from the user into a variable called Name?
OUTPUT NameINPUT Name
Matches
INPUT "Name"
↓
INPUT needs a variable name to store the value in, not a string in quotes. It should be INPUT Name.
Applying
Meanings
Term
INPUT Name
Meaning
INPUT reads a value from the user into the variable Name. OUTPUT displays a value or message on screen, such as OUTPUT "Hello" or OUTPUT Name.
Practice
OUTPUT "Enter your name"
Testing
Gaps
Name
Check Answer
Spots
1OUTPUT "Enter your name"
2INPUT "Name"

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

The 'Angelfish' badge — Reef Perfectionist, 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 reads a value from the user into a variable called Name?
A. OUTPUT Name
B. INPUT Name ✓
INPUT reads a value from the user and stores it in the variable. OUTPUT would display the variable instead.
2. Which line displays the message Hello on the screen?
A. OUTPUT "Hello" ✓
B. INPUT "Hello"
OUTPUT shows a value or message to the user. INPUT is for reading a value in, not displaying one.
3. Name holds the text Sam. Which line displays Sam on the screen?
A. OUTPUT Name ✓
B. OUTPUT "Name"
Without quotes, OUTPUT displays the value stored in the variable (Sam). With quotes it would display the word Name.
4. What does OUTPUT "Name" (with quotes) display?
A. The word Name ✓
B. The value stored in the variable Name
Quotes make it a literal message, so the exact text Name is shown. Remove the quotes to display the variable's value.
5. Which is the better order for a program that asks for a user's name?
A. INPUT Name then OUTPUT "Enter your name"
B. OUTPUT "Enter your name" then INPUT Name ✓
A prompt should be displayed before INPUT so the user knows what to type. Otherwise the program waits with no explanation.

Match the Pairs

INPUT Name → Reads a value typed by the user and stores it in the variable Name
OUTPUT "Hello" → Displays the message Hello on the screen
Display the value stored in a variable called Name, not the word Name → OUTPUT Name
Ask the user a question first, then read their answer into Age → OUTPUT "Enter your age" INPUT Age
INPUT "Name" → INPUT needs a variable name to store the value in, not a string in quotes. It should be INPUT Name.
OUTPUT "Name" → The quotes make this display the word Name instead of the value stored in the variable. To show the variable, write OUTPUT Name.

Key Term

INPUT Name
INPUT reads a value from the user into the variable Name. OUTPUT displays a value or message on screen, such as OUTPUT "Hello" or OUTPUT Name.

Fill in the Blanks

1. INPUT Name
Hint: Type the keyword that reads a value from the user into a variable.
2. OUTPUT "Hello"
Hint: Type the keyword that displays a message on the screen.
3. INPUT Name OUTPUT Name
Hint: Type the variable that holds the value the user just entered, so it is displayed.
4. OUTPUT "Enter your name" INPUT Name
Hint: After the prompt is shown, type the keyword that reads the user's reply into the variable.
5. OUTPUT "Your name?" INPUT Name OUTPUT Name
Hint: Type the variable name that will store the value typed by the user.

Spot the Error

Question 1
A OUTPUT "Enter your name"
B INPUT "Name"
C OUTPUT "Hello"
Line B — INPUT must be followed by a variable name, not a string in quotes. It should be INPUT Name so the value typed is stored in Name.
Question 2
A OUTPUT "Enter your age"
B INPUT Age
C OUTPUT "You are"
D OUTPUT "Age"
Line D — Quotes make OUTPUT display the word Age as text. To display the value stored in the variable, write OUTPUT Age with no quotes.
Question 3
A OUTPUT "Enter your name
B INPUT Name
C OUTPUT Name
Line A — The prompt message is missing its closing quotation mark. It should be OUTPUT "Enter your name".
Question 4
A input Name
B OUTPUT "Hello"
C OUTPUT Name
Line A — Cambridge pseudocode keywords are written in capitals. It should be INPUT Name.
Question 5
A OUTPUT "Enter a score"
B INPUT Score
C PRINT Score
Line C — Cambridge pseudocode uses OUTPUT to display a value, not PRINT. It should be OUTPUT Score.

Student with a class code? Join your class →