Show model answer for 01.2Hide model answer for 01.2
The false statement is that the program uses concatenation, which means joining strings together. Every + in the program adds numbers, so nothing is joined as text. The comment on line 1, the assignments and the while loop are all really there.
1 mark
How the marks are earned
The statement 'It uses concatenation' is the false one.
Show model answer for 01.4Hide model answer for 01.4
a b c Output
1 1 5
2 2 2
4 3 4
8 4 8
16 5 16
4 marks
How the marks are earned
First row of the table: a is 1, b is 1 and c is 5.
The first output is 2.
Column a continues 2, 4, 8, 16 below its first value and Output has 4, 8, 16 below its first value; neither column holds anything extra.
The rest of column b is 2, 3, 4, 5, with no extra values.
Different rows may be used if the order within each column is clear.
A value written again on the next row of the same column does not count against the answer.
If the table has any error, the maximum is 3 marks.
Why it scores
The starting values 1, 1 and 5 fill the first row. Each pass of the loop doubles a, adds 1 to b and prints the new a, giving 2, 4, 8 and 16. When b reaches 5 the test b < c fails, so the loop stops with nothing more printed.
PrepWise guide: AQA GCSE Computer Science Paper 1Question 2
A coffee shop gives one stamp per drink on a card that holds 20 drinks. Every 4th stamp earns a biscuit, every 5th a pastry, and the 20th a cake with no biscuit or pastry. Figure 2 is a program that should print Free biscuit for a biscuit stamp, Free pastry for a pastry stamp, Free cake for the 20th, and Nothing free for any other drink; it has three gaps to fill. Each day the shop also adds up what it gave away: biscuit £1, pastry £2.50, cake £3.
Show model answer for 02.1Hide model answer for 02.1
Gap 1: i % 5 == 0
Gap 2: print("Free biscuit")
Gap 3: print("Nothing free")
The cake test comes first, so stamp 20 never reaches the pastry or biscuit tests.
3 marks
How the marks are earned
Gap 1 is the condition i % 5 == 0.
Gap 2 is print("Free biscuit").
Gap 3 is print("Nothing free").
Capital or small letters make no difference to the marking.
Small spelling slips in the messages are ignored.
Missing brackets on print cost one mark only, once, and are not penalised again for the other gap.
Why it scores
Gap 1 is the multiple-of-5 test, which sits between the cake test and the multiple-of-4 test. The next branch handles multiples of 4, so gap 2 prints the biscuit message. The else branch catches every other stamp, so gap 3 prints the nothing message.
Testing the most specific case first is what stops stamp 20 being given a pastry as well.
Write a program that reads how many free biscuits, pastries and cakes were given away into separate meaningful variables, then prints their total value.
At least one of the three counts is read from the keyboard into a variable.
User input is stored in three separate variables, one each for biscuits, pastries and cakes.
An expression that works out the total value correctly: 1 per biscuit, 2.5 per pastry and 3 per cake.
The total value is output.
The case of the code is ignored; messages with the input and output statements are optional.
Gaps and spaces are ignored unless they change the logic.
The same syntax error repeated in the three input statements costs only one mark.
If the code has any error, the maximum is 3 marks.
Why it scores
Each count is read with input() and made a whole number with int(), in its own variable with a meaningful name. The total multiplies each count by its price (1, 2.5 and 3) and adds the results. The last line prints that total once.
PrepWise guide: AQA GCSE Computer Science Paper 1Question 3
A netball club charges a £20 booking fee plus £5 per student for a group of up to 15. Where a group has more than 15 students it is £3 per student instead of £5. A group of more than 25 students pays £100 flat and nothing else.
03[8 marks]
Write a program that reads the number of students and prints the session cost under these rules, using meaningful variable names.
The tests run from the smallest group upwards, so a group above 25 skips both and reaches else.
8 marks
How the marks are earned
Meaningful variable names are used throughout, such as number_of_students and total_cost (design mark).
A selection structure is used on the number of students (design mark).
The number of students is read from the user and stored in a variable.
At least one correct Boolean condition on the number of students. Quotes round the numbers in this one condition are tolerated.
All the required conditions are checked correctly so each group size reaches its own rule, with no quotes round numbers. A group above 25 must not be caught by the test for more than 15.
One expression gives the total correctly and sits under its own condition.
Expressions give the total correctly for all three pricing routes.
Only one total is output, in a place that covers every route. Printing 100 as a literal under the right condition is accepted. A print in each branch, each under its own condition, is also accepted.
The case of the code is ignored; messages with input and output are optional; gaps are ignored unless they change the logic.
Each of these, a £ sign used inside a calculation or in a value given to a variable, or quotes round numbers, loses one mark only the first time it appears.
If the code has any error, the maximum is 7 marks.
The design marks are for choosing a suitable technique and are credited whether or not the syntax is correct and whether or not the program works.
Why it scores
The names say what they hold, and the if, elif and else chain is the selection. The first test catches groups of 15 or fewer, the second catches 16 to 25, and everything left, above 25, takes the flat charge. One variable holds the cost, so a single print at the end covers all three routes.
The order matters: if the test for more than 15 came first, a group of 30 would be charged the wrong rule.
PrepWise guide: AQA GCSE Computer Science Paper 1Question 4
An app registers users and must check the first name typed in. A name is allowed when it has more than 1 character and fewer than 15, and the app prints Name accepted for a good name and Name not accepted for a bad one. Figure 3 starts a test plan for this check. Another part of the app builds a username: it asks for the first and last names, uses the first 3 characters of a first name longer than 3 characters (otherwise the whole first name), adds the last name and shows the result. Figure 4 lists the statements, each with a numbered label, and Figure 4B is the empty flowchart frame to fill.
It confirms the user is a person and not a program
It verifies the identity of the person typing
It confirms the input is a genuine name
It confirms the input is sensible for what the program needsCorrect answer
Show model answer for 04.1Hide model answer for 04.1
Validation checks that the input is sensible. It cannot prove the name is real or that the user is a person, only that the data is reasonable, for example that its length is allowed.
1 mark
How the marks are earned
The purpose is to test whether the data entered is sensible for the program to use.
Show model answer for 04.2Hide model answer for 04.2
valid = False
while not valid:
first_name = input("First name: ")
name_length = len(first_name)
if name_length > 1 and name_length < 15:
print("Name accepted")
valid = True
else:
print("Name not accepted")
6 marks
How the marks are earned
An iteration structure is used that repeats until a name of an allowed length is entered (design mark).
A string's length is worked out properly, at least once.
At least one Boolean condition tests the name or its length against one of the two limits, even if the length is not coded correctly or is missing. Quotes round the numbers in this one condition are tolerated.
All the length checks are made and combined correctly. Quotes round the numbers in this condition lose the mark.
A name can be entered again inside the iteration structure.
A structure prints the accepted message when the length is allowed and the rejected message otherwise, on every path through the program. Equivalent wording of a message is credited, and a faulty condition does not lose this mark if each message sits where it belongs.
The case of the code is ignored; messages with the input statements are optional; gaps are ignored unless they change the logic.
If the code has any error, the maximum is 5 marks.
The design mark is for choosing a suitable technique and is credited whether or not the syntax is correct and whether or not the program works.
Why it scores
The while loop is the iteration and it keeps going until the flag valid becomes True. Inside it, len() finds the length and one condition joined with and checks both limits. A good name prints Name accepted and ends the loop. Any other name prints Name not accepted and the loop asks again.
Show model answer for 04.6Hide model answer for 04.6
START
|
v
[1] firstName ← USERINPUT
|
v
[6] lastName ← USERINPUT
|
v
[2] LEN(firstName) > 3 ? -- no --> [3] username ← firstName + lastName
| |
yes |
v |
[5] username ← SUBSTRING(0, 2, firstName) + lastName |
| |
+-------------------------------------------------------------------+
|
v
[4] OUTPUT username
|
v
STOP
3 marks
How the marks are earned
Labels 1 and 6 come first, in either order, and label 4 is the final step after the decision.
Label 2 is the decision, with one exit for yes and one for no.
Label 5 is on the yes exit and label 3 is on the no exit, and both lead on to label 4.
Any pseudo-code written next to a label is ignored. If the labels are left out, the exact statements from the figure are accepted instead.
Why it scores
Each arrow shows which step runs next. Both names are read first, then the decision label 2 splits the path into a yes branch and a no branch. A first name longer than 3 characters takes label 5 and keeps only its first 3 characters. Any other name takes label 3 and keeps all of it. Both branches meet again at label 4, which outputs the username.
Show model answer for 05.1Hide model answer for 05.1
A data type says what kind of data a variable holds, such as a whole number, a real number or text. It also decides which operations can be used on that value.
1 mark
How the marks are earned
A data type specifies the kind of value or data a variable holds.
Alternatively, it fixes the operations that may be performed on whatever a variable holds.
Writing information in place of data does not earn the mark.
Show model answer for 05.4Hide model answer for 05.4
sum_so_far = 0
for turn in range(1, 6):
amount = int(input())
sum_so_far = sum_so_far + amount
print(sum_so_far)
5 marks
How the marks are earned
An iteration structure that exists in the language is used (design mark).
The loop condition makes it repeat exactly five times.
User input is used once, in a sensible place inside the loop.
The total of the entered values is built up correctly.
The total is output once, in a sensible place after the loop.
The case of the code is ignored; messages with input and output are optional; gaps are ignored unless they change the logic.
If the code has any error, the maximum is 4 marks.
The design mark is for choosing a suitable technique and is credited whether or not the syntax is correct and whether or not the program works.
Why it scores
The for loop is the iteration, and range(1, 6) makes it run exactly five times. The one input() call sits inside the loop, so a new number is read on every pass. Each number is added to sum_so_far, which starts at 0. The print is outside the loop, so the total shows only once, at the end.
PrepWise guide: AQA GCSE Computer Science Paper 1Question 6
Figure 6 gives five numbers to arrange from the smallest to the largest. We try two sorting methods, compare them, and then think about hunting for a value in a sorted array of 2500 numbers.
Third changed row: 23 45 55 49 78 (the last row, 23 45 49 55 78, is the sorted result).
Each correct change in the correct order earns one mark. Blanks for repeated values are ignored.
Showing a whole pass as one row, so the rows are 23 45 55 49 78 then 23 45 49 55 78, earns 1 mark only.
If the grid is not fully correct, the maximum is 2 marks.
The first and last rows of the grid are printed on the paper, so writing them again earns nothing and loses nothing.
Why it scores
Bubble sort swaps neighbours that are in the wrong order. In pass one, 45 and 23 swap, then 78 and 55 swap, then 78 and 49 swap, which moves 78 to the end. In pass two, 55 and 49 swap, and the list is then in order.
Pairs are sorted correctly, for example 23 45 and 55 78 (another correct pairing, such as 45 alone with 23 78 and 49 55, is equally accepted).
One element is left on its own after the pairs are made, for example 49.
Three or four elements are merged and sorted correctly, for example 49 55 78 or 23 45 55 78.
If the sorted row is already given, or is written again, nothing is lost.
If there are any errors, the maximum is 2 marks.
Why it scores
The first merge joins the five single values into sorted pairs, 23 45 and 55 78, with 49 left alone because there is nothing to pair it with. The lone 49 is then merged with the pair 55 78 to give 49 55 78. The last merge joins 23 45 with 49 55 78 into the sorted list.
Show model answer for 06.4Hide model answer for 06.4
A linear search may have to look at all 2500 values, so on average binary search is much quicker.
A binary search checks the middle value and throws away half of the list each time. For 2500 values it needs at most about 12 checks.
2 marks
How the marks are earned
Binary search is quicker or more efficient, with or without saying on average, or linear search is slower since it could need to look at every one of the 2500 values.
The value is found with fewer comparisons, or each check removes half of the remaining values. A figure such as about 12 checks at most is not needed for the mark.
Why it scores
This is the first mark: binary search is more efficient because linear search can check every value.
This is the second mark: fewer comparisons, with the halving idea and the number of checks.
Show model answer for 07.5Hide model answer for 07.5
1. The program is split into subroutines, each doing one job.
2. The subroutines use parameters to receive values and return values to give results back.
2 marks
How the marks are earned
Any two different ideas from this list and the points below earn the two marks. Idea 1: the program is modular, meaning it is split into sections, chunks or modules, uses subroutines, or uses named blocks of code, or blocks of code kept out of line; these phrasings count as one idea.
It uses parameters.
It uses return values.
It uses local variables.
It uses selection.
It uses iteration.
It has well documented interfaces, meaning clearly documented inputs and outputs of its subroutines.
Why it scores
Each line is a different feature, so the two marks are separate. The second line names two features, parameters and return values, and only one of them is needed for its mark.
Show model answer for 08.1Hide model answer for 08.1
b1 b2 new i
'0010' '0111' '' 0
'0' 1
'01' 2
'010' 3
'0101'
5 marks
How the marks are earned
Both input strings, '0010' under b1 and '0111' under b2, are written and nothing else appears in those two columns.
i begins at 0.
After the first row, i goes 1, 2, 3 on the next three rows and nothing more.
The first value of new is '0', or an empty string followed by '0'.
Below the first entry, new reads '01', then '010', then '0101', with nothing extra.
Different rows may be used if the order within each column is clear.
Writing the same value again on the next row of a column is not penalised.
Missing quotes round the strings are ignored.
If the table has any error, the maximum is 4 marks.
Why it scores
The strings are constant, and new starts empty. At position 0 both digits are 0, so a 0 is added. At position 1 only b2 has a 1, so a 1 is added. At position 2 both digits are 1, so a 0 is added. At position 3 only b2 has a 1, so a 1 is added, giving '0101' as the last value of new.
Show model answer for 08.2Hide model answer for 08.2
Positions in a string are numbered from 0, so a string of 4 characters has positions 0 to 3. A loop going up to LEN(b1) would use position 4, which is outside the string and would cause an error.
1 mark
How the marks are earned
So the algorithm does not try to reach a character that is not in the string.
Or so it does not use an index that is out of range.
Or because positions in a string are numbered from 0, not 1.
Saying it stops the program crashing, or prevents a run-time error, is also accepted.
A B C D E
Totals the five values ✓ ✓
Does not total them ✓ ✓ ✓
C loops to position 7, which is past the end of the array, and it skips position 0.
D never starts, because total is 0 and the loop needs it above 0.
E never changes x, so it never stops.
2 marks
How the marks are earned
Any three columns correct earns one mark.
All five columns correct earns both marks.
A column with more than one tick earns nothing for that column.
A and B total the five values. C, D and E do not.
Why it scores
A and B visit all five positions, 0 to 4, and add each value. C, D and E each fail, as the next paragraph shows.
These are the reasons for the three ticks in the second row. Each algorithm fails to produce the correct total.
PrepWise guide: AQA GCSE Computer Science Paper 1Question 10
Results of races are kept as records with three fields: the race name, the competitor's number and the time taken in seconds (Figure 10). Figure 11 makes two such records. Later, every competitor's time in one race is held in a real-number array named times, and the quickest is its smallest entry.
Show model answer for 10.1Hide model answer for 10.1
race3 ← Runner('200 m', 10, 32.59)
1 mark
How the marks are earned
The line assigns to race3 a call of Runner holding three values in order: the event name in quotes ('200 m'), the number 10 and the time 32.59, inside brackets and separated by commas.
Show model answer for 10.3Hide model answer for 10.3
fastest = times[0]
for position in range(1, len(times)):
if times[position] < fastest:
fastest = times[position]
print(fastest)
6 marks
How the marks are earned
The program works out or uses how many items times holds (design mark). A loop over each item of times, with no length worked out, is also accepted.
A variable is set to a suitable number to hold the fastest time, or the position of the fastest time.
A loop visits every item, however many the array holds. The loop may start at the second item when the variable starts at the first item.
At least twice, a value from the array is compared with the best time so far to see whether it is lower, even if the indexing is wrong.
The current fastest time, or its position, is stored correctly on each pass, with correct indexing.
The fastest time is output once, from a variable, in a suitable place.
A built-in routine that finds the smallest value or sorts the array loses the checking mark and the storing mark.
The case of the code is ignored; gaps are ignored unless they change the logic.
If the code has any error, the maximum is 5 marks.
The design mark is for choosing a suitable technique and is credited whether or not the syntax is correct and whether or not the program works.
Why it scores
len(times) makes the loop fit an array of any size. fastest starts as the first time, and each later time is compared with it. A smaller time replaces fastest, so after the loop it holds the smallest value, which is printed once. No min() or sort is used.
PrepWise guide: AQA GCSE Computer Science Paper 1Question 11
A word game is written in Python. The word shows as one asterisk per letter, for example ***** for apple. The player guesses one lower-case letter at a time, and each correct guess reveals that letter wherever it occurs, so p turns apple into *pp**. Figure 12 is the subroutine findLetter, which builds the new display, and Figure 13 starts the main program. The player wins by finding every letter within eight guesses, and loses after eight guesses with letters still hidden. The last part ends with the message You won or You lost, and in it built-in routines that check whether a string contains another string or a character, or that count the asterisks, are not allowed.
Show model answer for 11.2Hide model answer for 11.2
s. On the first pass the letter at position 0 matches, so "s" is added to newHidden. Line 6 is first reached on the next pass, when newHidden still holds just "s".
Show model answer for 11.4Hide model answer for 11.4
sys*em. Each "s" in the word is kept as "s", and every other position copies the old hidden character. So y, e and m stay, and position 3 stays as an asterisk.
Show model answer for 11.5Hide model answer for 11.5
word = input()
hidden = ""
for i in range(len(word)):
hidden = hidden + "*"
guesses = 0
all_found = False
while guesses < 8 and not all_found:
guess = input()
hidden = findLetter(word, guess, hidden)
print(hidden)
guesses = guesses + 1
stars_left = 0
for position in range(len(hidden)):
if hidden[position] == "*":
stars_left = stars_left + 1
if stars_left == 0:
all_found = True
if all_found:
print("You won")
else:
print("You lost")
If all_found is still False after the loop, eight guesses were used and asterisks remain, so the player lost.
10 marks
How the marks are earned
A new iteration structure is created and a letter is input inside it (design mark).
A selection structure is used for both the winning and the losing messages (design mark).
The loop lets a letter be typed up to 8 times, and never more. Any part of the loop condition about asterisks is ignored for this mark.
The iteration structure also ends when no asterisks are left in hidden, with a correct Boolean operator joining both conditions. A loop of 8 that stops early with a break when no asterisks remain is also accepted.
The loop body calls findLetter; wrong or absent arguments do not matter for this mark.
The arguments are right and in the right order: the word, then the guessed letter, then hidden. The guessed letter must be the same variable that the typed letter went into.
hidden is updated from the value findLetter returns. Setting hidden to an empty string again inside the loop earns nothing.
The program correctly checks whether any asterisks are left in hidden and deals with the result.
The value of hidden is displayed after each guess.
You won and You lost are displayed in suitable places, under the correct conditions.
A built-in routine that searches for another string or a character in a string, or counts the asterisks, loses the marks for ending the loop on a full word and for checking the asterisks.
The case of the code is ignored; messages with input statements are optional; gaps are ignored unless they change the logic.
If the code has any error, the maximum is 9 marks.
The design mark is for choosing a suitable technique and is credited whether or not the syntax is correct and whether or not the program works.
Why it scores
The first four lines are the given start. The while loop is the new iteration with the letter input inside it, and it stops at 8 guesses or when all_found becomes True, with and joining both conditions. Each pass calls findLetter(word, guess, hidden) with the guessed letter in the middle, stores the result back in hidden and prints it. A manual count in stars_left checks for asterisks without a built-in routine. The if and else at the end give the won or lost message.
This is why the final selection can use the flag alone: the loop only ends with the flag False when all eight guesses have been made.
Cookies. Essential ones keep you signed in. With your OK we'd also use a few to see which pages help people find us, never to follow you elsewhere. Cookie policy