AQA GCSE Computer Science June 2024 Paper 1, Question 1: strings, assignment and a first program
AQA 8525 June 2024 Paper 1, Question 1: assign the length of a string, use the POSITION subroutine, choose a data type, describe assignment, and write a two line Python program that echoes a film name. Worked through, with the program to run.
Question 1 of the AQA GCSE Computer Science Paper 1 sat on 15 May 2024 (8525/1B, the Python paper) is five short parts worth 6 marks. They are quick marks, and each one has a way to slip.
We do not copy the exam paper here. Open it beside this page: AQA June 2024 Paper 1B question paper (PDF). When you have finished, check the mark scheme too.
The question in short
A pseudo-code algorithm stores a film title in film and the year 2021 in year, asks the user to guess a letter, and stores the input in letter.
The five parts
1.1 Which statement stores the length of film in value? value ← LEN(film). The variable being given the value goes on the left of the arrow. film ← LEN(value) is the same words the wrong way round.
1.2 Complete location ← using the POSITION subroutine. The paper's examples show the string first and the character second, so:
location ← POSITION(film, letter)
No quotation marks. film and letter are variables. POSITION("film", "letter") would look for the word letter in the word film, and the mark scheme rejects quotes.
1.3 The data type for year. Integer. 2021 is a whole number.
1.4 What is an assignment statement? One that gives a value to a variable.
1.5 The program (2 marks). Get the user to enter a film name, then display You entered followed by the name, on one line.
film = input()
print("You entered", film)
One mark for storing the input in a variable. One for the output. Any error caps it at 1. Joining with + works too, if you put a space inside the quotation marks: "You entered " + film.
Where the marks are lost
- The arguments the wrong way round in 1.2. Copy the order from the example: string, then character.
- "Assignment is when you use the equals sign." That says how it is written, not what it does. Say that a value is stored in a variable.
- Two
printstatements in 1.5. That puts the output on two lines, and the question says one. print("You entered film"). Inside the quotation marksfilmis just text. The variable goes outside them.
Run it
All five parts in Python. find is Python's version of POSITION. The robot's light is green if your letter is in the title.
The program
from bugbot import *
connect()
film = "Godzilla vs. Kong"
year = 2021
value = len(film)
print("The title has", value, "characters")
letter = input("Please guess a letter: ")
location = film.find(letter)
print("location is", location)
if location >= 0:
led("green")
else:
led("red")
film = input("Enter the name of a film: ")
print("You entered", film)
Questions
What are the answers to AQA GCSE Computer Science 2024 Paper 1 Question 1?
1.1 is D, value ← LEN(film). 1.2 is POSITION(film, letter). 1.3 is C, integer. 1.4: a statement that gives a value to a variable. 1.5: film = input() then print("You entered", film).
What is an assignment statement?
A statement that stores a value in a variable, such as year ← 2021 in pseudo-code or year = 2021 in Python.
How do I print text and a variable on one line in Python?
Put both in one print, separated by a comma: print("You entered", film). Or join them with +, remembering the space: print("You entered " + film).
More from this paper
- Question 2: Follow an IF, ELSEIF chain with NOT, OR, AND and MOD 5 marks
- Question 5: The output of a nested IF for three pairs of inputs 3 marks
- Question 10: Trace three subroutines that call each other 2 marks
- Question 12.1 to 12.5: A sliding puzzle: move tiles, and read nested loops that find the blank 7 marks
Every AQA 8525 question we have worked
Learn it step by step
- F3.1 String handling Strings, lists and records
- F1.6 Variables, constants and assignment Programming basics
- F1.7 Input from the user Programming basics
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.