Inputs and Outputs (AQA GCSE Computer Science): Revision Notes
Input and output
What are inputs and outputs?
Programmes need ways to collect information from users and show results back to them. This is where input and output operations become essential for creating interactive programmes.
Input allows your programme to receive data from a user, while output displays information back to the user.
Think of it like a conversation - input is when someone talks to your programme, and output is when your programme responds back.
In AQA Pseudo-code, we use specific keywords for these operations:
- USERINPUT - gets data from the user
- OUTPUT - displays data to the user
Worked example: calculating circle circumference
Let's look at how input and output work together in a practical example.
Worked Example: Calculating Circle Circumference
This programme calculates the circumference of a circle:
constant pi ← 3.14159
radius ← USERINPUT
circumference ← 2 * pi * radius
OUTPUT circumference
Here's what happens step by step:
- Line 1: We create a constant called pi with the value 3.14159
- Line 2: We use USERINPUT to get the radius value from the user
- Line 3: We calculate the circumference using the formula
- Line 4: We use OUTPUT to show the result to the user
Input and output in different programming languages
The same input and output concept works across different programming languages, but each has its own syntax:
Python syntax
PI = 3.14159 # capitals to denote constant
radius = float(input("enter a radius"))
circumference = 2 * PI * radius
print(circumference)
Key points about Python:
- Uses input() to get data from the user
- float() converts the text input into a decimal number
- print() displays the result
VB.Net syntax
Dim radius As Single
Dim circumference As Single
Const pi As Single = 3.14159
radius = Console.ReadLine()
circumference = 2 * pi * radius
Console.WriteLine(circumference)
Key points about VB.Net:
- Uses Console.ReadLine() to get input
- Variables must be declared with Dim and their data type
- Console.WriteLine() displays the output
C# syntax
const float pi = 3.14159f;
float radius;
float circumference;
radius = Convert.ToSingle(Console.ReadLine());
circumference = 2 * pi * radius;
Console.WriteLine(circumference);
Key points about C#:
- Uses Console.ReadLine() to get input
- Convert.ToSingle() changes text input into a decimal number
- Variables must be declared with their data type first
- Console.WriteLine() displays the output
Exam tips
Critical Exam Information:
- Remember the AQA keywords: USERINPUT and OUTPUT are the exact terms you need in pseudo-code
- Data type conversion: When getting input, remember that it usually comes as text and might need converting to numbers
- Variable assignment: Use the left arrow ← in pseudo-code, but remember that real programming languages use =
- Constants vs variables: Constants don't change (like pi), variables do change (like radius input)
Common exam question types
Typical Exam Questions:
- Writing pseudo-code: You might be asked to write input/output statements
- Converting between languages: Practice converting pseudo-code to Python/VB.Net/C#
- Identifying errors: Look out for missing data type conversions or wrong keywords
- Tracing programs: Follow through input/output operations step by step
Key Points to Remember:
- Input gets data FROM the user, output shows data TO the user
- AQA Pseudo-code uses USERINPUT and OUTPUT as the key commands
- Different languages have different syntax but the same basic concept
- Data types matter - text input often needs converting to numbers for calculations
- Practice converting between pseudo-code and real programming languages for exam success