Read input and display output
Use INPUT to receive a value and OUTPUT to show results, prompts and messages.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. It covers section 8.1 (Programming concepts) only. Pseudocode examples use the published Cambridge format; the separate 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers, a browser-based programming workspace and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.
Before you begin
- Be comfortable following an ordered algorithm and tracing variable values. Each lesson introduces the Cambridge pseudocode form it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
What does OUTPUT Score display?
What you will learn
- Read a value into a variable
- Display values and explanatory text
- Place input, processing and output in a clear order
INPUT stores a response
INPUT VariableName reads a value into a previously declared variable. The identifier may also be an individual array element.
A prompt tells the user what to enter. Display it first, then read the response, so the input has a clear purpose.
OUTPUT can combine values
OUTPUT sends text or values to the user. One command can display several values separated by commas, for example OUTPUT "Score: ", Score.
Keep the order logical: prompt, input, processing, then result. The message should identify units where they matter.
Pause and explain
Which order best asks for and displays a temperature?
Worked example
Write pseudocode that asks for a learner's name and displays a greeting.
Show the worked solution
- Declare LearnerName as STRING.
- Display a prompt explaining what is needed.
- Read the response and include it in the output.
Answer DECLARE LearnerName : STRING; OUTPUT "Enter your name"; INPUT LearnerName; OUTPUT "Welcome, ", LearnerName.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Write the commands to ask for a city and then display "You chose" with the city name.
Give me a hint
Use a STRING variable and make the prompt appear before INPUT.
Compare my reasoning
- Declare City : STRING.
- Output a prompt and input City.
- Output explanatory text and City together.
OUTPUT "Enter a city"; INPUT City; OUTPUT "You chose ", City.
Look for these in your work
- Prompt before input
- Correct variable
- Combined output
A program reads a distance and calculates a time. Name one output improvement beyond displaying the raw number.
Give me a hint
Think about what a learner needs to interpret the result.
Compare my reasoning
- Include a label such as "Travel time".
- State the time unit.
- Display the calculated value after the calculation.
Display a label, value and suitable unit, such as "Travel time: ", Time, " hours".
Look for these in your work
- Label included
- Unit included
A learner sees "17" on screen after entering a mark. Improve the output so it communicates the result clearly.
Give me a hint
Add context to the value.
Compare my reasoning
- Identify that the value is a mark.
- Include the maximum if known.
- Output the contextual message after processing.
For example, OUTPUT "Your mark is ", Mark, " out of 20".
Look for these in your work
- Result identified
- Context supplied
Common mistakes
- Displaying a variable before reading or assigning it
- Using INPUT without telling the user what to enter
- Omitting units or context from a numeric result
What can you explain now?
Which command receives a value from the user?
Compare with the explanation
INPUT
INPUT reads a value into a variable.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
Why should a prompt usually appear before an INPUT command?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.