Input/Output Examples in CS Thinking
Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Input/Output.
This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.
Concept Recap
The mechanisms by which a program receives data from the outside world (input) and sends results back (output).
What goes in and what comes out. Keyboard β program β screen.
Read the full concept explanation βHow to Use These Examples
- Read the first worked example with the solution open so the structure is clear.
- Try the practice problems before revealing each solution.
- Use the related concepts and background knowledge badges if you feel stuck.
What to Focus On
Core idea: Programs are useless without I/Oβthey transform input into output.
Common stuck point: Input needs validationβusers may enter unexpected or invalid values that crash the program.
Worked Examples
Example 1
easyIdentify the inputs and outputs in this program: name = INPUT('What is your name?'). age = INPUT('How old are you?'). OUTPUT 'Hello ' + name + ', you are ' + age + '.'
Solution
- 1 Step 1: Inputs are data the program receives from the user. Here there are two inputs: name and age.
- 2 Step 2: The OUTPUT statement displays a message to the user β this is the program's output.
- 3 Step 3: The program takes two inputs (name and age) and produces one output (a greeting message).
Answer
Inputs: name and age (from user). Output: a personalised greeting message.
Input is data entering a program (keyboard, file, sensor). Output is data leaving a program (screen, file, speaker). Every useful program has at least one input or output.
Example 2
mediumA temperature converter takes a Celsius value as input and outputs the Fahrenheit equivalent. Write pseudocode and identify the input, process, and output.
Practice Problems
Try these problems on your own first, then open the solution to compare your method.
Example 1
mediumA program reads a list of 5 test scores and outputs the average. Identify the inputs, process, and output. What type of validation might you add to the input?
Example 2
hardDescribe three different input devices and three different output devices a computer program might use. For each, give an example of a program that uses it.