AQA GCSE Computer Science June 2022 Paper 1, Question 1: MOD, selection and definite iteration
AQA 8525 June 2022 Paper 1, Question 1: six multiple choice parts on a short algorithm that uses MOD. Selection, assignment, relational operators and definite iteration explained, with the program to run.
Question 1 of the AQA GCSE Computer Science June 2022 Paper 1 (8525/1B, the Python paper) is six multiple choice parts about one six line algorithm. One mark each. They test whether you know the names of things: selection, assignment, relational operator, definite iteration.
We do not copy the exam paper here. Open it beside this page: AQA June 2022 Paper 1B question paper (PDF). When you have finished, check the mark scheme too.
The question in short
The algorithm reads a whole number into i. If i MOD 2 equals 0 it outputs i * i. Otherwise it outputs i.
MOD gives the remainder after a division. 14 MOD 3 is 2. A number MOD 2 is 0 when the number is even, so this algorithm squares even numbers and leaves odd numbers alone.
The six parts
1.1 Where is selection first used? Selection is choosing, and the IF is on line 2.
1.2 What is output when the input is 4? 4 MOD 2 is 0, so the output is 4 * 4 = 16. Not 8: i * i is squaring, not doubling.
1.3 Where is assignment first used? Assignment is storing a value in a variable, shown by the arrow. The first arrow is on line 1, where the input is stored in i.
1.4 Which line has a relational operator? Relational operators compare: =, ≠, <, >, ≤, ≥. The = in i MOD 2 = 0 is on line 2. MOD and * are arithmetic operators, not relational ones.
1.5 Which statement is true? The algorithm uses the multiplication operator, in i * i. It has no Boolean operator (AND, OR, NOT), no named constant and no loop.
1.6 Which Python version repeats five times with definite iteration? Definite means count controlled: a for loop. That rules out the two while versions, even though one of them does repeat five times. Of the two for loops, range(0, 5) gives 0, 1, 2, 3, 4, which is five passes. range(0, 6) gives six. The answer is the for loop with range(0, 5).
The answers
| Part | Answer |
|---|---|
| 1.1 | B, line 2 |
| 1.2 | E, 16 |
| 1.3 | A, line 1 |
| 1.4 | B, line 2 |
| 1.5 | D, multiplication operator |
| 1.6 | A, for x in range(0, 5) |
Where the marks are lost
- Mixing up
=and the arrow. In AQA pseudo-code the arrow assigns and=compares. In Python=assigns and==compares. Know both. - Calling MOD a relational operator. It does arithmetic. It gives a number, not True or False.
- Choosing a
whileloop that happens to work. Part 1.6 asks for definite iteration. Awhileloop is indefinite (condition controlled) however many times it runs. range(0, 6)for five.rangestops one before its second number.
Run it
The answer to 1.6 as a program. The robot's light is green for an even number and blue for an odd one.
The program
from bugbot import *
connect()
for x in range(0, 5):
i = int(input("Enter a number: "))
if i % 2 == 0:
led("green")
print(i * i)
else:
led("blue")
print(i)
Questions
What are the answers to AQA GCSE Computer Science 2022 Paper 1 Question 1?
1.1 is B (line 2). 1.2 is E (16). 1.3 is A (line 1). 1.4 is B (line 2). 1.5 is D (the multiplication operator). 1.6 is A, the for loop with range(0, 5).
What does MOD mean in AQA pseudo-code?
MOD gives the remainder after integer division, so 14 MOD 3 is 2. In Python it is written %. A number MOD 2 is 0 for an even number and 1 for an odd number.
What is the difference between definite and indefinite iteration?
Definite iteration repeats a set number of times and uses a FOR loop. Indefinite iteration repeats until a condition changes and uses WHILE or REPEAT UNTIL.
What is a relational operator?
A relational operator compares two values and gives True or False. They are equal to, not equal to, less than, greater than, less than or equal to, and greater than or equal to.
More from this paper
- Question 2: Follow a nested IF with AND, then name the data types 6 marks
- Question 9: String indexing, LEN and SUBSTRING 5 marks
Every AQA 8525 question we have worked
Learn it step by step
- F2.2 Selection: if Decisions and loops
- F1.9 Arithmetic operators Programming basics
- F2.5 Count-controlled loops: for Decisions and loops
This is our own explanation of a published exam question. It is not written or endorsed by AQA, and the question paper and mark scheme remain AQA's copyright. Read them on AQA's site with the links on this page.