Level:
Correct: 0
Incorrect: 0
Marks: 0/0
Exam Practice
Course:
Topics:
AQA GCSE Computer Science (Paper 1) Smart practice A mixed round aimed at your weak spots
Unit 1
3.1 Fundamentals of algorithms
Unit 2
3.2 Programming
Data types
Data types
Arithmetic operations in a programming language
Arithmetic operations, DIV and MOD
Relational operations in a programming language
Relational operations
Boolean operations in a programming language
Boolean operations in conditions
Data structures
Arrays and records
Input/output
Input and output
String handling operations in a programming language
String handling
Random number generation in a programming language
Random number generation
Structured programming and subroutines (procedures and functions)
Subroutines and structured programming
Avg
score:
–
Topics
done:
0/15

Input and output

Practise 25 exam-style questions on Input and output for AQA GCSE Computer Science (Paper 1). Write your answer as you would in the exam and get it marked in seconds against the mark scheme, point by point, with the Study Helper on hand if you get stuck.

  • 25 questions
  • 1–7 marks each
  • Instant marking
  • No sign-up needed
20 questions, marked as you go

Sample questions with model answers

Here are 4 of the questions in this topic, each with a model answer, an explanation of why it earns the marks and the mark scheme an examiner would use.

Question 1

1 mark

The algorithm below works out how many cars are needed for a trip, if each car can take 4 people.

OUTPUT 'Enter the number of people'
people ← USERINPUT
cars ← people DIV 4
IF people MOD 4 > 0 THEN
  cars ← cars + 1
ENDIF
OUTPUT cars

The user enters 10. What is the final output?

Choose your answer.

  • 2
  • 3
  • 2.5
  • 4

Model answer

3

Explanation

10 DIV 4 is 2 full cars, and 10 MOD 4 is 2 people left over, which is more than 0, so one more car is added to make 3. 2.5 would come from ordinary division, which the algorithm does not output, and 2 ignores the people left over. The first output is only the prompt, so the final output is the number of cars.

Mark scheme
  1. 1 mark

    3

    If more than one option is given, 0 marks. Mark is for AO2 (apply).

Question 2

3 marks

Write a program that:
- gets the user to enter their first name
- gets the user to enter their year group as a whole number, for example 10
- outputs a message in this format, using the name and year group entered: Sam is in Year 10

You should write your answer in C#, Python or VB.NET.

Model answer

name = input()
year = int(input())
print(name, "is in Year", year)

Explanation

Each input statement gets one value from the keyboard and stores it in its own variable, and the output then combines fixed text with the two variables. In Python, print with commas puts a space between the items; in C# and VB.NET the parts are joined with + or &. The year group is only displayed, never used in arithmetic, so it could also be kept as a string.

Mark scheme
  1. 1 mark

    Mark A for getting the first name from the user and storing it in a variable;

    Program Logic (3 marks for AO3 program).

  2. 1 mark

    Mark B for getting the year group from the user and storing it in a variable;

    A. the year group stored as a string or as an integer.

  3. 1 mark

    Mark C for outputting the name entered, then is in Year, then the year group entered, in that order;

    I. Differences in spacing. R. the literal text Sam or 10 instead of the variables.
    Maximum 2 marks if any errors in code.
    I. Case. I. Indentation. I. Messages or no messages with input statements. I. Gaps/spaces throughout the code, except where to do so would explicitly alter the logic of the code in a way that makes it incorrect. Minor syntax errors that do not affect the logic are not penalised, e.g. missing semicolons or a missing closing bracket on print.
    Note to examiners: any correct variable declarations in student answers should be accepted.
    Python Example 1 (fully correct):
    name = input()
    year = int(input())
    print(name, "is in Year", year)
    C# Example 1 (fully correct):
    string name = Console.ReadLine();
    int year = Convert.ToInt32(Console.ReadLine());
    Console.WriteLine(name + " is in Year " + year);
    A. Write in place of WriteLine.
    VB.NET Example 1 (fully correct):
    Dim name As String = Console.ReadLine()
    Dim year As Integer = Console.ReadLine()
    Console.WriteLine(name & " is in Year " & year)
    A. + in place of &. A. Write in place of WriteLine.

Question 3

3 marks

Write a pseudo-code algorithm that:
- gets the user to enter a whole number
- outputs every whole number from that number down to 1, one number per line
- then outputs the message Lift off!

For example, if the user enters 3, the outputs are 3, 2, 1 and then Lift off!

Model answer

number ← USERINPUT
FOR count ← number TO 1 STEP -1
  OUTPUT count
ENDFOR
OUTPUT 'Lift off!'

Explanation

A FOR loop with STEP -1 counts down from the number entered to 1, outputting the loop counter on each pass; because the counter never goes past the lower limit, 0 is not output. Lift off! goes after ENDFOR so it appears only once. Common errors are counting up instead of down, stopping at 2, and putting the final message inside the loop.

Mark scheme
  1. 1 mark

    Gets the number from the user and stores it in a variable (e.g. number ← USERINPUT);

    All marks AO3 (program).

  2. 1 mark

    A loop that outputs each whole number from the number entered down to 1, inclusive (e.g. FOR count ← number TO 1 STEP -1);

    A. a WHILE or REPEAT loop that decreases a counter. R. if 0 is also output or the number entered is missed out.

  3. 1 mark

    Outputs Lift off! once, after the loop;

    Max 2 marks if any errors. I. Case. A. answers in program code or in another clear and consistent style of pseudo-code.

Question 4

5 marks

Write a program that:
- gets the user to enter the names of 5 players, one at a time, and stores them in an array (or list)
- then outputs the 5 names in the reverse of the order in which they were entered, one name per line.

You must not use built-in routines that reverse an array. You should use meaningful variable names. You should write your answer in C#, Python or VB.NET.

Model answer

names = []
for i in range(5):
    names.append(input())
for i in range(4, -1, -1):
    print(names[i])

Explanation

One loop fills the array, putting each name into the next element, and a second loop reads the elements back from the last index (4) down to the first (0). Counting down needs a negative step: range(4, -1, -1) in Python, i-- in C# and Step -1 in VB.NET. Stopping at index 1, so that the first name is never output, is the most common error.

Mark scheme
  1. 1 mark

    Mark A for using iteration to get the names;

    Program Design (2 marks for AO3 design). Note that AO3 (design) marks are for selecting appropriate techniques to use to solve the problem, so should be credited whether the syntax of programming language statements is correct or not and regardless of whether the solution works.

  2. 1 mark

    Mark B for using iteration to output the names;

  3. 1 mark

    Mark C for storing each name entered in a different element of the array/list (e.g. names[i] = input() or names.append(input()));

    Program Logic (3 marks for AO3 program).

  4. 1 mark

    Mark D for getting exactly 5 names;

  5. 1 mark

    Mark E for outputting all 5 names in reverse order, each once (indexes 4 down to 0);

    If a built-in reverse routine (e.g. reverse(), reversed() or [::-1]) is used, do not award Mark E.
    Maximum 4 marks if any errors in code.
    I. Case. I. Indentation. I. Messages or no messages with input statements. I. Gaps/spaces throughout the code, except where to do so would explicitly alter the logic of the code in a way that makes it incorrect. Minor syntax errors that do not affect the logic are not penalised, e.g. missing colons or semicolons, ( ) instead of [ ] for list access.
    Note to examiners: any correct variable declarations in student answers should be accepted.
    Python Example 1 (fully correct):
    names = []
    for i in range(5):
    names.append(input())
    for i in range(4, -1, -1):
    print(names[i])
    C# Example 1 (fully correct):
    string[] names = new string[5];
    for (int i = 0; i < 5; i++)
    {
    names[i] = Console.ReadLine();
    }
    for (int i = 4; i >= 0; i--)
    {
    Console.WriteLine(names[i]);
    }
    A. Write in place of WriteLine.
    VB.NET Example 1 (fully correct):
    Dim names(4) As String
    For i As Integer = 0 To 4
    names(i) = Console.ReadLine()
    Next
    For i As Integer = 4 To 0 Step -1
    Console.WriteLine(names(i))
    Next
    A. Write in place of WriteLine.

Ready to try the rest? Every answer you write is marked against the mark scheme, so you can see exactly where the marks are.

Study Helper Hints first, answers after you try

Stuck on this one? Ask for a hint and I’ll point you in the right direction, without giving the answer away. Once you’ve checked your answer, I’ll show you how the marks are awarded.