OCR GCSE Computer Science (J277) has been examined for longer than AQA 8525, so more real sittings are genuinely public. We analysed every Paper 2 (J277/02) sitting we could obtain the real question paper and mark scheme for: June 2022 (sat Friday 27 May 2022), June 2023 (sat Thursday 25 May 2023) and June 2024 (sat Tuesday 21 May 2024). OCR's own mark schemes label each series June even though the actual exam date falls in May, which we have kept exactly as OCR names it. Paper 2 is entirely about computational thinking, algorithms and programming, and it is structured differently from AQA's equivalent paper in one important way: Boolean logic, logic gates and truth tables sit on THIS paper for OCR, not on Paper 1, and SQL is genuinely tested here too. OCR calls its own pseudocode the OCR Exam Reference Language, and it has real, specific conventions that differ from AQA's pseudocode: lowercase keywords (if, then, else, endif, for, to, next, while, endwhile, do, until), a dot-property style for array and string length (array.length, not a LEN() function call), and its own random(a, b) function that is inclusive of both endpoints, unlike Python's exclusive-upper-bound randrange. Below is what each recurring question type has asked across the three sittings we have, with a complete worked answer written to the real mark scheme for each one, every paragraph explained.
Questions © OCR, quoted for analysis under fair use. OCR Exam Reference Language code and program code described in our own words, not reproduced verbatim from the mark scheme. Mark scheme content translated into plain English, not copied. PrepWise is independent and not endorsed by OCR.
This appears once in every sitting we have full papers for: a casting-and-string-concatenation while loop generating a staff ID in June 2022, a DO UNTIL countdown loop in June 2023, and a nested IF selection structure scoring a javelin throw in June 2024.
Trace an algorithm that builds a staff ID by casting a year to a string, concatenating it onto a surname, then padding the result with x characters in a while loop until it reaches 10 characters long.
An algorithm in OCR Exam Reference Language. Line 01 inputs a surname. Line 02 inputs a starting year. Line 03 sets staffID to surname concatenated with the year cast to a string using str(year). Line 04 starts a while loop that keeps running while staffID.length is less than 10. Line 05, inside the loop, appends the character x onto staffID. Line 07, after the loop, prints ID concatenated with staffID.
On line 01 surname is set to Kofi, and on line 02 year is set to 2021. Line 03 casts year to a string with str(year) and concatenates it onto surname, so staffID becomes Kofi2021, which is 8 characters long.
Because staffID.length (8) is less than 10, the loop body on line 05 runs, appending an x to make Kofi2021x, 9 characters. The condition is checked again: 9 is still less than 10, so line 05 runs a second time, making Kofi2021xx, 10 characters, at which point the while loop exits, and line 07 outputs ID Kofi2021xx as the only line of output.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise trace table questionsTrace a DO UNTIL loop that starts a counter at 3, prints it, decrements it by 1 each pass, and keeps going until the counter reaches -1, then prints Finished.
A short algorithm in OCR Exam Reference Language. Line 01 sets start to 3. Lines 02 to 05 form a DO UNTIL loop: line 03 prints start, line 04 subtracts 1 from start, and line 05 reads UNTIL start == -1. Line 06, after the loop, prints Finished.
start is set to 3 on line 01, and because this is a DO UNTIL loop the body runs before the exit condition is ever checked, so line 03 immediately prints 3, the first output.
Line 04 then subtracts 1 from start each time, so start becomes 2, then 1, then 0, then -1, with line 03 printing each of those values (2, 1, 0) in turn before the loop checks start == -1. Once start actually reaches -1 the UNTIL condition is met, the loop stops without printing -1 itself, and line 06 prints Finished as the final output.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise trace table questionsTrace a nested selection algorithm that awards a javelin score based on distance thrown, then doubles that score if the student is not in year 11.
An algorithm in OCR Exam Reference Language. Lines 01 and 02 input javelinThrow and yearGroup. Lines 03 to 09 are an IF/ELSEIF/ELSE chain setting score to 3 if javelinThrow is 20.0 or more, 2 if it is 10.0 or more, or 1 otherwise. Lines 10 to 12 are a second, independent IF: if yearGroup is not equal to 11, score is doubled. Line 13 prints The score is followed by score.
javelinThrow is set to 14.3 on line 01 and yearGroup is set to 10 on line 02. Since 14.3 is not 20.0 or more but is 10.0 or more, the elseif branch on line 05 fires, setting score to 2 on line 06.
Because yearGroup is 10, not 11, the second IF on line 10 is true, so line 11 doubles score from 2 to 4. Line 13 then outputs The score is 4 as the one and only line of output, with no other values printed.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise trace table questionsThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
What is the main purpose of a trace table?
Trace tables are worth 3 to 4 marks in every sitting we have, always built around a short OCR Exam Reference Language algorithm with a loop or a chain of selection. Practise tracing DO UNTIL loops, WHILE loops and nested IF chains until you never skip a row.
Practise trace table questionsThis appears once in every sitting we have full papers for: drawing a three-gate circuit from a Boolean expression in June 2022, identifying two single gates from two small truth tables in June 2023, and completing a full eight-row truth table for a three-input expression in June 2024.
Draw the three logic gates, an OR gate, a NOT gate, and a final AND gate, needed to build the circuit for the expression P = (A OR B) AND NOT C, in the correct arrangement.
An incomplete logic circuit with three empty gate boxes and three labelled inputs, A, B and C, feeding into a single output P. The expression the finished circuit must represent is P = (A OR B) AND NOT C.
The innermost bracket, (A OR B), needs an OR gate taking A and B as its two inputs, since OR is the operation joining them directly. Separately, NOT C needs its own single-input NOT gate, drawn with a small circle on its output to show inversion, taking only C as input.
The final AND gate then takes the output of the OR gate as one input and the output of the NOT gate as its other input, producing P, since the whole expression joins (A OR B) with NOT C using AND, and this AND gate must not have an inversion circle, unlike the NOT gate feeding into it.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise logic gates and truth tablesWork out which single logic gate, OR or AND, produced each of two given two-input truth tables, by reading the pattern of 0s and 1s in each output column.
A two-input truth table with columns A, B and Output. The four rows read: 0,0 gives 0; 0,1 gives 1; 1,0 gives 1; 1,1 gives 1.
A second two-input truth table with columns A, B and Output. The four rows read: 0,0 gives 0; 0,1 gives 0; 1,0 gives 0; 1,1 gives 1.
Truth table 1's output is 0 only when both A and B are 0, and 1 in every other case, which is exactly the pattern an OR gate produces: the output is 1 as soon as at least one input is 1.
Truth table 2's output is 1 only on the very last row, where both A and B are 1, and 0 in every other case, which is exactly the pattern an AND gate produces: the output is 1 only when every input is 1.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise logic gates and truth tablesWork out the output P for all eight possible combinations of three Boolean inputs A, B and C, by evaluating (A AND B) first and then combining that result with C using OR.
An empty eight-row truth table with columns A, B, C and P, listing every combination of three Boolean inputs in OCR's own row order (C changing fastest, so each pair of rows shares the same A and B and differs only in C), for the expression P = (A AND B) OR C.
Working through the eight rows in pairs that share the same A and B (with C changing from 0 to 1 within each pair), (A AND B) is 0 for the first three pairs, where A and B are 00, 01 or 10, and only 1 for the final pair, where A and B are both 1.
Within each pair, the row where C is 0 keeps P equal to (A AND B) unchanged, since ORing with 0 changes nothing, while the row where C is 1 always forces P to 1, since ORing with 1 always gives 1: so the completed P column reads 0, 1, 0, 1, 0, 1, 1, 1 from top to bottom.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise logic gates and truth tablesThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
An AND gate has inputs A=1 and B=0. What is the output?
Boolean logic is tested on Paper 2 for OCR, not Paper 1, worth 2 to 4 marks in every sitting we have. Practise going bracket by bracket for circuits and expressions, and remember a three-input truth table always needs 8 rows.
Practise logic gates and truth tablesThis appears once in every sitting we have full papers for: an off-by-one array index and a total reset inside the loop in June 2022, an off-by-one loop start and a reversed addition formula in June 2023, and a copy-paste variable typo plus a missing boundary check in June 2024.
Find and fix two bugs in a program meant to total how many people are staying in a nine-room hotel: a FOR loop that starts at 1 instead of 0, skipping room 0 entirely, and a total that gets reset to 0 inside the loop on every single pass.
A program that should total the number of people across all nine hotel rooms, indices 0 to 8, stored in the array room. As written, it uses FOR count = 1 TO 8, so it never reads room[0], and it sets total = 0 as the very first line inside the loop body, before adding room[count], so total is wiped back to 0 on every single pass instead of accumulating.
The FOR loop currently reads FOR count = 1 TO 8, which skips index 0 entirely, so room[0]'s occupants are never counted. Changing it to FOR count = 0 TO 8 makes the loop visit every one of the nine rooms, indices 0 through 8, as the array actually holds.
The line total = 0 is currently written inside the loop body, so it resets the running total back to zero on every single pass, throwing away everything added on previous passes. Moving total = 0 to before the loop starts means the loop can genuinely accumulate a running total across all nine rooms.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise fixing logic errorsFind and fix two bugs in an algorithm meant to total every element of a 0-indexed array scores: a FOR loop that starts at 1 instead of 0, skipping the first element, and a line that overwrites scores[scoreCount] with total plus total instead of adding scores[scoreCount] onto the running total.
An algorithm meant to total every number in the 0-indexed array scores. Line 01 sets total to 0. Line 02 is FOR scoreCount = 1 TO scores.length - 1, which skips index 0. Line 03 is scores[scoreCount] = total + total, which overwrites the array itself with double the current total instead of adding that element onto total. Line 05 prints total.
The loop currently reads FOR scoreCount = 1 TO scores.length - 1, which never processes index 0, the array's first element. Changing line 02 to FOR scoreCount = 0 TO scores.length - 1 makes the loop cover every element the array actually contains.
Line 03 currently reads scores[scoreCount] = total + total, which overwrites the array element itself with double whatever total currently is, rather than adding that element onto the running total. Changing it to total = total + scores[scoreCount] makes the line actually accumulate each element into total, leaving the original array untouched.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise fixing logic errorsFind and fix two bugs in an algorithm meant to add two input numbers and report success or warning depending on whether the total falls between 10 and 20 inclusive: a copy-paste typo that adds num1 to itself instead of to num2, and a boundary condition that only checks the lower bound, never the upper one.
An algorithm that inputs num1 and num2, is meant to total them, and outputs success if the total is between 10 and 20 inclusive or warning otherwise. Line 03 reads total = num1 + num1, adding num1 to itself instead of to num2. Line 04 reads if total >= 10 then, which only checks the lower bound and never checks whether total also stays at or below 20.
Line 03 currently reads total = num1 + num1, which adds num1 to itself and never uses num2 at all. Changing it to total = num1 + num2 makes the algorithm genuinely total both of the numbers the user actually entered.
Line 04 currently reads if total >= 10 then, which only checks that total is at least 10 but never checks the upper limit of 20, so a total of, say, 500 would wrongly print success. Changing it to if total >= 10 and total <= 20 then makes the condition genuinely check both boundaries of the inclusive range the question describes.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise fixing logic errorsThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
A program accepts scores between 0 and 100. Which value is an example of erroneous test data?
Finding and fixing two real logic errors comes up in every sitting we have, worth 2 to 4 marks. Practise tracing the given code by hand first, since guessing at a fix without tracing is the fastest way to lose the correction mark.
Practise fixing logic errorsThis appears once in every sitting we have full papers for, always giving you the exact parameters the function or procedure must accept and the exact behaviour it must produce.
Write a function taking nights and room as parameters that works out the total cost using the stated nightly rates, 60 pounds for a basic room, 80 pounds for a premium room, and returns that total, without validating the parameters.
A Basic room costs 60 pounds each night. A Premium room costs 80 pounds each night. The function newPrice() must take the number of nights and the type of room as parameters, calculate the total price, and return it, without needing to validate either parameter.
function newPrice(nights, room) if room == "basic" then price = 60 * nights elseif room == "premium" then price = 80 * nights endif return price endfunction
The IF/ELSEIF branch multiplies nights by the correct nightly rate for whichever room type was actually passed in, 60 for basic or 80 for premium, and the function ends with return price rather than printing it, since the specification explicitly says the function must return the calculated price, not output it.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise writing functions and proceduresWrite a procedure taking a string of data and a filename as parameters that opens the named text file, writes the data string into it, and closes the file again.
The procedure SaveLogs() must take the string of data to be stored as a parameter, take the filename of the text file as a second parameter, and store the string of data to that text file.
procedure SaveLogs(data, filename) logFile = open(filename) logFile.writeLine(data) logFile.close() endprocedure
The body opens a file using the filename that was actually passed in as a parameter, writes the data parameter into it with writeLine, and then closes the file again before the procedure ends, using each parameter for its own stated purpose rather than a hard-coded filename or fixed text.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise writing functions and proceduresComplete a function taking direction and position as parameters that moves the character 5 places left or right, then clamps the result back into the valid range of 1 to 512 inclusive before returning the new position.
The function moveCharacter() takes the direction, left or right, and current position as parameters, changes position based on direction, subtracting 5 for left, adding 5 for right, sets position to 1 if the new position would be less than 1, sets position to 512 if the new position would be greater than 512, and returns the new position. The function header, function moveCharacter(direction, position), and the closing endfunction are already given.
if direction == "left" then position = position - 5 elseif direction == "right" then position = position + 5 endif
if position < 1 then position = 1 elseif position > 512 then position = 512 endif return position This clamps position back into the valid range only after the move has already been applied, never before, since checking the bounds too early would use the character's old, not new, position, and finally returns the updated position rather than printing it.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise writing functions and proceduresThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
Which programming construct is used to make a decision based on a condition?
Writing a complete function or procedure from a stated specification is worth 4 to 6 marks in every sitting we have. Practise using the parameters you were actually given rather than asking for fresh input, and always finish a function with RETURN, not print.
Practise writing functions and proceduresThis appears once in every sitting we have full papers for: rewriting a broken SELECT statement in June 2022, writing a SELECT with two combined WHERE conditions in June 2023, and completing a SELECT with specific field names and a WHERE clause in June 2024.
Fix a broken SQL statement, which uses SELECT ALL and an IF clause instead of proper syntax, so that it correctly displays every field for bookings staying more than one night from the table TblBookings.
The booking table TblBookings has fields firstName, surname, nights, room and stayComplete. The given, incorrect, statement reads SELECT ALL, FROM TblBookings, IF Nights < 1, which uses invalid keywords, ALL instead of a real field list or star, and IF instead of WHERE, and also states the wrong comparison direction for staying more than one night.
SELECT firstName, surname, nights, room, stayComplete FROM TblBookings WHERE nights > 1
The condition itself is nights > 1, not nights < 1 as the broken version stated, since the question specifically asks for bookings staying more than one night, and more than one means strictly greater than 1, not less than 1.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise SQL questionsWrite a SELECT statement against the events table that displays only the SensorID field, filtered to rows where SensorType is Door and Length is more than 20, combining both conditions.
A database table called events with fields Date, SensorID, SensorType and Length, storing a log entry each time a sensor is triggered, including door, motion and window sensor events with their trigger length in seconds.
SELECT SensorID FROM events WHERE Length > 20 AND SensorType = "Door"
Writing the two conditions in either order is equally valid, as long as both are joined with AND rather than OR, since a query asking for door sensors specifically that were also triggered for more than 20 seconds needs every returned row to satisfy both facts simultaneously, not just one of them.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise SQL questionsComplete a partially given SELECT statement so it displays TeamName alongside the already-shown StudentID field, from the correct table, filtered to rows where YearGroup equals 11.
The database table TblResult has fields StudentID, YearGroup, TeamName and Time, storing each student's 100m race result. The statement SELECT StudentID, ... is already partly given, with three blank spaces left to complete: the rest of the field list, the FROM clause, and the WHERE clause.
SELECT StudentID, TeamName FROM TblResult WHERE YearGroup = 11
TeamName is added onto the field list rather than replacing StudentID, since the question asks for both the Student ID and the team name displayed together, and the table name must be spelled exactly TblResult, not TblResults or any other variation, since SQL table names must match precisely.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise SQL questionsThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
Which SQL keyword is used to choose which columns to retrieve from a database table?
A real SQL SELECT statement is tested in every sitting we have, worth 3 to 4 marks. Practise the three-clause order, SELECT, FROM, WHERE, and combining multiple conditions with AND.
Practise SQL questionsThis appears once in every sitting we have full papers for, always tied to the specific rules given in that question rather than validation in the abstract.
Write a program that checks three separate rules on a hotel booking, firstName and surname are not empty, room is basic or premium, nights is between 1 and 5 inclusive, and outputs ALLOWED only if all three pass, or NOT ALLOWED if any one fails.
firstName and surname must not be empty. room must be either basic or premium. nights must be between 1 and 5 inclusive. If any of the three checks fail, the program must output NOT ALLOWED; if all three pass, it must output ALLOWED. The four input lines, firstName, surname, room, nights, are already given.
valid = True if firstName == "" or surname == "" then valid = False endif if room != "basic" and room != "premium" then valid = False endif if nights < 1 or nights > 5 then valid = False endif
if valid then print("ALLOWED") else print("NOT ALLOWED") endif The final IF only prints ALLOWED if all three checks passed and valid never got set to False, and prints NOT ALLOWED the moment any single check fails, so a booking that fails only the nights check still correctly gets NOT ALLOWED, not a false ALLOWED.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise input validation questionsName two real validation techniques and explain, specifically for this addition game which asks the player to add two random whole numbers between 1 and 10, how each one would actually be applied to the player's typed answer.
The game asks the player three addition questions, each adding two random whole numbers between 1 and 10 inclusive, adds 1 to the player's score for each correct answer, and displays the final score at the end. The player's typed answer needs validating before it is checked against the correct sum.
Range check: this checks the player's answer falls between sensible upper and lower limits, for example between 2, the smallest possible sum of two numbers from 1 to 10, and 20, the largest possible sum, rejecting an answer like -5 or 500 that could never genuinely be correct for this game.
Type check: this checks the player's answer is actually a whole number, an integer, rejecting a non-numeric answer such as the word seven typed out or a decimal like 4.5, since the two random numbers being added are always whole numbers between 1 and 10, so any genuinely correct answer must also be a whole number.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise input validation questionsWrite an algorithm that inputs a high jump height in centimetres and outputs VALID only if it falls between 40.0 and 180.0 inclusive, or NOT VALID otherwise.
The height jumped is entered in centimetres and must be between 40.0 and 180.0 inclusive. The algorithm must take the height as input and output VALID or NOT VALID depending on whether it satisfies that range.
h = input("Enter height jumped") if h >= 40 and h <= 180 then print("valid") else print("not valid") endif
Because the condition uses >= and <=, both 40.0 and 180.0 themselves are correctly treated as valid, matching the question's own wording of inclusive, and the output correctly flips to valid only when the height genuinely satisfies both boundaries at once, with not valid printed for anything outside that range, including a negative height or an impossibly large one.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise input validation questionsThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
A program asks the user to enter a score between 1 and 10. Which validation check should be used to ensure the number is within this range?
Validating input against a set of stated rules is worth 4 to 6 marks in every sitting we have. Practise naming a real, specific technique for every rule and always checking whether a boundary itself counts as valid.
Practise input validation questionsThis appears once in every sitting we have full papers for, and it is consistently one of the single highest-tariff pieces of program-writing on the paper alongside the function or procedure cluster, always worth 6 marks.
Write an algorithm that first asks how many numbers to add up, then loops that many times taking a number each pass and adding it to a running total, then outputs both the total and the average once the loop finishes.
Ask the user to input the quantity of numbers they want to enter and read this as input. Repeatedly take a number as input, until the quantity of numbers the user input has been entered. Calculate and output the total of these numbers. Calculate and output the average of these numbers.
num = input("Enter how many numbers") total = 0 for x = 1 to num temp = input("Enter a number") total = total + temp next x
print(total) print(total / num) Both outputs happen only after the loop has fully finished, using the genuinely final value of total rather than a value from partway through the loop, and the average is calculated by dividing that final total by num, the same quantity that controlled how many numbers were actually entered.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise iteration and running-calculation questionsWrite an algorithm that asks the player three addition questions, each adding two random whole numbers between 1 and 10, adds 1 to a running score for each correct answer, and displays the final score once all three rounds are done.
The player is asked 3 addition questions. Each question asks the player to add together two random whole numbers between 1 and 10 inclusive. If the player gets the correct answer, 1 is added to their score. At the end of the game their score is displayed.
score = 0 for count = 1 to 3 num1 = random(1, 10) num2 = random(1, 10) ans = input("What is " + num1 + " + " + num2 + "?") if ans == num1 + num2 then score = score + 1 endif next count
print(score) The score is output once, after the loop has run all three times, rather than after every individual question, since the specification asks for the final score to be displayed at the end of the game, not after each round.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise iteration and running-calculation questionsWrite an algorithm that keeps asking for a team name and score until the user types stop, keeps track of the highest score seen so far and which team it belongs to, and outputs the winning team's name and score once input stops.
Prompt the user to enter a team name and score, or to enter stop to stop entering new teams. Repeatedly take team names and scores as input until the user enters stop. Calculate which team has the highest score. Output the team name and score of the winning team in an appropriate message.
highscore = 0 team = "" while team != "stop" team = input("enter team name") score = input("enter score") if score > highscore then highscore = score highteam = team endif endwhile
print(highscore) print(highteam) Both the winning score and the winning team name are output only once the WHILE loop has genuinely finished, meaning the user has typed stop, using the final accumulated highscore and highteam rather than values from partway through entering the teams.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise iteration and running-calculation questionsThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
Which type of loop is best used when you know exactly how many times the loop should repeat?
This 6-mark iteration-and-calculation question appears in every sitting we have, always one of the highest tariffs on the paper. Practise initialising your accumulator before the loop and only outputting a final result once the loop has genuinely finished.
Practise iteration and running-calculation questionsThis appears once in every sitting we have full papers for: completing every step of a merge sort by hand in June 2022, stating one real difference between insertion sort and bubble sort in June 2023, and tracing a binary search on a given seven-item data set in June 2024.
Show the real steps a merge sort takes on the eight-number list 45, 12, -99, 100, -13, 0, 17, -27: merging the eight single-item lists into sorted pairs of two, then into sorted groups of four, then into one final sorted list of eight.
A list of eight positive and negative numbers, already split into eight individual one-number lists as the question's first step: 45, 12, -99, 100, -13, 0, 17, -27.
Merging the eight single-number lists into pairs, in the original order they appear, gives four sorted lists of two: 12 and 45 merge into [12, 45], -99 and 100 merge into [-99, 100], -13 and 0 merge into [-13, 0], and -27 and 17 merge into [-27, 17].
Merging those four pairs into two sorted lists of four gives [-99, 12, 45, 100] and [-27, -13, 0, 17], comparing across each pair's smallest and largest values correctly, and merging those two lists of four into the one final sorted list of eight gives -99, -27, -13, 0, 12, 17, 45, 100.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise sorting and searching questionsState one genuine, specific difference in how an insertion sort and a bubble sort actually move data, rather than a vague claim that one is better than the other.
A pseudocode insertion sort on the array names, which moves through the array from the second element onwards, shifting each value left into its correct position relative to the already-sorted values before it.
An insertion sort builds up a sorted section at the start of the array and inserts each new value directly into its correct position within that already-sorted section, moving other values along to make room, whereas a bubble sort repeatedly compares neighbouring pairs of values and swaps them if they are in the wrong order, without ever inserting a value directly into a specific position.
A related, equally valid way to state the same real difference is that insertion sort's sorted section grows from the start of the array outward with every pass, while a bubble sort's largest unsorted value instead gets bubbled up to the end of the array on each full pass, which is a different real mechanism, not just different wording for an identical process.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise sorting and searching questionsTrace a binary search for the number 10 across the seven-item sorted list 1, 2, 5, 6, 7, 10, 20, showing which middle value gets picked and discarded on each real comparison until 10 is found.
A sorted, seven-item list of numbers: 1, 2, 5, 6, 7, 10, 20. A binary search must find the number 10 within it.
The middle value of the full seven-item list is 6, the fourth item. Since the target, 10, is larger than 6, the entire left half of the list, 1, 2, 5, is discarded, keeping only the right half, 7, 10, 20.
The middle value of the remaining three-item list, 7, 10, 20, is 10, which matches the target exactly, so the search ends here, having found 10 in two comparisons.
Could you have written this? Every fact in this answer is drilled in our quizzes — the writing is the easy part once the evidence is automatic.
Practise sorting and searching questionsThe topic changes by sitting — the mark scheme never does. Learn this once, then open your question above for that sitting’s sources and a full worked answer.
Which of the following is a requirement before binary search can be used?
Understanding how sorting and searching algorithms actually work, not just naming them, is tested in every sitting we have, worth 2 to 3 marks. Practise working through real data by hand rather than reciting a textbook description.
Practise sorting and searching questionsAcross the three sittings we have full papers for, Paper 2's overall structure and total marks, 80, never changed, and the same eight question archetypes appear in every single sitting, though the specific rules, data or algorithm tested within each archetype is different every time.
Systems architecture, CPU components or the fetch-decode-execute cycle · Primary and secondary storage, including RAM, ROM and units of data · Wired and wireless networks, network topologies or protocols · Network security threats and prevention methods · Systems software, including operating systems and utility software · Ethical, legal, cultural and environmental impacts of digital technology
These topics are genuinely part of the OCR J277 specification, but they belong to Paper 1 (J277/01, Computer systems), not Paper 2, and did not appear as a standalone question on any Paper 2 sitting we analysed, so do not build your Paper 2 revision plan around them.
Yes, in all three sittings we have full papers for. Every sitting totalled 80 marks in 1 hour 30 minutes, with no calculator allowed, split into Section A, roughly 50 minutes of general computational thinking and Boolean logic, and Section B, roughly 40 minutes, where several questions must be answered in OCR's own Exam Reference Language or a high-level programming language you have studied, never structured English or a flowchart. Always check your own paper's front cover to confirm, since OCR can make real changes in any future series.
It is OCR's own official name for the pseudocode style used across its question papers and mark schemes. Based on the three real sittings we analysed, it uses lowercase keywords (if, then, else, endif, for, to, next, while, endwhile, do, until, function, endfunction, procedure, endprocedure), a dot-property style for array and string length (array.length, not a LEN() function call), and its own random(a, b) function that is inclusive of both endpoints, unlike Python's exclusive-upper-bound randrange. It shares some structures with AQA's pseudocode, DO UNTIL behaves exactly like AQA's REPEAT UNTIL, running its body at least once before checking the exit condition, but the exact keyword casing and property-style syntax genuinely differ, so do not assume an AQA-taught answer transfers across unchanged.
Because OCR's J277 specification splits its two papers differently from AQA's 8525. For OCR, Boolean logic, logic gates and truth tables, along with SQL and databases, are genuinely tested on Paper 2 (Computational thinking, algorithms and programming), not Paper 1. Systems architecture, memory and storage, networks, network security, systems software and the ethical, legal, cultural and environmental impacts of technology are tested on Paper 1 (Computer systems) instead. If you are looking for those topics, they belong on our Paper 1 page, not this one.
Every mark scheme we reviewed marks program-writing questions point by point against a genuine bullet-point checklist, awarding marks for real, distinct pieces of correct logic rather than an overall level judgement. The mark schemes explicitly state that minor syntax errors, case sensitivity, small spelling slips in variable names, should not be penalised as long as the intention and logic are clear, and that you do not have to declare which language you are using, since OCR marks for logical correctness in either the Exam Reference Language or a real high-level language you have studied, never a specific syntax.
According to the real mark schemes for these three sittings, marks are very often lost on the logic-error and trace-table questions by fixing only one of the two errors, or by skipping the very first or the very last row of a trace, rather than any genuine misunderstanding of the algorithm itself. On the validation and boundary-condition questions, the single most repeated cause of lost marks across all three sittings was getting an inclusive boundary slightly wrong, using > instead of >=, or checking only one side of a range when the question genuinely needed both.
Every question type on this page has practice questions waiting in the app, built the way OCR actually structures Paper 2.
Start revising free