Paper 1

PrepWiseGuide to a real paper

AQA GCSE Computer Science

Paper 1

June 2025
90 marks · 2 hours · 11 questions

A real paper, in its real order. Each description and answer is ours, so you can see how each mark is earned. Not made or approved by AQA.

PrepWise guide: AQA GCSE Computer Science Paper 1Question 1

Figure 1 is a short Python program. We number its eight lines only so they can be named in the questions.

Figure 1
A short Python program listed in eight numbered lines.Open full size to read the labels (Figure 1, opens in a new tab)
01.1[1 mark]

Choose the line in Figure 1 where a calculation with an arithmetic operator happens first.

See how you would score on Trace Tables
Line 1
Line 5
Line 6Correct answer
Line 8
Show model answer for 01.1Hide model answer for 01.1

Line 6. It is the first line that adds two values together.

1 mark

How the marks are earned

  1. Line 6, where a value is added to itself.
  2. Choosing more than one option earns nothing.
Revise Trace Tables
01.2[1 mark]

Choose the one statement about Figure 1 that is untrue.

See how you would score on Operators
It includes a comment
It uses assignment
It uses concatenationCorrect answer
It uses iteration
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

  1. The statement 'It uses concatenation' is the false one.
  2. Choosing more than one option earns nothing.
Revise Operators
01.3[1 mark]

Name the relational operator that Figure 1 contains. The symbol or its name is fine.

See how you would score on Operators
Show model answer for 01.3Hide model answer for 01.3

< (less than). The loop condition b < c compares two values, so < is the relational operator.

1 mark

How the marks are earned

  1. < or the words less than.
  2. Writing the assignment symbol = earns nothing.
Revise Operators
01.4[4 marks]

Fill in a trace table with columns a, b, c and Output for the whole of Figure 1.

See how you would score on Trace Tables
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

  1. First row of the table: a is 1, b is 1 and c is 5.
  2. The first output is 2.
  3. 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.
  4. The rest of column b is 2, 3, 4, 5, with no extra values.
  5. Different rows may be used if the order within each column is clear.
  6. A value written again on the next row of the same column does not count against the answer.
  7. 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.

Revise Trace Tables
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[7 marks]
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.

Figure 2
A Python program with three gaps marked by numbered black circles.Open full size to read the labels (Figure 2, opens in a new tab)
02.1[3 marks]

Write the Python that fills gaps 1, 2 and 3 in Figure 2 so every stamp gets the correct reward.

See how you would score on Selection (IF Statements)
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

  1. Gap 1 is the condition i % 5 == 0.
  2. Gap 2 is print("Free biscuit").
  3. Gap 3 is print("Nothing free").
  4. Capital or small letters make no difference to the marking.
  5. Small spelling slips in the messages are ignored.
  6. 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.

Revise Selection (IF Statements)
02.2[4 marks]

Write a program that reads how many free biscuits, pastries and cakes were given away into separate meaningful variables, then prints their total value.

See how you would score on Variables & Constants
Show model answer for 02.2Hide model answer for 02.2
free_biscuits = int(input("Free biscuits given: "))
free_pastries = int(input("Free pastries given: "))
free_cakes = int(input("Free cakes given: "))
day_value = free_biscuits * 1 + free_pastries * 2.5 + free_cakes * 3
print("Total value in pounds:", day_value)
4 marks

How the marks are earned

  1. At least one of the three counts is read from the keyboard into a variable.
  2. User input is stored in three separate variables, one each for biscuits, pastries and cakes.
  3. An expression that works out the total value correctly: 1 per biscuit, 2.5 per pastry and 3 per cake.
  4. The total value is output.
  5. The case of the code is ignored; messages with the input and output statements are optional.
  6. Gaps and spaces are ignored unless they change the logic.
  7. The same syntax error repeated in the three input statements costs only one mark.
  8. 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.

Revise Variables & Constants
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[7 marks]
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.

See how you would score on Selection (IF Statements)
Show model answerHide model answer
number_of_students = int(input("Number of students: "))
if number_of_students <= 15:
   total_cost = 20 + 5 * number_of_students
elif number_of_students <= 25:
   total_cost = 20 + 3 * number_of_students
else:
   total_cost = 100
print("Total cost in pounds:", total_cost)

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

  1. Meaningful variable names are used throughout, such as number_of_students and total_cost (design mark).
  2. A selection structure is used on the number of students (design mark).
  3. The number of students is read from the user and stored in a variable.
  4. At least one correct Boolean condition on the number of students. Quotes round the numbers in this one condition are tolerated.
  5. 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.
  6. One expression gives the total correctly and sits under its own condition.
  7. Expressions give the total correctly for all three pricing routes.
  8. 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.
  9. The case of the code is ignored; messages with input and output are optional; gaps are ignored unless they change the logic.
  10. 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.
  11. If the code has any error, the maximum is 7 marks.
  12. 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.

Revise Selection (IF Statements)
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[8 marks]
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.

Figure 3
A test plan table with a header row, a filled first row and a second row whose test data cell is empty.Open full size to read the labels (Figure 3, opens in a new tab)
Figure 4
Six statements of an algorithm, each with a numbered black circle in front, listed one under another.Open full size to read the labels (Figure 4, opens in a new tab)
Figure 4B
An empty flowchart frame: a start box, two parallelogram boxes, a decision with a yes exit going down and a no exit going right, an empty box on each exit, a parallelogram box and a stop box, joined by arrows.Open full size to read the labels (Figure 4B, opens in a new tab)
04.1[1 mark]

Choose the best statement of what validation is for.

See how you would score on Input Validation
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

  1. The purpose is to test whether the data entered is sensible for the program to use.
  2. Choosing more than one option earns nothing.
Revise Input Validation
04.2[6 marks]

Write a program that asks for a first name until its length is allowed, printing the right message each time, with meaningful variable names.

See how you would score on Iteration (Loops)
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

  1. An iteration structure is used that repeats until a name of an allowed length is entered (design mark).
  2. A string's length is worked out properly, at least once.
  3. 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.
  4. All the length checks are made and combined correctly. Quotes round the numbers in this condition lose the mark.
  5. A name can be entered again inside the iteration structure.
  6. 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.
  7. The case of the code is ignored; messages with the input statements are optional; gaps are ignored unless they change the logic.
  8. If the code has any error, the maximum is 5 marks.
  9. 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.

Revise Iteration (Loops)
04.3[1 mark]

Pick the option that explains what boundary test data is.

See how you would score on Testing
Input of a type the program does not accept
Data at the edge of what is allowedCorrect answer
Data the program is designed to receive
Data that would produce a syntax error
Show model answer for 04.3Hide model answer for 04.3

Boundary data sits at the edge of the allowed range, on or just beside a limit. Wrong-type data is erroneous, and data the program expects is normal.

1 mark

How the marks are earned

  1. Boundary data sits right on the edge of the range the program accepts.
  2. Choosing more than one option earns nothing.
Revise Testing
04.4[1 mark]

How long could the test 2 name in Figure 3 be? Give a character count.

See how you would score on Testing
Show model answer for 04.4Hide model answer for 04.4

1 character, or 15 characters. Allowed names have 2 to 14 characters, so 1 and 15 are the values just outside the limits that must be rejected.

1 mark

How the marks are earned

  1. 1 or 15 characters.
  2. Giving both 1 and 15 is also accepted.
Revise Testing
04.5[1 mark]

Name one type of test data, other than normal and boundary, that the test plan so far leaves out.

See how you would score on Testing
Show model answer for 04.5Hide model answer for 04.5

Erroneous (invalid) test data. This is data the program should reject, such as data of the wrong type.

1 mark

How the marks are earned

  1. Erroneous test data, also called invalid.
  2. A description of erroneous data, such as data of the wrong type, is also accepted.
  3. Minor spelling mistakes are ignored.
  4. Typical, extreme, boundary and normal are rejected.
Revise Testing
04.6[3 marks]

Place the numbered statements of Figure 4 into the frame in Figure 4B so the flowchart builds the username.

See how you would score on Pseudocode & Flowcharts
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

  1. Labels 1 and 6 come first, in either order, and label 4 is the final step after the decision.
  2. Label 2 is the decision, with one exit for yes and one for no.
  3. Label 5 is on the yes exit and label 3 is on the no exit, and both lead on to label 4.
  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.

Revise Pseudocode & Flowcharts
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[13 marks]
PrepWise guide: AQA GCSE Computer Science Paper 1Question 5

In Figure 5, Python collects five whole numbers from the keyboard, converting each with int(), and displays the sum.

Figure 5
A short Python program of seven lines.Open full size to read the labels (Figure 5, opens in a new tab)
05.1[1 mark]

Define the term data type.

See how you would score on Data Types
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

  1. A data type specifies the kind of value or data a variable holds.
  2. Alternatively, it fixes the operations that may be performed on whatever a variable holds.
  3. Writing information in place of data does not earn the mark.
Revise Data Types
05.2[1 mark]

Explain why num1 to num5 are not given a string data type.

See how you would score on Data Types
Show model answer for 05.2Hide model answer for 05.2

Strings would be joined, not added. For example "4" + "7" would give "47" instead of 11, so total would be wrong.

1 mark

How the marks are earned

  1. With string variables, + would stick the numbers together as text (concatenation) rather than adding them.
  2. Or the numbers have to be added to each other.
  3. Or + works as arithmetic only when the values on both sides of it are numbers.
Revise Data Types
05.3[1 mark]

Name the Python data type that holds numbers with a fractional part.

See how you would score on Data Types
Show model answer for 05.3Hide model answer for 05.3

float. A float holds a number with a fractional part, such as 3.5.

1 mark

How the marks are earned

  1. float.
  2. Case is ignored.
  3. The word real is rejected.
Revise Data Types
05.4[5 marks]

Rewrite Figure 5 so a loop with only one input() call totals the five numbers. Use meaningful variable names.

See how you would score on Iteration (Loops)
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

  1. An iteration structure that exists in the language is used (design mark).
  2. The loop condition makes it repeat exactly five times.
  3. User input is used once, in a sensible place inside the loop.
  4. The total of the entered values is built up correctly.
  5. The total is output once, in a sensible place after the loop.
  6. The case of the code is ignored; messages with input and output are optional; gaps are ignored unless they change the logic.
  7. If the code has any error, the maximum is 4 marks.
  8. 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.

Revise Iteration (Loops)
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[8 marks]
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.

Figure 6
A row of five boxes, each holding one whole number.Open full size to read the labels (Figure 6, opens in a new tab)
06.1[3 marks]

Show bubble sort on the Figure 6 numbers: list the order after each change, between the printed start order and the sorted order.

See how you would score on Bubble Sort
Show model answer for 06.1Hide model answer for 06.1
45   23   78   55   49
23   45   78   55   49
23   45   55   78   49
23   45   55   49   78
23   45   49   55   78
3 marks

How the marks are earned

  1. First changed row: 23 45 78 55 49.
  2. Second changed row: 23 45 55 78 49.
  3. Third changed row: 23 45 55 49 78 (the last row, 23 45 49 55 78, is the sorted result).
  4. Each correct change in the correct order earns one mark. Blanks for repeated values are ignored.
  5. 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.
  6. If the grid is not fully correct, the maximum is 2 marks.
  7. 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.

Revise Bubble Sort
06.2[3 marks]

Show the merge stage of a merge sort on the Figure 6 numbers, row by row, down to one sorted row.

See how you would score on Merge Sort
Show model answer for 06.2Hide model answer for 06.2
45   23   78   55   49
[23 45]   [55 78]   [49]
[23 45]   [49 55 78]
[23 45 49 55 78]
3 marks

How the marks are earned

  1. 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).
  2. One element is left on its own after the pairs are made, for example 49.
  3. Three or four elements are merged and sorted correctly, for example 49 55 78 or 23 45 55 78.
  4. If the sorted row is already given, or is written again, nothing is lost.
  5. 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.

Revise Merge Sort
06.3[2 marks]

Compare bubble sort with merge sort: give one point in bubble sort's favour and one against it.

See how you would score on Bubble Sort
Show model answer for 06.3Hide model answer for 06.3

Advantage: bubble sort needs fewer lines of code, so it is simpler to write and check.

Disadvantage: bubble sort is slower than merge sort on a long list, because it makes many passes of comparisons.

2 marks

How the marks are earned

  1. Advantage, one of: simpler to code, needing fewer lines of code than merge sort; or often faster on small lists.
  2. Using less memory, with only one extra storage location where merge sort needs more, is also accepted as an advantage.
  3. Disadvantage, one of: bubble sort does not sort lists (especially large ones) as quickly as merge sort; or it is less efficient.
  4. An unqualified answer such as bubble sort is simple earns nothing.

Why it scores

Quoting the reason (fewer lines) is what stops the answer being the unqualified word simple.

The comparison with merge sort is what qualifies the answer.

Revise Bubble Sort
06.4[2 marks]

Give reasons binary search is a better choice than linear search on 2500 numbers kept in ascending order.

See how you would score on Binary Search
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

  1. 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.
  2. 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.

Revise Binary Search
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[10 marks]
PrepWise guide: AQA GCSE Computer Science Paper 1Question 7

Figure 7 shows a pseudo-code subroutine called testSub.

Figure 7
A subroutine set out in ten short lines, indented in places.Open full size to read the labels (Figure 7, opens in a new tab)
07.1[1 mark]

Say what task the subroutine in Figure 7 performs.

See how you would score on Pseudocode & Flowcharts
Show model answer for 07.1Hide model answer for 07.1

It tests whether a number is even. It returns True for an even number and False for an odd one.

1 mark

How the marks are earned

  1. It finds out whether a number is odd or even, or a multiple of 2.
  2. Or it returns True if the number is even and False if it is odd.
  3. Or it returns True if the number is a multiple of 2 and False if it is not.
  4. Or True comes back when the remainder after dividing by 2 is 0, and False when the remainder is 1 or anything other than 0.
Revise Pseudocode & Flowcharts
07.2[2 marks]

List the two values output when testSub(10) is called.

See how you would score on Pseudocode & Flowcharts
Show model answer for 07.2Hide model answer for 07.2
Program code        Output
OUTPUT number       10
OUTPUT x            0
2 marks

How the marks are earned

  1. OUTPUT number prints 10.
  2. OUTPUT x prints 0.

Why it scores

The first output is the parameter itself, 10. The second output is what is left over after dividing 10 by 2, which is 0.

Revise Pseudocode & Flowcharts
07.3[1 mark]

Give the value testSub(8) returns.

See how you would score on Pseudocode & Flowcharts
Show model answer for 07.3Hide model answer for 07.3

True. Dividing 8 by 2 leaves a remainder of 0, so the subroutine takes the THEN branch and returns True.

1 mark

How the marks are earned

  1. True.
  2. Case is ignored.
Revise Pseudocode & Flowcharts
07.4[1 mark]

Name the parameter of testSub.

See how you would score on Pseudocode & Flowcharts
Show model answer for 07.4Hide model answer for 07.4

number. It is the name in the brackets on the first line, which receives the value passed in.

1 mark

How the marks are earned

  1. number.
  2. Case is ignored.
Revise Pseudocode & Flowcharts
07.5[2 marks]

Give two features of programming in a structured way.

See how you would score on Computational Thinking
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

  1. 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.
  2. It uses parameters.
  3. It uses return values.
  4. It uses local variables.
  5. It uses selection.
  6. It uses iteration.
  7. 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.

Revise Computational Thinking
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[7 marks]
PrepWise guide: AQA GCSE Computer Science Paper 1Question 8

Figure 8 shows an algorithm in pseudo-code. The line numbers are for reference only.

Figure 8
An algorithm written in pseudo-code, listed in fifteen numbered lines.Open full size to read the labels (Figure 8, opens in a new tab)
08.1[5 marks]

Trace Figure 8 with b1 set to '0010' and b2 set to '0111', filling in columns b1, b2, new and i.

See how you would score on Trace Tables
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

  1. Both input strings, '0010' under b1 and '0111' under b2, are written and nothing else appears in those two columns.
  2. i begins at 0.
  3. After the first row, i goes 1, 2, 3 on the next three rows and nothing more.
  4. The first value of new is '0', or an empty string followed by '0'.
  5. Below the first entry, new reads '01', then '010', then '0101', with nothing extra.
  6. Different rows may be used if the order within each column is clear.
  7. Writing the same value again on the next row of a column is not penalised.
  8. Missing quotes round the strings are ignored.
  9. 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.

Revise Trace Tables
08.2[1 mark]

Explain why line 4 of Figure 8 stops at LEN(b1) - 1, not LEN(b1).

See how you would score on Iteration (Loops)
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

  1. So the algorithm does not try to reach a character that is not in the string.
  2. Or so it does not use an index that is out of range.
  3. Or because positions in a string are numbered from 0, not 1.
  4. Saying it stops the program crashing, or prevents a run-time error, is also accepted.
Revise Iteration (Loops)
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[6 marks]
PrepWise guide: AQA GCSE Computer Science Paper 1Question 9

Figure 9 shows five pseudo-code algorithms, A to E. Each is meant to add up the five values stored in the array numbers. Some of them do not work.

Figure 9
Five pseudo-code algorithms in framed boxes, each with a letter A to E in a grey strip on its left edge.Open full size to read the labels (Figure 9, opens in a new tab)
09[2 marks]

Tick one row in each column A to E: does that algorithm total all five values, or not?

See how you would score on Trace Tables
Show model answerHide model answer
                                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

  1. Any three columns correct earns one mark.
  2. All five columns correct earns both marks.
  3. A column with more than one tick earns nothing for that column.
  4. 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.

Revise Trace Tables
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[2 marks]
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.

Figure 10
A record structure written in pseudo-code, with three named fields.Open full size to read the labels (Figure 10, opens in a new tab)
Figure 11
Two lines of pseudo-code that each create one record.Open full size to read the labels (Figure 11, opens in a new tab)
10.1[1 mark]

Write the pseudo-code line creating record race3 for event 200 m, runner 10, time 32.59, following Figure 11.

See how you would score on Data Types
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

  1. 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.
  2. Case is ignored.
  3. Missing quotes, commas or brackets earn nothing.
Revise Data Types
10.2[1 mark]

Write the pseudo-code line that outputs the time stored in record race2 (Figure 11).

See how you would score on Data Types
Show model answer for 10.2Hide model answer for 10.2
OUTPUT race2.time
1 mark

How the marks are earned

  1. OUTPUT race2.time, with the field name after a full stop.
  2. Case is ignored.
  3. A missing full stop earns nothing.
Revise Data Types
10.3[6 marks]

Write Python to find and print the smallest value in times, any size, with no built-in minimum or sort routine.

See how you would score on Iteration (Loops)
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

  1. 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.
  2. A variable is set to a suitable number to hold the fastest time, or the position of the fastest time.
  3. 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.
  4. 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.
  5. The current fastest time, or its position, is stored correctly on each pass, with correct indexing.
  6. The fastest time is output once, from a variable, in a suitable place.
  7. A built-in routine that finds the smallest value or sorts the array loses the checking mark and the storing mark.
  8. The case of the code is ignored; gaps are ignored unless they change the logic.
  9. If the code has any error, the maximum is 5 marks.
  10. 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.

Revise Iteration (Loops)
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[8 marks]
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.

Figure 12
A Python subroutine of eight numbered lines.Open full size to read the labels (Figure 12, opens in a new tab)
Figure 13
The first four lines of a Python program.Open full size to read the labels (Figure 13, opens in a new tab)
11.1[1 mark]

Passing "system", "s" and "*y**em" to findLetter, pick the value held by letter when line 4 of Figure 12 first runs.

See how you would score on Trace Tables
*y**em
sCorrect answer
sys**m
system
Show model answer for 11.1Hide model answer for 11.1

s. The second value in the call is passed to the parameter letter, so it holds "s".

1 mark

How the marks are earned

  1. s.
  2. Choosing more than one option earns nothing.
Revise Trace Tables
11.2[1 mark]

In the same call, choose the value of newHidden the first time line 6 of Figure 12 is reached.

See how you would score on Trace Tables
sCorrect answer
sys
sys**m
system
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".

1 mark

How the marks are earned

  1. s.
  2. Choosing more than one option earns nothing.
Revise Trace Tables
11.3[1 mark]

In the same call, choose how many times the loop in Figure 12 repeats.

See how you would score on Trace Tables
1
2
6Correct answer
7
Show model answer for 11.3Hide model answer for 11.3

6. The loop runs once for each letter of "system", and the word has 6 letters.

1 mark

How the marks are earned

  1. 6.
  2. Choosing more than one option earns nothing.
Revise Trace Tables
11.4[1 mark]

In the same call, choose the value that findLetter returns.

See how you would score on Trace Tables
s
sy*tem
sys*emCorrect answer
system
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.

1 mark

How the marks are earned

  1. sys*em.
  2. Choosing more than one option earns nothing.
Revise Trace Tables
11.5[10 marks]

Extend Figure 13: up to eight times, or until no * remains, input a letter, call findLetter, update hidden, show it; report win or loss.

See how you would score on Iteration (Loops)
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

  1. A new iteration structure is created and a letter is input inside it (design mark).
  2. A selection structure is used for both the winning and the losing messages (design mark).
  3. 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.
  4. 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.
  5. The loop body calls findLetter; wrong or absent arguments do not matter for this mark.
  6. 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.
  7. hidden is updated from the value findLetter returns. Setting hidden to an empty string again inside the loop earns nothing.
  8. The program correctly checks whether any asterisks are left in hidden and deals with the result.
  9. The value of hidden is displayed after each guess.
  10. You won and You lost are displayed in suitable places, under the correct conditions.
  11. 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.
  12. The case of the code is ignored; messages with input statements are optional; gaps are ignored unless they change the logic.
  13. If the code has any error, the maximum is 9 marks.
  14. 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.

Revise Iteration (Loops)
AQA owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by AQA.[14 marks]
END OF QUESTIONS90 marks total
See how you would score on Iteration (Loops)

Our own questions on this topic, marked straight away, so you see what to revise. Free now.