Edexcel GCSE Computer Science June 2025 Paper 1, Question 5(a) to (c): computational thinking
Pearson Edexcel 1CP2/01 June 2025, Question 5(a) to (c): complete a three-input truth table, find the record and field traversals in a nested loop and fix its logic error, and trace a loop that adds up the factors of 6. Worked through, with the programs to run.
Question 5 of the Pearson Edexcel GCSE Computer Science Paper 1 sat on 12 May 2025 (1CP2/01, Principles of Computer Science) is the computational thinking question, 20 marks. This page works through the first three parts. Parts (d) and (e) are on the next page.
We do not copy the paper here. Open it beside this page: Edexcel June 2025 Paper 1 question paper (PDF). When you have finished, check the mark scheme too.
Part (a): the truth table (3 marks)
A truth table with inputs A, B and C has two working columns, S and T, and an output Q = NOT S AND T. The S and T columns are filled in, but their expressions are missing, and the Q column is empty.
Read the expressions off the columns. S is 1 only in the rows where A and C are both 1: S = A AND C. T is 1 whenever B or C is 1: T = B OR C.
Then Q is 1 when S is 0 and T is 1:
| A | B | C | S | T | Q |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 | 0 |
Part (b): the sales data (3 marks)
salesData is a list of six records, each a list of three numbers. Line 17 is for sale in salesData, and inside it line 19 is for item in sale. Each item is added to a total, and an if on line 21 compares item with currMax. After the loops, currMax is printed.
- Traverses the records: line 17. Each
saleis one record. - Traverses the fields: line 19. Each
itemis one field of that record. - The logic error:
currMaxis meant to end up as the largest value, but line 21 testsitem < currMax, so it finds the smallest. The corrected line isif (item > currMax):.
Part (c): the factors trace table (4 marks)
NUM is 6 and total is 0. A loop runs number from 1 to 6. Each time, remainder is NUM % number, and if it is 0, number is added to total. Then total is printed.
So it adds up the numbers that divide 6 exactly.
| number | remainder | total | Output |
|---|---|---|---|
| 0 | |||
| 1 | 0 | 1 | |
| 2 | 0 | 3 | |
| 3 | 0 | 6 | |
| 4 | 2 | ||
| 5 | 1 | ||
| 6 | 0 | 12 | |
| 12 |
One mark for the number column, one for the rows 1 to 3, one for the rows 4 to 6, one for a single output.
Where the marks are lost
- Reading S and T from the names. Work them out from the 1s and 0s in the columns.
- Answering only
>for the logic error. The mark scheme says the whole line, so it is clear which line changes. - Running the loop to 5.
range(1, NUM + 1)includes 6, and 6 is a factor of itself. - Writing a total on every row. It only changes when the remainder is 0.
Run it
The sales data with the logic error fixed, then the factors loop printing its trace.
The program
from bugbot import *
connect()
salesData = [[9, 6, 32], [20, 12, 9], [9, 8, 8], [32, 24, 29], [7, 20, 12], [6, 9, 6]]
total = 0
currMax = 0
for sale in salesData:
total = 0
for item in sale:
total = total + item
if item > currMax:
currMax = item
print(sale, total)
print("largest item", currMax)
NUM = 6
total = 0
print("number remainder total")
for number in range(1, NUM + 1):
remainder = NUM % number
if remainder == 0:
total = total + number
print(number, remainder, total)
print(total)
Questions
What is the answer to Edexcel 2025 Paper 1 Question 5(c)?
number goes 1 to 6. The remainders are 0, 0, 0, 2, 1, 0. total goes 1, 3, 6, then stays, then 12. The output is 12.
How do I work out a truth table column's expression from its values?
Look for the rows where it is 1. If it is 1 only when two inputs are both 1, it is AND. If it is 1 whenever either is 1, it is OR.
What is the difference between traversing records and traversing fields?
The outer loop over a 2D list visits each record, one row at a time. The inner loop over one record visits each field, one value at a time.
More from this paper
Every Edexcel 1CP2 question we have worked · Guide: Logic gates and truth tables explained
Learn it step by step
- F9.1 Logic gates and truth tables Logic and computer systems
- F3.5 Two-dimensional arrays Strings, lists and records
- F13.2 Trace tables Exam preparation
This is our own explanation of a published exam question. It is not written or endorsed by Pearson, and the question paper and mark scheme remain Pearson's copyright. Read them on Pearson's site with the links on this page.