OCR GCSE Computer Science Paper 2, June 2025: question 6

A PrepWise guide to a real paper, with our descriptions and answers. Not made or approved by OCR.

PrepWise guide: OCR GCSE Computer Science Paper 2Question 66 of 6

A yearly music festival called OCR Rockfest sells entry tickets and runs a computer system holding details of its visitors and its bands. Figure 10 shows part of the table TblMusic, which lists the acts. A ticket costs 60 pounds, so 4 tickets come to 240 pounds. There are 500 tickets at the start, and the variable tickets holds how many are left, starting from the line tickets = 500. Booking prints Tickets booked and a refusal prints Not enough tickets. Answers to 06.6, 06.7 and 06.11 are code: write them in the board's reference language or in a language you have studied.

Figure 10
A database table named TblMusic with four fields and four records.Open full size to read the labels (Figure 10, opens in a new tab)
Figure 11
Three lines of a database query.Open full size to read the labels (Figure 11, opens in a new tab)
Figure 12
A table with three columns, two rows, and an empty data type column.Open full size to read the labels (Figure 12, opens in a new tab)
Figure 13
Five numbered lines of an algorithm with a loop.Open full size to read the labels (Figure 13, opens in a new tab)
Figure 14
An array named actNumbers with three cells at index 0, 1 and 2.Open full size to read the labels (Figure 14, opens in a new tab)
Figure 15
A trace table with columns for line number, count, x and output, and fourteen empty rows.Open full size to read the labels (Figure 15, opens in a new tab)
Figure 16
An array named actNumbers with five cells at index 0 to 4.Open full size to read the labels (Figure 16, opens in a new tab)
06.1[1 mark]

Tick one box for the correct statements, in OCR Exam Reference Language, that store a password entered twice, in passA and passB.

See how you would score on Variables & Constants

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

passA and passB = input("type it two times")
input("first password") = passA, then input("second password") = passB
passA = input("first password"), then passB = input("second password")Correct answer
"passA" = input("first password"), then "passB" = input("second password")
Show model answer for 06.1Hide model answer for 06.1
passA = input("first password")
passB = input("second password")
1 mark

How the marks are earned

  1. The third option: passA = input(...) on one line, then passB = input(...) on the next.
Revise Variables & Constants
06.2[3 marks]

Design an algorithm that compares passA and passB, printing passwords match if equal and passwords do not match if not.

See how you would score on Selection (IF Statements)
Show model answer for 06.2Hide model answer for 06.2
if passA == passB then
    print("passwords match")
else
    print("passwords do not match")
endif
3 marks

How the marks are earned

  1. One mark for each point, up to 3. A flowchart is accepted: it needs a decision diamond for BP1, labelled True and False branches for BP2 and BP3, and output boxes for BP2 and BP3.
  2. BP1: a check that passA and passB are equal.
  3. BP2: the correct output when they are equal. Other message wording is credited.
  4. BP3: the correct output when they are not equal. Other message wording is credited.
  5. The checks may be separate if statements. An elseif or elif on its own earns BP1 only if it holds a full comparison, such as passA != passB, and then BP2 and BP3 follow through.
  6. BP2 and BP3 need a sensible attempt at the comparison in BP1.
  7. The names passA and passB must be right. Spaces are penalised only if clearly visible. Capital letters are ignored. Extra code, such as further inputs, is ignored if it does not change the result.

Why it scores

A double equals compares the two values. The if branch runs when they are the same and the else branch runs for any difference, so exactly one message is printed.

Revise Selection (IF Statements)
06.3[4 marks]

Refine the SQL in Figure 11, correcting its errors, to list ActID and Stage for the Saturday acts.

See how you would score on SQL
Show model answer for 06.3Hide model answer for 06.3
SELECT ActID, Stage
FROM TblMusic
WHERE Day = "Saturday"
4 marks

How the marks are earned

  1. One mark for each correct refinement, up to 4. A written description of the change is credited.
  2. BP1: the SELECT line is SELECT ActID, Stage, with a comma between the two fields.
  3. BP2: the table name is corrected to TblMusic.
  4. BP3: the keyword WHERE is used.
  5. BP4: the condition is Day = "Saturday", with the value in quotation marks. The form == is credited.
  6. Quotation marks round field and table names are allowed. Spelling in field and table names must be exact. Spaces are penalised only if clearly visible. Capital letters are ignored.
  7. A maximum of 3 marks if the final SQL is invalid, in the wrong order or has extra code.
  8. If the same error is made twice, it is penalised once and then followed through.

Why it scores

Four fixes. A comma replaces AND between the fields. The table is named TblMusic and not TblActs. WHERE is the keyword that filters records, not IF. The value Saturday is text, so it goes in quotation marks.

Revise SQL
06.4[1 mark]

Identify one record that could be stored in TblMusic.

See how you would score on SQL
Show model answer for 06.4Hide model answer for 06.4
1, Platinum, Saturday, 0.5
1 mark

How the marks are earned

  1. Any one complete record taken from the table, or any sensible new record with four separate items of data. Field names written with the data are allowed.
  2. The order of the data, capital letters, spelling and data types are ignored.
  3. A definition of what a record is earns nothing.
Revise SQL
06.5[2 marks]

Give the best data type for Stage and for SetLength in Figure 12.

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

Stage: string

SetLength: real, also called float

2 marks

How the marks are earned

  1. One mark for each field, up to 2.
  2. Stage: string. Text, varchar or char are credited.
  3. SetLength: real or float. Decimal, single, double or numeric are credited.
  4. Other equivalent data types used by databases are accepted.

Why it scores

A stage name is made of letters, so it is text.

Lengths in hours include values like 0.5 and 1.5, so the type must hold decimals.

Revise Data Types
06.6[4 marks]

Write calculatePrice, a function that receives the ticket count as a parameter and returns what the visitor pays, at 60 pounds each.

See how you would score on Variable Scope
Show model answer for 06.6Hide model answer for 06.6
function calculatePrice(quantity)
    total = quantity * 60
    return total
endfunction
4 marks

How the marks are earned

  1. Up to 4 marks, one per point. This is Section B, so it must be high level code: the board's reference language or a language the student has studied. Pseudocode or plain English earns nothing.
  2. BP1: a function definition named calculatePrice.
  3. BP2: a parameter in the definition, which is not overwritten inside the function. Further parameters are fine.
  4. BP3: the total is worked out by multiplying the parameter by 60. The letter x for times is not accepted. If there is no parameter, multiplying by a sensible value such as an input is allowed. A parameter that is overwritten follows through.
  5. BP4: the total is always returned. The return must be a return, and print or output earns nothing. The value may carry a pound sign and other text. Returning by assigning the value to the function name, as some languages do, is credited. This mark follows through if a sensible attempt was made at the calculation.
  6. Clearly visible spaces inside a function, variable or parameter name are not accepted.
  7. If a function definition is written, every line belongs inside it. Extra code is ignored.

Why it scores

The parameter quantity holds the number of tickets, and total = quantity * 60 gives the cost. return sends that value back to the caller. Printing it instead would not return it.

Revise Variable Scope
06.7[2 marks]

Write an algorithm that makes use of calculatePrice() for 3 tickets and keeps the result in totalPrice.

See how you would score on Variable Scope
Show model answer for 06.7Hide model answer for 06.7
totalPrice = calculatePrice(3)
2 marks

How the marks are earned

  1. One mark for each point, up to 2. This is Section B, so it must be high level code.
  2. BP1: calculatePrice is called with 3 passed in. More than one value may be passed, if 3 is one of them.
  3. BP2: the returned value is assigned to totalPrice (any assignment sign); a double equals earns nothing.
  4. A sensible attempt at the call, such as a missing or wrong value, lets BP2 follow through.
  5. A new definition of the function earns nothing, because the existing function must be called.
  6. Spaces in the names are penalised only if clearly present. Capital letters and extra code are ignored.

Why it scores

The call passes 3 as the parameter, the function returns the cost, and the single equals stores that value in totalPrice.

Revise Variable Scope
06.8[4 marks]

Complete the trace table, Figure 15, for Figure 13 run on the array in Figure 14. You may not need every row.

See how you would score on Trace Tables
Show model answer for 06.8Hide model answer for 06.8
Line  count  x  Output
01    0
02           0
03    10
02           1
03    24
02           2
03    30
05              30
4 marks

How the marks are earned

  1. One mark for each point, up to 4. Line numbers are ignored and not required. The order of the values is marked, and a value may be repeated down a column, so changes are what count.
  2. BP1: count starts at 0.
  3. BP2: count then goes to 10, then 24, then 30, with no other changes.
  4. BP3: x goes 0, then 1, then 2 (3 may also be shown), with no other changes.
  5. BP4: 30 is output, and nothing else is output. If a wrong total was worked out and then output, this mark follows through, and the last value of count is credited as the output.
  6. A dash or the word nothing in the output column on other rows is given benefit of the doubt. print(30) or an equivalent written in the output column earns nothing.

Why it scores

Each row records only the value that changes on that line. count starts at 0 and then adds actNumbers[x] each pass: 0 + 10 is 10, 10 + 14 is 24, 24 + 6 is 30. x counts 0, 1, 2 as the loop runs, and 30 is printed once the loop ends.

Revise Trace Tables
06.9[2 marks]

Identify the line number in Figure 13 to change for the five-cell array in Figure 16, and write the updated line.

See how you would score on Iteration (Loops)
Show model answer for 06.9Hide model answer for 06.9
Line 02
for x = 0 to 4
2 marks

How the marks are earned

  1. One mark for the line number: line 02.
  2. One mark for updated code that loops through all five cells, such as for x = 0 to 4. The counter must be x.
  3. Rewrites in other high level languages are accepted. The form 0 to 5 or range(5) is given benefit of the doubt.
  4. Any other change that works is credited, such as using the length of actNumbers.

Why it scores

Line 02 is the for line, the one that sets how many times the loop runs, so it is the only line that must change.

The array now has five cells, at index 0 to 4, so the loop must run until x is 4. Only the end value of the loop changes. Line 03 already adds the cell at index x.

Revise Iteration (Loops)
06.10[1 mark]

Refine line 05 of Figure 13 so it prints the words The total act count is, then the value held in count.

See how you would score on String Handling
Show model answer for 06.10Hide model answer for 06.10
print("The total act count is " + str(count))
1 mark

How the marks are earned

  1. A print statement holding the sentence, a joining symbol and then count. A different joiner such as & or a dot is credited, and so is a comma.
  2. A separator between the text and the number is needed. Spacing, capital letters and casting are ignored.
  3. A command equivalent to print, such as echo or output, is credited. Several print statements, or several lines of code that give the result, are credited.
  4. Putting count inside the string so that its value prints is credited too, for example {count}, an f string, or a dollar sign before the variable inside the quotation marks.

Why it scores

The text and the number are joined with +. str() turns the number into text so that it can be joined. The mark scheme ignores casting here, so leaving it out would still earn the mark.

Revise String Handling
06.11[6 marks]

Complete the algorithm: input tickets wanted, print Tickets booked and reduce tickets if enough remain, else print Not enough tickets; repeat until none left.

See how you would score on Iteration (Loops)
Show model answer for 06.11Hide model answer for 06.11
tickets = 500
while tickets > 0
    num = int(input("How many tickets would you like?"))
    if tickets >= num then
        print("Tickets booked")
        tickets = tickets - num
    else
        print("Not enough tickets")
    endif
endwhile
6 marks

How the marks are earned

  1. Up to 6 marks, one per point. This is Section B, so it must be high level code: the board's reference language or a language the student has studied. Pseudocode or plain English earns nothing.
  2. BP1: the number of tickets wanted is input and stored or used.
  3. BP2: a check for whether enough tickets are left. It must allow a booking when exactly the number wanted remain, for example 5 wanted and 5 left, so the comparison must not rule that out.
  4. BP3: a sensible message for each case, booked and not enough tickets, the right way round. This depends on BP2.
  5. BP4: the tickets variable is updated correctly when a booking is made. This depends on BP2.
  6. If BP2 is wrong or missing but there is a reasonable attempt, such as checking whether tickets is above 0, BP3 and BP4 can follow through.
  7. BP5: any attempt at a loop.
  8. BP6: everything attempted above repeats while tickets > 0, or while tickets != 0, or until tickets <= 0, or until tickets = 0. The input, if there is one, must be inside the loop so it repeats, and tickets must not be set back to 500 each time round.
  9. Extra code is ignored.

Why it scores

The loop keeps going while tickets is above 0, and the input is inside the loop so it is asked every time. The test tickets >= num allows the very last tickets to be booked. A booking subtracts num from tickets, and a request that is too large leaves tickets alone and prints the other message. tickets = 500 sits before the loop so it is never reset.

Revise Iteration (Loops)
OCR owns the copyright in its exam questions, so we cannot copy their wording. These descriptions and answers are ours. Not made or approved by OCR.[30 marks]