Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
840 views

ExamBuilder Programming-1

The document describes an algorithm to simulate the states of a vending machine using IF statements instead of a switch statement. It begins with three possible states for a vending machine: on, off, or suspended. It then shows pseudocode using a switch statement to set a statevalue variable based on the input new state. The summary asks to rewrite the algorithm using IF statements instead of a switch statement to perform the same actions.

Uploaded by

Gupi Pal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
840 views

ExamBuilder Programming-1

The document describes an algorithm to simulate the states of a vending machine using IF statements instead of a switch statement. It begins with three possible states for a vending machine: on, off, or suspended. It then shows pseudocode using a switch statement to set a statevalue variable based on the input new state. The summary asks to rewrite the algorithm using IF statements instead of a switch statement to perform the same actions.

Uploaded by

Gupi Pal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 134

1 A vending machine can be in one of three states: on, off or suspended.

A user can change the state of the


vending machine by using the following algorithm.

   newstate = input("Enter the new state : ")

   switch newstate:

      case "on":

         statevalue = 1

      case "off":

         statevalue = 2

      case "suspended":

         statevalue = 3

      default:

         print("Invalid state")

   endswitch

Rewrite the algorithm to perform the same actions using IF statements in place of the switch statement.

© OCR 2023. You may photocopy this page. 1 of 134 Created in ExamBuilder
[5]

2 DIV and MOD are both operators used in computing-related mathematics.

(i) State the value of 13 DIV 4

[1]

(ii) State the value of 13 MOD 4

[1]

© OCR 2023. You may photocopy this page. 2 of 134 Created in ExamBuilder
3 The following names of students are stored in an array with the identifier studentnames.

studentnames = ["Rob", "Anna", "Huw", "Emma", "Patrice", "Iqbal"]

A school uses the array to call an attendance register every morning.

Write an algorithm using iteration to:

• display the name of each student one at a time from studentnames


• take as input whether that student is present or absent
• display the total number of present students and number of absent students in a suitable message, after all
student names have been displayed.

[6]

© OCR 2023. You may photocopy this page. 3 of 134 Created in ExamBuilder
4 The following table contains several definitions of terms that are used in Computer Science.

Letter Definition
A Cleaning up data entered by removing non-standard characters
B Hiding or removing irrelevant details from a problem to reduce complexity
C Checking that the user is allowed to access the program
D Breaking a complex problem down into smaller problems
E Repeating elements of a program
F Converting one data type to another, for example converting an integer to a real number

(i) Write a pseudocode statement to assign the value 7.3 to a variable with the identifier timer

[1]

(ii) State the most appropriate data type for the variable timer.

[1]

© OCR 2023. You may photocopy this page. 4 of 134 Created in ExamBuilder
5 Dru writes the following program using a high-level language.

01 function newscore(a,b)
02    temp = a*b
03    temp = temp + 1
04    return temp
05 endfunction
06 score = 18
07 name = "Dru"
08 print (score)
09 print ("name")
10 print (newscore(score,2))
11 print (score)

The following table contains the program code for each line where this program outputs values.

State the values output by the program on each of the lines.

Line Program code Value output


08 print (score)

09 print ("name")

10 print (newscore(score,2))

11 print (score)
[4]

© OCR 2023. You may photocopy this page. 5 of 134 Created in ExamBuilder
6(a) The algorithm for one section of a vending machine program is shown in pseudocode.

if money >= price then

   venditem()

   giveChange(money – price)

else

   print("Error – not enough money inserted")

endif

(i) Give the identifier of one variable used in the algorithm.

[1]

(ii) State how many parameters are passed into the giveChange() subroutine.

[1]

(b) A vending machine has the following options available.

Item code Item name Price


A1 Crisps, bacon flavour £0.75
A2 Crisps, salted £0.75
B1 Chocolate bar £0.90
C1 Apple pieces £0.50
C2 Raisins £0.85

Users insert coins into the vending machine and then enter the two character item code of their selection. If the
user has inserted enough money, the vending machine will release the chosen item and output any change
required. If the user enters an invalid item code then a suitable error message is displayed.

Draw the vending machine algorithm in the part above as a flowchart.

© OCR 2023. You may photocopy this page. 6 of 134 Created in ExamBuilder
[5]

© OCR 2023. You may photocopy this page. 7 of 134 Created in ExamBuilder
(c) When writing the program for the vending machine, maintainability was considered.

(i) Identify two ways that the program in the part above has been made more maintainable.

[2]

(ii) Give one additional way that the maintainability of the program can be improved.

[1]

(d) The vending machine stores the quantity of items available in a database table called ITEMS.
The current contents of ITEMS is shown:

ItemCode ItemName Stock


A1 Crisps, bacon flavour 6
A2 Crisps, salted 2
B1 Chocolate bar 12
C1 Apple pieces 18
C2 Raisins 7

Complete the following SQL statement to display the item code for all items that have fewer than 10 in stock.

SELECT

FROM

[4]

© OCR 2023. You may photocopy this page. 8 of 134 Created in ExamBuilder
7 Ali’s tablet computer has an operating system.

Ali’s computer uses virtual memory. Ali has written two procedures to help himself understand how virtual
memory works.

storeData() describes how data is stored in RAM.


accessData() describes how data is read from RAM.

Write the letter of the missing statements from the table in the correct place to complete the algorithms. Not all
statements are used, and some statements might be used more than once.

procedure storeData()

   if RAM is ......................... then

       move data from RAM to .........................

   endif

   store data in next free space in .........................

.........................

procedure accessData()

   if ......................... (data required is in RAM) then

       if RAM is full then

          move unneeded data from RAM to HDD

       endif

       move required data from HD to RAM

   endif

   read data from .........................

endprocedure

Letter Statement

© OCR 2023. You may photocopy this page. 9 of 134 Created in ExamBuilder
A Secondary storage

B NOT

C Full

D endfunction

E Empty

F endprocedure

G AND

H RAM
[6]

8 Complete the truth table in Fig. 1 for the Boolean statement P = NOT(A AND B).

A B P

0 0 1

0 1 ..................

1 0 ..................

1 1 0

Fig. 1
[2]

© OCR 2023. You may photocopy this page. 10 of 134 Created in ExamBuilder
9 The database table Results stores the results for each student in each of their chosen subjects.

StudentName Subject Grade


Alistair English 3
Jaxon Art 5
Alex Art 4
Anna French 7
Ismaael Art 9

Complete the SQL query to return all of the fields for the students who take Art.

SELECT

FROM

WHERE

[3]

© OCR 2023. You may photocopy this page. 11 of 134 Created in ExamBuilder
10 A cinema uses the following criteria to decide if a customer is allowed to see a film that has a 15 rating:

Customers have to be 15 years of age or older to see the film. They also need to either have a ticket or
have the money to buy a ticket.

The table shows the inputs to the system that will output whether the customer can watch the film.

Input Criteria (True / False)


A The customer is 15 or over
B The customer has a ticket
C The customer has the money to buy a ticket
The cinema has three screens: "Red", "Black" and "Yellow".

The function freeseats() counts how many seats are available in each screen. The name of the screen is
passed in as a string parameter and the number of free seats is returned as an integer.

Write code using the function freeseats() to find the number of seats available in screen Red and assign this
to a variable with identifier redseats.

[2]

© OCR 2023. You may photocopy this page. 12 of 134 Created in ExamBuilder
11(a) OCR Tech is an online shop that sells electronics such as TVs and game consoles.

Items for sale are stored in the database table tblStock. An extract of this table is shown.

ItemCode ItemName Price (£) Stock


GSC5 GameStation5 console 249.99 102
TV4K 4K Television 499.99 18
ABRR Audiobook reader 59.99 27
NAGC TV streaming stick 24.99 192
tblStock
Tick (✓) one box in each section to identify the correct SQL statement to select the item code and item name for
all items that have a price of £60 or over.
Tick (✓) one box

SELECT ItemCode AND ItemName

SELECT ItemCode, ItemName

SELECT ItemCode & ItemName

Tick (✓) one box

FROM tblStock

FROM table

FROM database

Tick (✓) one box

WHERE Price <= 60

WHERE Price > 60

WHERE Price >= 60

[3]

© OCR 2023. You may photocopy this page. 13 of 134 Created in ExamBuilder
(b) Customers can use a discount code to reduce the price of their purchase. Valid discount codes and their value
(in pounds) are stored in a global two-dimensional (2D) array with the identifier discount. The following table
shows part of this 2D array.

For example, discount[2,0] holds discount code BGF2 and discount[2,1] holds the discount of 15
pounds.

A function searches through the 2D array and applies the discount to the price. The price and discount code are
passed in as parameters. The algorithm design is not complete.

(i) Complete the design for the algorithm.

   function checkdiscount(price, code)


      newprice = price
      size = len(discount) – 1
      for x = 0 to ....................
        if discount[x,0] == ................ then
         newprice = ................ – discount[................]
        endif
      next x
      ............................
   endfunction

[5]

(ii) Identify two variables used in this function design.

[2]

© OCR 2023. You may photocopy this page. 14 of 134 Created in ExamBuilder
(iii) Write a program that:

• asks the user for an item price and discount code


• uses the checkdiscount() function from part (i) to calculate the price of the item after any discount
has been applied
• repeats bullet points 1 and 2 until a price of 0 is entered
• outputs the total cost of all items entered, after any discounts have been applied.

You must use either:


• OCR Exam Reference Language, or
• A high-level programming language that you have studied

© OCR 2023. You may photocopy this page. 15 of 134 Created in ExamBuilder
[6]

© OCR 2023. You may photocopy this page. 16 of 134 Created in ExamBuilder
12(a) The area of a circle is calculated using the formula π × r2 where π is equal to 3.142 and r is the radius.

A program is written to allow a user to enter the radius of a circle as a whole number between 1 and 30, then
calculate and output the area of the circle.

01 radius = 0
02 area = 0.0
03 radius = input("Enter radius")
04 if radius < 1 OR radius > 30 then
05 print("Sorry, that radius is invalid")
06 else
07 area = 3.142 * (radius ^ 2)
08 print (area)
09 endif
Explain, using examples from the program, two ways to improve the maintainability of the program.

[4]
(b) Identify two variables used in the program.

[2]

© OCR 2023. You may photocopy this page. 17 of 134 Created in ExamBuilder
(c)

(i) Identify one item in the program that could have been written as a constant.

[1]

(ii) Give one reason why you have identified this item as a constant.

[1]

(d) Tick (✓) one box in each row to identify whether each programming construct has or has not been used in the
program.

Has been used Has not been used


Sequence

Selection

Iteration

[3]

13(a) A teacher researches the length of time students spend playing computer games each day.

Tick (✓) one box to identify the data type you would choose to store the data and explain why this is a suitable
data type.

Data Type Tick (✓) one box


String
Integer
Real
Boolean

Explanation:

[2]

© OCR 2023. You may photocopy this page. 18 of 134 Created in ExamBuilder
(b) Data for one week (Monday to Friday) is stored in a 2D array with the identifier minsPlayed.

The following table shows part of this array, containing 4 students.

The teacher wants to output the number of minutes Dan (column index 3) played computer games on
Wednesday (row index 2). The following code is written:

print(minsPlayed[3,2])

Write program code to output the number of minutes that Stuart played computer games on Friday.

You must use either:

• OCR Exam Reference Language, or


• a high-level programming language that you have studied.

[1]

© OCR 2023. You may photocopy this page. 19 of 134 Created in ExamBuilder
(c) The following program uses a condition-controlled loop.

x = 15
y = 0
while x > 0
y = y + 1
x = x – y
endwhile
print(y)

Complete the trace table to test this program.

x y output

[4]

© OCR 2023. You may photocopy this page. 20 of 134 Created in ExamBuilder
14 Elliott plays football for OCR FC. He wants to create a program to store the results of each football match they
play and the names of the goal scorers. Elliott wants individual players from the team to be able to submit this
information.

The number of goals scored in each football match is held in an array called goals. An example of this array is
shown.

goals = [0, 1, 3, 0, 4, 5, 2, 0, 2, 1]

Elliott wants to count how many matches end with 0 goals.

Complete the following pseudocode for an algorithm to count up how many matches with 0 goals are stored in
the array and then print out this value.

01 nogoalscount = 0
02 for count = 0 to (goals.length-1)
03   if goals[…………………………] == 0 then
04     nogoalscount ……………………………………………………
05    endif
06 next count
07 print(……………………………………………)
[3]

15 The symbol ^ is used for exponentiation.


Give the result of a^b when a = 3 and b = 2.

[1]

© OCR 2023. You may photocopy this page. 21 of 134 Created in ExamBuilder
16(a) OCR Land is a theme park aimed at children and adults. Entrance tickets are sold online. An adult ticket to OCR
Land costs £19.99, with a child ticket costing £8.99. A booking fee of £2.50 is added to all orders.

A function, ticketprice(), takes the number of adult tickets and the number of child tickets as parameters. It
calculates and returns the total price to be paid.

(i) Use pseudocode to create an algorithm for the function ticketprice().

© OCR 2023. You may photocopy this page. 22 of 134 Created in ExamBuilder
[6]

(ii) Tick (✓) one box to identify the data type of the value returned from the function ticketprice(), justifying
your choice.

Data type of returned value Tick (✓) one box


Integer
Real
Boolean
String

Justification

[2]

© OCR 2023. You may photocopy this page. 23 of 134 Created in ExamBuilder
(b) OCR Land keeps track of the size of queues on its rides by storing them in an array with the identifier
queuesize. It uses the following bubble sort algorithm to put these queue sizes into ascending numerical order.

01 swaps = True
02 while swaps
03    swaps = False
04    for p = 0 to queuesize.length-2
05      if queuesize[p] > queuesize[p+1] then
06       temp = queuesize[p]
07       queuesize[p] = queuesize[p+1]
08       queuesize[p+1] = temp
09       swaps = True
10      endif
11   next p
12 endwhile

(i) Explain the purpose of the Boolean variable swaps in this bubble sort algorithm.

[2]

(ii) Explain the purpose of lines 06 to 08 in this bubble sort algorithm.

© OCR 2023. You may photocopy this page. 24 of 134 Created in ExamBuilder
[2]

(iii) Describe one way that the maintainability of this algorithm could be improved.

[2]

(iv) Give the names of two other sorting algorithms that could be used instead of bubble sort.

[2]

© OCR 2023. You may photocopy this page. 25 of 134 Created in ExamBuilder
(c) One ride in OCR Land has a minimum height of 140 cm to ride alone or 120 cm to ride with an adult.

Create an algorithm that:

• asks the user to input the height of the rider, in centimetres


• if needed, asks if they are riding with an adult
• outputs whether or not they are allowed to ride
• repeats this process until 8 people have been allowed to ride.

© OCR 2023. You may photocopy this page. 26 of 134 Created in ExamBuilder
© OCR 2023. You may photocopy this page. 27 of 134 Created in ExamBuilder
[8]

© OCR 2023. You may photocopy this page. 28 of 134 Created in ExamBuilder
17 Louise writes a program to work out if a number entered by the user is odd or even. Her first attempt at this
program is shown.

01 num = input(“enter a number”)


02 if num MOD 2 >= 0 then
03    print(“even”)
04 else
05    pritn(“odd”)
06 endif
The program contains a logic error on line 02.

(i) State what is meant by a logic error.

[1]

(ii) Give a corrected version of line 02 that fixes the logic error.

[1]

© OCR 2023. You may photocopy this page. 29 of 134 Created in ExamBuilder
18 Hamish stores confidential documents on his laptop.

If unauthorised access does occur, Hamish would like to use encryption to add another layer of protection to his
documents.

(i) Explain how encryption helps to protect Hamish’s documents.

[2]

(ii) One encryption method is a Caesar cipher.

This Caesar cipher moves each letter of the alphabet one place to the right.

The following table shows the original letters in the first row, and the new letters in the second row.

For example, if the message read: HELLO

This would be stored as: IFMMP

The following pseudocode algorithm takes a string of uppercase letters as input and uses the Caesar cipher
to encrypt them.

The functions used in the algorithm are described in the table:

Function Description

© OCR 2023. You may photocopy this page. 30 of 134 Created in ExamBuilder
ASC(character) Returns the ASCII value for character e.g.
ASC("A") returns 65
CHR(ASCIIvalue) Returns the single character for ASCIIvalue e.g.
CHR(65) returns "A"
subString(Value, Number) Returns the Number of characters starting at
position Value (where 0 is the first character)

Complete the pseudocode algorithm to perform a Caesar cipher.


01 message = input("Please enter your string")
02 newMessage = " "
03 messageLength = message.length
04 for count = 0 to ............................................
05    ASCIIValue = ASC(message.subString(................,1))
06    ASCIIValue = ASCIIValue + ................................
07    if ASCIIValue >90 then
08    ASCIIValue = ................................ – 26
09    endif
10    newMessage = ................................ + CHR(ASCIIValue)
11 next count
[5]

(iii) The algorithm needs adapting. An extra line (line 12) is needed to output the encrypted message.

Write line 12 to output the encrypted message in pseudocode or programming code.

[1]

© OCR 2023. You may photocopy this page. 31 of 134 Created in ExamBuilder
19 Victoria is writing a program using a high level language to display the meaning of computer science acronyms
that are entered. The code for her first attempt at this program is shown below.

01 a = input(“Enter an acronym”)
02 if a == “LAN” then
03 print(“Local Area Network”)
04 elseif a == “WAN” then
05 print(“Wide Area Network”)
06 ……………………………………………………………………………………………
07 ……………………………………………………………………………………………
08 endif
(i) Complete the code above to print out an “unknown” message if any other acronym is entered by the user. [2]

(ii) Describe what is meant by a “high level language”.

[2]

© OCR 2023. You may photocopy this page. 32 of 134 Created in ExamBuilder
20(a) A programmer has written an algorithm to output a series of numbers. The algorithm is shown below:

01 for k = 1 to 3
02 for p = 1 to 5
03 print (k + p)
04 next p
05 next k
06 m = 7
07 print m * m

(i) Give the first three numbers that will be printed by this algorithm.

[1]

(ii) State how many times line 03 will be executed if the algorithm runs through once.

[1]

(b) Identify two basic programming constructs that have been used in this algorithm.

[2]

© OCR 2023. You may photocopy this page. 33 of 134 Created in ExamBuilder
(c)

(i) Describe what is meant by a variable.

[2]

(ii) Identify two variables that have been used in the algorithm above.

[2]

© OCR 2023. You may photocopy this page. 34 of 134 Created in ExamBuilder
21(a) A library gives each book a code made from the first three letters of the book title in upper case, followed by the
last two digits of the year the book was published.

For example, “Poetry from the War”, published in 2012 would be given the code POE12.

(i) Complete the following pseudocode for a function definition that will take in the book title and year as
parameters and return the book code.

01 function librarycode (title, ………………………………………………)


02 parta = title.subString (0, ………………………………………………)
03 partb = year.subString (2, 2)
04 ……………………………………………… parta.upper + partb
05 endfunction
[3]

© OCR 2023. You may photocopy this page. 35 of 134 Created in ExamBuilder
(ii) Use pseudocode to write an algorithm that does the following :

• Inputs the title and year of a book from the user.


• Uses the librarycode function above to work out the book code.
• Permanently stores the new book code to the text file bookcodes.txt

[6]

© OCR 2023. You may photocopy this page. 36 of 134 Created in ExamBuilder
(b) Functions and procedures are both examples of sub programs.

(i) Describe one difference between a function and a procedure.

[2]

© OCR 2023. You may photocopy this page. 37 of 134 Created in ExamBuilder
(ii) Describe two benefits to a programmer of using sub programs.

[4]

© OCR 2023. You may photocopy this page. 38 of 134 Created in ExamBuilder
22(a) For each of the pseudocode algorithms shown below, tick the appropriate box to show whether they will loop
infinitely or not.

Pseudocode Will loop infinitely Will not loop infinitely


01 x = 0
02 while True
03 print x
04 endwhile
01 x = 0
02 while x < 10
03 print x
04 endwhile
01 x = 0
02 while x < 10
03 print x
04 x = x + 1
04 endwhile
01 y = 5
02 for x = 1 to y
03 print x
04 next
[4]

© OCR 2023. You may photocopy this page. 39 of 134 Created in ExamBuilder
(b) Using pseudocode, write an algorithm that will use a count-controlled loop to print out the numbers 1 to 10 in
ascending order.

[3]

23(a) OCR High School uses a computer system to store data about students’ conduct. The system records good
conduct as a positive number and poor conduct as a negative number. A TRUE or FALSE value is also used to
record whether or not a letter has been sent home about each incident.

An example of the data held in this system is shown below in Fig. 1:

StudentName Detail Points LetterSent


Kirstie Homework forgotten −2 FALSE
Byron Good effort in class 1 TRUE
Grahame 100% in a test 2 FALSE
Marian Bullying −3 TRUE

Fig. 1

State the most appropriate data type used to store each of the following items of data.

• StudentName

• Points

• LetterSent [3]

© OCR 2023. You may photocopy this page. 40 of 134 Created in ExamBuilder
(b) The data shown above in Fig. 1 is stored in a database table called Conduct.

(i) Write an SQL statement to select the StudentName field for all records that have negative Points.

[3]

(ii) State the wildcard that can be used in SQL to show all fields from a table.

[1]

© OCR 2023. You may photocopy this page. 41 of 134 Created in ExamBuilder
(c) A single record from this database table is read into a program that uses an array with the identifier
studentdata. An example of this array is shown below:

studentdata = [“Kirstie”, “Homework forgotten”, “–2”, “FALSE”]

The array is zero based, so studentdata[0] holds the value “Kirstie”.

Write an algorithm that will identify whether the data in the studentdata array shows that a letter has been
sent home or not for the student. The algorithm should then output either “sent” (if a letter has been sent) or “not
sent” (if a letter has not been sent).

[4]

© OCR 2023. You may photocopy this page. 42 of 134 Created in ExamBuilder
24 OCR town are holding an election with three candidates (A, B and C). An electronic voting booth will be used to
allow people to vote.

Write an algorithm that:

• Allows voters to enter either A, B or C.


• Keeps track of how many times each candidate has been voted for.
• As soon as one person has finished voting, allows the next person to vote.
• At any point allows the official to type in “END”, which will print out the number of votes for each candidate
and the total number of votes overall.

© OCR 2023. You may photocopy this page. 43 of 134 Created in ExamBuilder
[6]

© OCR 2023. You may photocopy this page. 44 of 134 Created in ExamBuilder
25 Joseph is an author and programmer, and he needs to estimate how many pages his new book will have.

Each page has an average of 300 words. Each chapter starts with a chapter title page.
The number of pages is estimated by;

dividing the number of words by 300


ignoring the decimal part of the division
adding the number of chapters to this total.

Joseph uses the algorithm below to estimate the number of pages, but his algorithm does not give the correct
result.

01 INPUT numberOfWords
02 INPUT numberOfChapters
03 CONST wordsPerPage = 300
04 numberOfPages = RoundDown(numberOfWords / wordsPerPage)
05 numberOfPages = numberOfWords + numberOfChapters
06 OUTPUT numberOfPages

Joseph has used a RoundDown function to remove the decimal part of the division, e.g. RoundDown(6.2)
would return 6, RoundDown(7.8) would return 7.

State whether this algorithm uses selection, sequence or iteration.

[1]

26(a) Line 03 defines a constant. Describe what is meant by a constant.

[2]

© OCR 2023. You may photocopy this page. 45 of 134 Created in ExamBuilder
(b) Joseph is an author and programmer, and he needs to estimate how many pages his new book will have.

Each page has an average of 300 words. Each chapter starts with a chapter title page.
The number of pages is estimated by;

dividing the number of words by 300


ignoring the decimal part of the division
adding the number of chapters to this total.

Joseph uses the algorithm below to estimate the number of pages, but his algorithm does not give the correct
result.

01 INPUT numberOfWords
02 INPUT numberOfChapters
03 CONST wordsPerPage = 300
04 numberOfPages = RoundDown(numberOfWords / wordsPerPage)
05 numberOfPages = numberOfWords + numberOfChapters
06 OUTPUT numberOfPages

Joseph has used a RoundDown function to remove the decimal part of the division, e.g. RoundDown(6.2)
would return 6, RoundDown(7.8) would return 7.

Identify the most appropriate data type for the following variable numberOfWords. Give a reason for your
choice.

Data type

Reason

[2]
(c) Joseph is changing his algorithm and needs to store the name and price of his book in new variables. State the
most appropriate data type(s) for these variables.

Name

Price

[2]

27 A memory game is played where:

© OCR 2023. You may photocopy this page. 46 of 134 Created in ExamBuilder
three players (A, B and C) have to choose a number between 0 and 100
if the number has already been chosen, a message is displayed that says “taken”
if the number has not already been chosen, the playerws letter is placed next to it
the quantity of numbers that have not yet been chosen is displayed.

The winner is the player who has chosen the most unique numbers by the end of the game.

The numbers are stored in an array; numbers(). A number that has not yet been chosen is stored as an empty
string “”. The players are represented by “A”, “B” and “C”.

Fig. 5 shows an extract from the array:

Fig. 5

You have been asked to program part of the game.

Write an algorithm for player A's turn, which;

takes as an input the number that player A chooses


if it has not already been chosen, stores an “A” in that array element
if it has already been chosen, outputs “taken“
counts and outputs the quantity of numbers left that have not been chosen.

[6]

© OCR 2023. You may photocopy this page. 47 of 134 Created in ExamBuilder
© OCR 2023. You may photocopy this page. 48 of 134 Created in ExamBuilder
28(a) Charlotte runs a website which stores details about movies. The users can log onto the website and leave
ratings for movies.

The websites uses a database with three tables:

The table FILM contains the following fields; FilmID, Title, Year, Director, Category
The table USER contains the following fields; UserID, FirstName, Surname, DateOfBirth
The table RATING stores, amongst other fields, the rating a user has given a film (a score out of 5).

An extract of the data in the table RATING is shown in Fig. 1:

Fig. 1

Give one example of a record that could be stored in the user table.

[1]
(b)

(i) Charlotte uses a query to list films. The query uses the following criteria:

(Rating < 2) AND (UserID = “Jade01”)

List the RatingID(s) of the rating(s) that will be selected from the extract shown.

[1]

(ii) Write the criteria for a query that will select all Films produced in the Year 2015 in the Category “Comedy”.

[3]

© OCR 2023. You may photocopy this page. 49 of 134 Created in ExamBuilder
29 Charlotte runs a website which stores details about movies. The users can log onto the website and leave
ratings for movies.

The websites uses a database with three tables:

The table FILM contains the following fields; FilmID, Title, Year, Director, Category
The table USER contains the following fields; UserID, FirstName, Surname, DateOfBirth
The table RATING stores, amongst other fields, the rating a user has given a film (a score out of 5).

An extract of the data in the table RATING is shown in Fig. 1:

Fig. 1

Explain why FilmID has been included in the RATING table.

[3]

© OCR 2023. You may photocopy this page. 50 of 134 Created in ExamBuilder
30(a) A game on a computer shows six players around a table on seats. They are numbered 1 to 6 as shown below.

The names of the players are stored in an array with six elements called PlayerName. The index position of the
array is used to indicate the seat number.
For example, the value of PlayerName(1) is “Helen”.

State the value of PlayerName(3).

[1]
(b) Describe what will happen if the code for the game includes an instruction to print the value of PlayerName(7).

[2]

© OCR 2023. You may photocopy this page. 51 of 134 Created in ExamBuilder
(c) During the game, each player sometimes moves clockwise by a given number of places.

For example, if the number of places is 2, Helen will move to seat 3, Priya will move to seat 1 etc.

Write an algorithm that will update the contents of the array PlayerName after a move has occurred. Your
algorithm should:

allow the number of places to move to be input


use iteration
ensure that all of the existing players' names are moved to the correct position in the array.

[6]

© OCR 2023. You may photocopy this page. 52 of 134 Created in ExamBuilder
31(a) The area of a circle is calculated using the formula Π × r2, where Π is equal to 3.142 and r is the radius.

Finn has written a program to allow a user to enter the radius of a circle as a whole number, between 1 and 30,
and output the area of the circle.

Identify two variables used in the program.

[2]
(b)

(i) Identify one item in the program that could have been written as a constant.

[1]

(ii) Give one reason why you have identified this item as a constant.

[1]

© OCR 2023. You may photocopy this page. 53 of 134 Created in ExamBuilder
32(a) Files are often compressed before they are sent over the internet.

State what is meant by compression.

[1]

State one advantage of compressing files before sending them over the internet.

[1]
(b) Two types of compression are lossy and lossless.

State which type of compression is most appropriate for each of the following and explain why it is appropriate.

(i) Downloading the source code of a large program

Type of
compression

Explanation

[3]

(ii) Streaming a large video file

Type of
compression

Explanation

[3]

© OCR 2023. You may photocopy this page. 54 of 134 Created in ExamBuilder
33(a) Numbers can be represented in denary, binary or hexadecimal.

(i) Convert the binary number 01101001 to denary, showing your working.

[2]

(ii) Convert the denary number 154 to binary.

[2]

© OCR 2023. You may photocopy this page. 55 of 134 Created in ExamBuilder
(b) The security code for an alarm system is a long binary number which begins

10001111100101111011 …

The technicians prefer to use hexadecimal to enter the security code.

(i) When the number is converted into hexadecimal, the first two digits are 8F as shown below.

Complete the gaps to show the next three digits.

[3]

(ii) Explain why the technicians prefer to use hexadecimal.

[2]

34 Bob's computer has 512 kilobytes of ROM and 8 gigabytes of RAM.

State how many bytes are in a kilobyte and a gigabyte.

a kilobyte

a gigabyte

[2]

© OCR 2023. You may photocopy this page. 56 of 134 Created in ExamBuilder
35(a) Santos is writing a program that guesses the number of goals a team will score in a football match.

The algorithm for his program is shown below:

State what is meant by a constant and give an example from the algorithm above.

[2]
(b) State what is meant by a variable and give an example from the algorithm above.

[2]

© OCR 2023. You may photocopy this page. 57 of 134 Created in ExamBuilder
(c) State the number of goals that will be output by this algorithm for the following inputs.
Explain how you obtained your answer in each case.

Wins = 30 Losses = 25

[2]

Wins = 20 Losses = 5

[3]

36 When customers pay using a card such as the one below, shops use computer systems to process the payment.

© OCR 2023. You may photocopy this page. 58 of 134 Created in ExamBuilder
Tick one box in each row, to show which of the data types given is the most appropriate data type for each of the
following data items.

Data item Date Integer Real String


The amount paid
The customer's card
number
When the payment
is made

[3]

© OCR 2023. You may photocopy this page. 59 of 134 Created in ExamBuilder
37(a) Heath is researching how long, to the nearest minute, each student in his class spends playing computer games
in one week (Monday to Friday). He is storing the data in a 2D array.

Fig. 2 shows part of the array, with 4 students.

For example, student 1, on Monday (day 0), played 30 minutes of computer games.

Explain why Heath is using an array to store the data.

[2]
(b)

(i) Identify a data type that could be used to store the number of minutes in this array.

[1]

(ii) State why this data type is the most appropriate.

[1]

© OCR 2023. You may photocopy this page. 60 of 134 Created in ExamBuilder
(c) Heath wants to output the number of minutes student 3 played computer games on Wednesday (day 2). He
writes the code:

print (hoursPlayed[3,2])

The output is 20.

(i) Write the code to output the number of minutes student 0 played computer games on Wednesday.

[1]

(ii) State the output if Heath runs the code:

print (hoursPlayed[2,1])

[1]

(iii) State the output if Heath runs the code:

print (hoursPlayed[3,1] + hoursPlayed[3,2])

[1]

(iv) Write an algorithm to output the total number of minutes student 0 played computer games from Monday
(day 0) to Friday (day 4).

[3]

© OCR 2023. You may photocopy this page. 61 of 134 Created in ExamBuilder
(d) Heath has the day of the week stored as a number e.g. 0 = Monday, 1 = Tuesday.

Write a sub-program that takes the number as a parameter and returns the day of the week as a string.

[5]

© OCR 2023. You may photocopy this page. 62 of 134 Created in ExamBuilder
(e) Heath needs to work out the average number of minutes spent playing computer games each day for the class,
which contains 30 students. Write an algorithm to output the average number of minutes the whole class spends
playing computer games each day.

[8]

© OCR 2023. You may photocopy this page. 63 of 134 Created in ExamBuilder
38 There is a subroutine, HEX(), that takes a denary number between 10 and 15 and returns the corresponding
hexadecimal number. E.g. HEX(10) would return “A”, HEX(15) would return “F”.

Write an algorithm, using the subroutine HEX(), to convert any whole decimal number between 0 and 255 into a
2 digit hexadecimal number.

[4]

© OCR 2023. You may photocopy this page. 64 of 134 Created in ExamBuilder
39 Jim is writing a program to calculate the wages of workers in a teddy bear factory.

Workers sometimes get a £50 bonus.

Here is the algorithm used to calculate whether a worker should get a bonus.

State the value of Pay after this code is executed for each of the following values of WagesEarned.

WagesEarned = 50 Pay = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

WagesEarned = 200 Pay = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

[2]

© OCR 2023. You may photocopy this page. 65 of 134 Created in ExamBuilder
40 A computer program calculates the correct dose in grams of a type of medicine.

The algorithm used is shown by the flow diagram below.

© OCR 2023. You may photocopy this page. 66 of 134 Created in ExamBuilder
The data type of the variable Age is Integer.

State the data type of the following variables used in the flow diagram.

Variable Data Type


Gender
Dose
isPregnant
[3]

END OF QUESTION PAPER

© OCR 2023. You may photocopy this page. 67 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

1 1 mark per bullet 5 Accept alternative error messages.


Variable names must not include obvious
Input from user AO3 spaces.
Check IF input value is “on”… 2b(5)
… if so, assign 1 to statevalue BP3 dependent on BP2. BP2 and BP4
Correct assignment of 2 for “off” and 3 must be a logical comparison using IF and
for “suspended” with correct state and not just the CASE statement. NE to simply
IF replace CASE with IF.
Correct logical check (else) to output
“invalid state” if no state set Penalise each error once then apply FT.

e.g.
newstate = input("Enter the new state : ")

if newstate == "on" then

  statevalue = 1

elseif newstate = "off" then

  statevalue = 2

elseif newstate = "suspended"

  statevalue = 3

else

  print("Invalid state")

endif

Examiner’s Comments
Question (f) asked candidate to rewrite an
algorithm that used switch/case to
perform the same actions but using IF
statements. It was clear that many
candidates did not understand the use of
switch/case. Some languages (such as
Python) do not include support for these. It
is important that these constructs are still
taught.

OCR support

Appendix 5f of the GCSE Computer


Science specification covers the
pseudocode guide for this examination.
Candidates do not need to use this in their
responses but they should be aware of this
as questions will be presented using this
format.

The current specification is available here :

© OCR 2023. You may photocopy this page. 68 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

https://www.ocr.org.uk/images/225975-spe
cification-accredited-gcse-computer-
science-j276.pdf

Total 5

2 i 3 1 CAO

AO1
1b(1)

ii 1 1 CAO

AO1
1b(1)

Total 2

© OCR 2023. You may photocopy this page. 69 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

3 Use of iteration (any use) … 6 BP 2 and 3 may be met together with


…loops for each item in array // loops 6 suitable input statement. Both dependent
times AO3 on attempt at iteration.
…to print out each item in 2b(6)
studentnames BP5 not dependent on correct previous
…input attendance parts.
Add up/calculate students present and
absent BP6 needs reasonable attempt at totalling
…Outputs present and absent (in present and absent figures.
suitable message)
Ignore non-initialisation of counter
variables.

Flowcharts are acceptable but must show


how to solve the problem, not simply
repeat the question.

Example algorithm
present=0

absent=0

for i = 0 to (studentnames.length) -1

  print(studentnames[i])
  attendance=input("absent or present?")

  if attendance=="present" then

   present=present+1
  else
   absent=absent+1
  endif
next i

print ("Present students: " + present)

print ("Absent students: " + absent)

Examiner’s Comments
Question (c) asked candidates to write an
algorithm to:

1. Call an attendance register from a given


array.
2. Count and output how many students
were present and absent.

It was pleasing to see candidates


decompose the problem and tackle each
part to build a full solution.

The bullet points given in the question


served as a scaffold.

© OCR 2023. You may photocopy this page. 70 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Where one section was incorrect, other


marks could be given.

A number of candidates attempted to use a


FOR…IN loop to iterate over the given
student array.

FOR…IN is not listed in the specification but


is an entirely suitable way to approach the
problem. Where this was logically sound,
full marks were available.

Other candidates used FOR…NEXT loops


or WHILE loops in conjunction with the
length of the array. Again, marks were
given where the solution was logically
sound.

Marks were more limited for those


candidates who did not attempt any sort of
loop, but some were still able to be given
where appropriate.

AfL

Centres should be encouraged to connect


together content within the specification, so
that rather than teaching arrays in isolation,
they could perhaps be combined with
iteration to be able to count up or total
values in an array, or apply this to how
searching and sorting algorithms work.
Where this is done on a regular basis,
questions such as 6(c) perhaps become
less daunting for candidates.

Total 6

© OCR 2023. You may photocopy this page. 71 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

4 i timer = 7.3 1 Ignore dim / define / etc and data types


Do not allow use of string delimiters or
AO3 other unsuitable data types.
2b(1) Allow other suitable assignment symbols
(e.g. := ) Do not allow == for assignment.
Do not penalise case. Spelling must be
accurate

ii Real // Float 1 Allow decimal, single, double or equivalent

AO2
1b(1)

Total 2

5 Line Program code output 4 Examiner’s Comments


08 print (score) 18 Question (a) gave candidates pseudocode
AO2 (including a function) and were asked to
09 print ("name") name 1b(4) state the output values from various lines.
10 print (newscore 37 Most candidates were able to do this for
(score,2)) more simple output. Fewer candidates
completed the function call and return
11 print (score) 18
values accurately.

Many candidates struggled to differentiate


between name (as an identifier for a
variable) and “name” (as a string).

Misconception

print(“name”) will output the literal


string “name” to the screen”.

print(name) will print the contents of the


variable with identifier name.

Total 4

© OCR 2023. You may photocopy this page. 72 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

6 a i money 1 Must be an identifier, not description.


price Ignore case.
AO1
1b(1)

ii one 1 Examiner’s Comments


Question (b)(i) was answered very well.
AO2 However, (b)(ii) was only answered
1b(1) correctly by a small proportion of
candidates. These were also the
candidates who generally went on to
achieve high marks on this paper.

The question asked candidates to state


how many parameters are passed into the
function from the line giveChange(money
– price). Two variables are inside the
brackets. Candidates did not recognise this
as a calculation.

This calculation would be completed before


the function call. Only the result is passed
into the function as the parameter. This
means that the correct answer is one. Most
candidates gave the (incorrect) answer of
two.

Misconception

Where a sub program (function or


procedure) has multiple parameters
passed into it, there will be separated by
commas – for example
testfunction(x,y). A subprogram with
a calculation as a parameter will pass the
result of this calculation into the sub
program.

© OCR 2023. You may photocopy this page. 73 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

b 1 mark per bullet 5 Reasonable attempt at BP1 needed for


credit BP2, 3 and 4 Ignore other additional
Checking if money>=price… AO3 code.
…decision (diamond shape) used 2b(5)
…venditem() and BP3 and BP4 must follow on from
giveChange(money-price) if True/False // Yes/No decision to be
True/Yes credited.
…output an error if False / No
Terminator used to start and end the Subroutines names and parameters must
program and all paths terminated be correct. Ignore missing brackets on
venditem.

Examiner’s Comments
Question (c) asked candidates to draw
flowchart and this was done particularly
well. Many candidates changed the given
pseudocode algorithm into a well-defined
process that covered the same steps as
the pseudocode.

A typical answer for this question would be


good to use for centres when teaching
about using flowcharts. Candidates who
use flowcharts for algorithm answers are
often not specific enough with the steps
required. This gives answers that are
generic or high-level. The structure of this
question is a good example of the level of
detail required.

© OCR 2023. You may photocopy this page. 74 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

c i 1 mark per bullet to max 2 2

Indentation // whitespace AO2


Appropriately named variables / 1b(2)
identifiers
Modularisation / use of subroutines

ii Comments 1
Use of constants
AO2
1b(1)

d SELECT ItemCode // * 4 Accept other fields shown in addition to


FROM ITEMS ItemCode
WHERE AO3
…Stock < 10 2b(4) Accept Stock <=9 / etc.

Ignore case. Spelling of fields and table


must be correct.

If WHERE missing, Stock < 10 must be


after FROM clause.

Examiner’s Comments
Question (e) covered SQL. It was clear that
many candidates were not sure what was
being asked for in this question. Many
incorrectly attempted to use keywords such
as IF and THEN. The use of SQL in this
specification is limited to a small number of
keywords, as listed in the specification.

OCR support

Page 43 of the specification lists the SQL


keywords that should be covered. These
are limited to SELECT, FROM, WHERE,
LIKE, AND, OR and wildcards.

The current specification is available here :


https://www.ocr.org.uk/images/225975-spe
cification-accredited-gcse-computer-
science-j276.pdf

Total 14

© OCR 2023. You may photocopy this page. 75 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

7 1 mark for each letter in the correct place 6

procedure storeData()

  if RAM is C/Full then

    move data from RAM to A/Secondary


Storage

  endif
  store data in next free space in H/RAM

F/endprocedure

procedure accessData()

  if B/NOT (data required is in RAM) then

    if RAM is full then

     move unneeded data from RAM to HDD

    endif
    move required data from HD to RAM

  endif
  read data from H/RAM

endprocedure

Total 6

8 2 1 mark for each correct answer in table


A B P (AO1 1b)
‘True’ or ‘T’ are also credit worthy.

Total 2

© OCR 2023. You may photocopy this page. 76 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

9 SELECT StudentName, Subject, 1 Correct Answer Only


Grade (AO1 1b)
FROM Results 2 Accept SELECT *
WHERE Subject = "Art" (AO3 2a)

Total 3

10 freeseats called with "Red" 2 redseats = freeseats("Red")


…returned value assigned to variable
redseats “Red” must use suitable string delimiters
(e.g. speech marks) if directly passing the
string. Do not penalise case.

Total 2

© OCR 2023. You may photocopy this page. 77 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

11 a One mark per correct choice 3 Accept other markings that indicate a
choice has been made (e.g. a cross, etc)
SELECT ItemCode, ItemName
FROM tblStock
WHERE Price >=60

b i One mark per bullet point, in the correct 5 e.g.


place
function checkdiscount(price,
size // len(discountcodes-1) code)
code   newprice = price
price // newprice   size = len(discount)-1
[x,1] // [x][1]   for x = 0 to size
return newprice //    if discount[x,0] == code
checkdiscount = newprice then
    newprice = price –
discount[x,1]
   endif
  next
  return newprice
endfunction

ii One mark per bullet point, maximum 2 2 Do not penalise capitalisation


marks
Accept price, code, discount
newprice
size
x

© OCR 2023. You may photocopy this page. 78 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

iii asks for price and discount code to be 6 High-level programming language / OCR
input Exam Reference Language response
…passes both to the checkdiscount() required
function as parameters…
...stores / uses returned value Do not accept pseudocode / natural
calculates total of all prices language.
entered/returned
repeats until 0 is entered as price BP3 allow total of prices entered as FT if
outputs calculated total candidate does not achieve BP2

e.g.

total = 0
do
  price = input("Enter a
price")
  code = input("Enter a
discount code")
  newprice =
checkdiscount(price, code)
  total = total + newprice
until price == 0
print(total)

alternative example

total = 0
price = 1
while price != 0
  price = input("Enter a
price")
  code = input("Enter a
discount code")
  total = total +
checkdiscount(price, code)
endwhile
print(total)

Total 16

© OCR 2023. You may photocopy this page. 79 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

12 a 1 mark for naming the example and 1 mark 4


for an example related to that method (AO2 1b)

E.g

Comments/annotation…
…E.g. any relevant example, such as
line 4 checks the input is valid

Indentation…
…E.g. indenting within IF statement

Using constants…
…E.g. π

b radius 2 1 mark per bullet up to a maximum of 2


area (AO1 1b) marks.

c i 3.142 1 1 mark for one correct identification.


2 (AO2 1a)
1
30

ii The number does not need to be 1 Maximum of 1 mark.


changed while the program is running (AO1 1a)
The number can be updated once and
it updates throughout

d HAS been used 3


HAS been used (AO2 1b)
HAS NOT been used

Total 11

© OCR 2023. You may photocopy this page. 80 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

13 a Integer (1)… 1 One mark for appropriate data type


(AO3 2a) identified.
…number of seconds not important (1) 1
… level of accuracy not needed so (AO3 1) One mark for appropriate justification
round to nearest minute (1) linked to the data type chosen.
…using a decimal to store seconds
(0-60) is not appropriate (1)

Real (1)…

… number of seconds may be


important (1)
… allows parts/fractions to be stored
over integers (1)

b print (minsPlayed[0,4]) 1 High-level programming language / OCR


(AO3 2b) Exam Reference Language response
required

Do not accept pseudocode / natural


English.

print may be a suitable output command


word that could be found in a HLL e.g.
print (Python), console.writeline
(VB), cout (C++)

The array elements may be accessed


together [0,4] (VB.NET) or separately
[0][4] (Python)

c 4 one mark for first row


(AO3 2c)
one mark for row 2 and 3

one mark for rows 4, 5, and 6

one mark for the correct output (the only


value in the output column, in any position)

Total 7

© OCR 2023. You may photocopy this page. 81 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

14 1 mark per bullet to max 3 3 Correct answer only.


AO3 2b
count (3) Accept alternatives to adding 1 to variable
= nogoalscount + 1 (e.g. += 1 / ++)
nogoalscount
Penalise spelling once only, FT for further
mistakes. Do not penalise case.

Accept sensible messages printed out


alongside nogoalscount

Examiner’s Comments

This question assessed whether


candidates were able to complete an
algorithm to count the number of times that
the value 0 appeared in a given array.

The first blank to be filled in tested


candidates’ understanding of the use of a
for loop counter to access each index in an
array sequentially; this was not answered
successfully by many candidates and
perhaps shows a lack of understanding.

The next blank was more successfully


answered and required candidates to
increment the variable by 1 which could
have been done in several ways, all of
which were accepted.

Finally, the simplest and most commonly


correct answer simply required candidates
to print out the value of the variable.

Total 3

© OCR 2023. You may photocopy this page. 82 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

15 9 1 Correct answer only


AO1 1b Do not accept 32 or 3 x 3
(1)
Examiner’s Comments

Exponentiation is covered in the


specification in section 2.4, Computational
logic under the subheading ‘applying
computing-related mathematics’.

Approximately half of all candidates did not


understand the use of this symbol, even
when the meaning was given in the
question.

The most common incorrect answer was to


treat exponentiation as synonymous to
multiplication.

Total 1

© OCR 2023. You may photocopy this page. 83 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

16 a i 1 mark per bullet to max 6 6 Bullet points 3, 4, 5 can be awarded even if


AO3 2b no mention of a function / parameters (for
Function ticketprice() defined (6) example, if candidate has inputted the
… that accepts two parameters and number of tickets needed.
has no other inputs
Works out total ticket price for adult (eg Do not award return value if no attempt at
adult * 19.99) a function. Return mark can be given if a
Works out total ticket price for children good attempt made at calculating the total,
(eg child * 8.99) even if this is incorrect.
Adds on correct booking fee
Returns the calculated value. Allow 2.50 booking fee to be per order or
per ticket

Ticket prices must be stored appropriately


if needed.

example algorithm

function ticketprice(numadult,
numchild)
  price = (numadult * 19.99) +
(numchild * 8.99) + 2.50
  return price
end function

Allow alternatives in high level languages


(e.g. def in Python).

Allow return as assigning the value to the


name of the function (VB syntax)

Examiner’s Comments

This question assessed not only whether


candidates could create an algorithm to
calculate a ticket price using the
information given, but also whether this
could be done as a function.

Many candidates were able to achieve the


first part of this well, but only a small
number even attempted to create this in
the form of a function with parameters
passed in.

Most candidates chose to ask for inputs


during the algorithm instead of passing
parameters and were therefore only able to
achieve a maximum of 3 marks out of 6.

© OCR 2023. You may photocopy this page. 84 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Misconception

A function should not take input directly


from the user; instead, values required
should be passed in as parameters.

Equally, when the required calculations are


completed the value should not be printed
out but returned.

Using parameters and returned values in


this way makes a function truly reusable.

Exemplar 3

Exemplar 3 shows a response that


successfully covers all of the points
required by the question and therefore
achieves 6 marks.

Exemplar 4

The response above shows a response


that only managed to gain 2 marks, for the
calculation of the total price for adults and
the total price for children.

There is no attempt to use a function and


the input/outputs are done through inputs

© OCR 2023. You may photocopy this page. 85 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

and print statements rather than


parameters passed and a value returned.

In addition, the booking fee was not


correctly added to the overall price as the
assignment statement is the wrong way
around.

ii 1 mark per bullet to max 2 2 Allow String only if matching justification


AO2 1a shows understanding (e.g. £ sign attached,
Real… (1) message returned alongside value).
…Returned value may not be a whole AO2 1b
number / may have a decimal point in (1) Examiner’s Comments

The majority of candidates answered this


well, with Real being chosen because of
the potential need to use decimal places in
the value returned as the main correct
answer.

Where candidates had justified the use of a


string (because the returned data would
include currency symbols or other text) this
was also credited.

b i 1 mark per bullet to max 2 2 The variable records whether a swap has
AO2 1b taken place; it does not perform the swap.
Flag / record whether a swap has (2)
taken place or not Examiner’s Comments
checked as condition to decide
whether to repeat This question presented candidates with
an algorithm for a bubble sort and asked
them to explain the purpose of the Boolean
value swaps.

This proved to be a very tough question,


with the majority unable to explain its use
as a flag to store whether a swap had
taken place during that pass, and then
further as a condition to check whether to
repeat lines 03 to 11.

Many candidates understood, perhaps


through the name given to the variable,
that it was involved in swapping something,
but many said that the variable itself made
the swap, which is logically incorrect.

Some candidates seemed to not


understand the while loop on line 02.

© OCR 2023. You may photocopy this page. 86 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Misconception

A while loop, as its name suggests,


repeats while a condition is True.

For example, while x>5 will repeat while


the condition x>5 is evaluated to be True.

However, if the condition given is itself a


Boolean value, then no evaluation is
necessary, and the True of False nature of
this condition is used to decide whether to
repeat or not.

In this question, swaps is a Boolean value.

The line while swaps is logically


equivalent to the more verbose and
unnecessary while swaps == True

Exemplar 5

The above response shows a typical


answer where the candidate has not quite
understood the process undertaken by the
bubble sort algorithm; swaps is set to True
when a swap has occurred and not, as this
candidate suggests, that the swap occurs
because of the variable being set.

© OCR 2023. You may photocopy this page. 87 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

ii 1 mark per bullet to max 2 2 Do not accept “sorts numbers”


AO2 1b
Swaps.. (2) “swaps numbers” meets BP1. Explanation
…values of queuesize[p] and of which values in the array are swapped
queuesize[p+1] meets BP1 and BP2.
…when queuesize[p] is larger than
queuesize[p+1] Do not accept direct word for word
using a temporary variable //doesn’t repetition from the program (e.g. temp =
overwrite numbers //explanation of queuesize[p] ) , question asks for an
process explanation.

Explanation of temporary variable must be


logically correct.

Examiner’s Comments

This was another question where


candidates struggled to explain clearly the
purpose of a specific part of the given
algorithm.

Lines 06 to 08 dealt with swapping two


values over. Simply identifying that swap
takes place and which numbers are
swapped was sufficient to achieve both
marks here, but the majority were unable
to successfully do this.

A mark could also have been given for


explaining that the two numbers were not
directly swapped over, but that a temporary
value was used as an intermediary.

Many candidates provided answers that


were entirely different from this. In some
cases, candidates attempted to simply
translate each line into structured English.

© OCR 2023. You may photocopy this page. 88 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

iii 1 mark per bullet to max 2. 2 Mark first answer only


AO2 1a
Comments (1) Do not accept indentation (already done)
… to enable programmers to AO2 1b
understand the purpose of each line / (1) Accept “show what each line does” for
section comments.
…by example (e.g. on line 4 add the
comment…) Examiner’s Comments

Naming variables sensibly Maintainability is obviously well understood


… to enable programmers to by centres and students, with many
understand the purpose of each students giving very pleasing answers to
variable this question.
…by example (e.g. change identifier p
to …) Commenting and the need for comments
was perhaps the most popular answer.
Modularise
…to allow reuse / makes easier to test It was nice to see modularisation
/ reduces errors discussed also, although a number of
…by example (e.g. create as a students were unable to explain what they
function) meant by this and how it could be applied
to the code given.

© OCR 2023. You may photocopy this page. 89 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

iv 1 mark per bullet to max 2. 2 Accept “insert”. Do not penalise spelling.


AO1 1a
Insertion (sort) (2) Do not accept bubble sort (given in
Merge (sort) previous questions)

Do not award searching algorithms

Allow other valid sorting algorithms.


(e.g. quick sort, heap sort, shell sort,
selection sort, radix sort, bucket sort, tim
sort, comb sort, pigeonhole sort, etc.)

Examiner’s Comments

This question was answered extremely


well by candidates and shows that the
prescribed sorting algorithms are covered
in centres and their names retained well by
candidates.

Merge sort and insertion sort are the two


other algorithms covered in the
specification and these were the two most
popular answers given by candidates.
However, credit was also given to many
other valid sorting algorithms and it is
pleasing to see that centres or candidates
are interested in going beyond the confines
of the specification to investigate
algorithms such as Quick sort (which
appears in the A Level specification) and
even Bogo sort. This additional learning is
to be applauded.

© OCR 2023. You may photocopy this page. 90 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

c 1 mark per bullet to max 8. 8 Answers can be in any suitable format


AO3 2b (including pseudocode, flowchart, etc). If
Input height (8) flowchart used, accept any sensible
Accepts riders > / >= 140 with suitable shapes.
message
Rejects riders < / <= 120 with suitable Do not penalise for lack of initialisation of
message variables.
Checks if height between 120 and
140… Loop must repeat until 8 riders allowed, not
… If True, input whether accompanied just loop 8 times.
… Suitable output message for True
AND False Do not credit asking whether accompanied
Correctly counts number of riders in all if in the wrong place.
cases of being allowed to ride (do not
penalise candidates for counting or not Condition for BP4 may be 120 < h <
counting accompanying adults) 140
Attempt to loop based on 8 riders
allowed Example algorithm
riders=0
while riders <8
   input height
   if height >= 140 then
     output “allowed”
     riders = riders + 1
  elif height >=120 then
     input withadult
     if withadult == “yes”
       output “allowed”
       riders = riders + 1
     else
       output “not allowed”
     end if
  else
     output “not allowed”
  end if
endwhile

Examiner’s Comments

This question asked candidates to create


an algorithm for checking the heights of
riders on a theme park ride.

The algorithm was decomposed for


candidates using bullet points and many
candidates had a solid attempt at
completing this.

Most candidates were able to ask for the

© OCR 2023. You may photocopy this page. 91 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

input of a rider’s height, although some


candidates struggled to use (or missed out)
either the assignment operator or the
INPUT (or equivalent) command. A line of
pseudocode that simply printed out ‘enter a
height’ is not the same logically as an input
and was not credited.

Where an input was taken and


comparisons made, these were generally
well attempted.

Examiners worked logically through the


code and credit was given for checking for
the three types of riders (over 140 and so
can ride alone, between 120-140 and so
need to ride with an adult, under 120 and
so cannot ride) and giving the right output
to each rider.

There were many different valid and invalid


attempts at this but logically, if each type of
rider would have produced the right output
then this should have been credited. The
mark scheme provides an exemplar
answer, but a wide range of responses
were accepted.

Many candidates did not attempt to repeat


the algorithm until 8 riders had been
allowed to ride and so were unable to
access these marks. However, several
higher ability candidates thought even
more deeply about this and wrote
algorithms that added two riders if
someone was riding with an adult; this was
a valid thought and so was credited as
well.

© OCR 2023. You may photocopy this page. 92 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Exemplar 6

Exemplar 6 shows a well organised


response that gained full marks. Each
check is completed in order, with ELIFs
and ELSE used efficiently to make sure
that logically correct comparisons are
made. The loop works correctly and
repeats until 8 riders have been allowed to
ride. This is a very good example of the
sort of response needed to achieve highly.

Total 24

© OCR 2023. You may photocopy this page. 93 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

17 i 1 mark per bullet to max 1 1 Do not accept examples of logic errors.


AO1 1b
An error that results in incorrect output (1) Examiner’s Comments
/ unexpected result
Contains an error but still runs / doesn’t This question asked candidates to state
crash the meaning of the term ‘logic error’.

To be successful, candidates needed to


show examiners that they knew how a
logic error differed from other types of
errors and so answers such as ‘when code
does not work’ were not precise enough.

Successful answers conveyed the idea of


incorrect output without stopping the
execution of the program.

ii if num MOD 2 == 0 then 1 Important point is that >= is changed to ==


AO3 2b or =.
if num MOD 2 = 0 then (1) Accept alternatives that produce the same
result (e.g. <=0, <1, !=1, etc.)

Ignore any casting (e.g. using int() to


convert to a number)

Accept other minor changes to the line as


long it logically works.

Accept versions of MOD from high level


languages (e.g. Python : if num % 2 ==
0)

Examiner’s Comments

The logic error present in the program was


that any number entered would print out
‘even’ because line 02 checked if num MOD
2 was greater than or equal to 0 rather
than simply equal to 0. This could be fixed
by replacing the greater than comparison
with an = (or == ).

Few candidates achieved this, suggesting


a lack of confidence either with the MOD
operator or the program as a whole.

Total 2

© OCR 2023. You may photocopy this page. 94 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

18 i 1 mark per bullet to max 2 2 'Need the key to understand the data'
AO1 1a can get both MP2 and 3
Uses an algorithm to (1)
… jumble/scramble/mix up the data // AO2 1b Cannot read the data // data is
turns it into cypher text // by example (1) unreadable is NBOD
If it is accessed it cannot be
understood // it is unintelligible Examiner’s Comments
Use of keys to encrypt/decrypt data
This question was answered well by many
candidates who were able to identify that
encryption scrambles data and that a key
is required to read it.

ii 1 mark for each completed piece of code 5 For messageLength - 1 in loop


AO3 2b accept messageLength or
message = input("Please enter (5) message.length
your string")
newMessage = "" Spelling must be exact, do not penalise
messageLength = message.length case.
for count = 0 to messageLength
– 1// message.length – 1 Examiner’s Comments
   ASCIIValue =
ASC(message.subString This question tested candidates'
count,1)) understanding of algorithms and the use of
   ASCIIValue = ASCIIValue + 1 strings in programming.
if ASCIIValue > 90 then
    ASCIIValue = ASCIIValue – A noticeable number of candidates did not
26 attempt the question.
   endif
   newMessage = newMessage & The most common correct response was
CHR(ASCIIValue) the first space to identify the number of
next count iterations. The final space was also often
answered correctly, identifying that the
string is concatenated with the rest of the
message.

Fewer candidates were able to identify the


character being selected, or the value to
add to ASCIIValue within the loop.

© OCR 2023. You may photocopy this page. 95 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

iii 1 mark for suitable output 1 Must logically work. Do not accept ""
e.g. AO3 2b around newMessage.
(1)
output(newMessage) // Parentheses not required.
print(newMessage)
Do not accept:
newMessage =
output(newMessage) or similar

Accept any output method

Bod - if the candidate outputs


something extra it must be valid i.e. a
variable from the program, or additional
text in a string with suitable
concatenation e.g.
print(newMessage +
asciiValue) is ok but
print(newMessage is the new
message) is not.

Examiner’s Comments

This question required candidates to


identify the variable from part bii that stores
the final encrypted message and to output
it using any identifiable output keyword.

A common error was putting speech marks


around new message i.e. ‘newmessage’
which would mean the words
‘newmessage’ would be output instead of
the contents of the variable.

Total 8

© OCR 2023. You may photocopy this page. 96 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

19 1 mark per bullet, max 2. 2 Accept logically correct equivalents for else
(e.g. elseif a!=“LAN“ and/or a
!=“WAN“). Do not allow elseif on its
else own
print (“unknown”)
Accept other keywords for print (e.g.
“output”) as long as the intention is clear.

Accept other messages as equivalent to


“uknown” (e.g. “not known” / “error”))

Message to be printed must be in quotes.

Allow “else then”.

Examiner’s Comments

Most candidates were able to complete line


07 successfully, with an output/print of an
acceptable ‘unknown’’ message being all
that was required. Line 06 required
candidates to understand that the message
on line 07 should be printed out where the
conditions in lines 02 and 04 were both
false; the simplest way of achieving this
was an ELSE (or equivalent). Where
candidates put more logically complex
statements, these were successful if they
were logically correct. However, many
candidates struggled with this.

Misconception
To compare the contents of a variable
against two possible values, it is incorrect
to use :
• if a!=‘WAN’ or ‘LAN’
In the example above, the comparison of a
against ‘WAN’ is logically correct, but it is
unclear what ‘LAN’ is being compared
against.
A logically correct way to achieve the same
thing would be :
• if a!=‘WAN’ and a!=‘LAN’

© OCR 2023. You may photocopy this page. 97 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

1 mark per bullet, max 2. 2 Allow examples of keywords (eg IF / ELSE


/ WHILE) as 2nd bullet point.

aimed at humans//understandable by
humans / programmers Do not award marks for naming languages
English like structure / syntax such as Java , Python, etc.
Must be
translated/compiled/interpreted (before
it can be run) Do not award marks for stating what a high
Allows programmer to deal with the level language isn’t (i.e. describing what
problem instead of considering the low level code is).
underlying hardware // an abstraction
from the hardware // hardware Do not allow “easy to use”
independent // portable
Do not allow ‘has to be converted’ without
into what i.e machine code etc.

Examiner’s Comments

This question was answered well by many


candidates, with responses relating to the
use of English-like keywords but needing
to be translated before the processor could
execute it being the most popular. A
minority of candidates confused ‘high-level’
with ‘difficult’ and gave incorrect answers
regarding it being too hard to programmers
to use. The opposite is in fact true, with
‘high-level’ referring to the level of
abstraction away from the underlying
hardware.

Very few answers were seen that in any


way discussed this abstraction or
portability between different processors.
Hopefully centres will become more
confident with the delivery of the subject
and so more complex and technically
complete answers will be seen across all
questions from high ability candidates.

Total 4

© OCR 2023. You may photocopy this page. 98 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

20 a i 2,3,4 1 All three numbers needed in the correct


order (with no other numbers) for mark.

Examiner’s Comments

The majority of candidates seemed to


understand the use of count-controlled
loops to repeat sections of an algorithm,
which was pleasing. However, the vast
majority were then unable to apply this to
nested loops, understanding that the inner
loop completes fully for each iteration of
the outer loop. The correct answer for a(i)
of 2, 3, 4 (with k remaining as 1 but p being
1 then 2 then 3) was only seen in
candidates who generally achieved highly
overall on the paper. Question part a(ii)
tests the same understanding and so
approximately the same number of
candidates understood that the given lines
would repeat 15 times in total.

ii 15 1 Accept 3 × 5

Examiner’s Comments

The majority of candidates seemed to


understand the use of count-controlled
loops to repeat sections of an algorithm,
which was pleasing. However, the vast
majority were then unable to apply this to
nested loops, understanding that the inner
loop completes fully for each iteration of
the outer loop. The correct answer for a(i)
of 2, 3, 4 (with k remaining as 1 but p being
1 then 2 then 3) was only seen in
candidates who generally achieved highly
overall on the paper. Question part a(ii)
tests the same understanding and so
approximately the same number of
candidates understood that the given lines
would repeat 15 times in total.

© OCR 2023. You may photocopy this page. 99 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

b 1 mark per bullet, max 2 2 Ignore spelling.

Sequence Do not allow examples (eg FOR loop /


Iteration / loops / repetition WHILE loop)

Examiner’s Comments

Programming constructs are defined in


section 2.2 (‘Programming techniques’) of
the specification. These are given as
sequence, selection and iteration. In the
algorithm given in the question, sequence
and iteration were both used and so
candidates were credited if they gave
either of these two answers, with loops
being accepted as an alternative to
iteration. Centres are encouraged to
ensure that all of the specification is
covered with candidates and that keywords
from the specification are highlighted in
lessons as appropriate.

© OCR 2023. You may photocopy this page. 100 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

c i 1 mark per bullet, max 2 2 Do not accept “will change” for bullet point
4.

A (name/identifier for a) memory Do not allow “holds/stores something” or


location “holds/stores information” for bullet point 2.
used to (temporarily)
holds/contains/stores data / value // is
assigned a value
that can be changed / possible to Do not accept name / identifier without
change (while the program is running) reference to a memory location. Do not
accept “a value given a name” or
equivalent.

Examiner’s Comments

This question was pleasingly answered


relatively well, perhaps because of similar
questions regarding variables and
constants in question on the previous
GCSE Computing specification. It was
pleasing how many candidates were able
to relate variables to an identifier given to a
memory location, showing a good
understanding of a basic Computer
Science concept. A mark was given quite
generously for the ability for a variable to
be ‘changed’, but candidates should be
aware that ideally their answer should
make reference to the value stored being
able to be changed, not the variable itself
changing somehow.

© OCR 2023. You may photocopy this page. 101 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

ii 1 mark per bullet, max 2 2 Ignore capitalisation.

k Correct answer only. Do not allow other


p code in answer.
m

Examiner’s Comments

There were actually three variables in use


(k, p and m) and so any two of these were
able to be given to achieve full marks. This
question was answered very well by the
majority of candidates, with most achieving
2 marks. A common incorrect answer was
to give full lines of pseudocode as the
variable, e.g. ‘m = 7’ or ‘next k’. In this case
it was impossible to decide whether the
candidate understood which part of their
response was the variable and so no mark
was given. As with question 1b(ii),
candidates should be encouraged to look
at the command word in the question (in
this case ‘identify’) and make sure that
their response is suitable.

Total 8

© OCR 2023. You may photocopy this page. 102 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

21 a i 1 mark per filled gap, max 3 3 Ignore capitalisation.

01 function librarycode(title, Allow librarycode = for 3rd mark – this is an


year) equivalent in some languages for returning
02 parta = title.substring(0, a value (eg. Visual Basic).
3)
03 partb = year.substring(2, 2)
04 return parta.upper + partb
05 endfunction
Examiner’s Comments

Responses to this question were mixed.


The majority of candidates were able to
decide on the correct passing of year as a
second parameter; this had to be
specifically year and nothing else as this
identifier was referred to later in the
algorithm.

Fewer candidates were able to correctly


decide that three characters were required
from the title; this was often not completed
as expected as subString is listed in
appendix 5f of the specification as a string
handling tool that could be used in the
examination and a full example of its use is
also given on line 03.

Even fewer candidates understood that a


function must return a value, this being the
answer to line 04. The most common
incorrect answer here was candidates
attempting to print / output the book code
rather than return it. A mark was given if
they assigned the return value to the name
of the function (e.g. librarycode =
parta.upper + partb) as this is a valid
method of returning a value in some high-
level languages such as Visual Basic.

© OCR 2023. You may photocopy this page. 103 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

ii 1 mark per bullet, max 6 6 Example algorithm

Input title and year from user title = input(“enter title”)


Open bookcodes.txt year = input (“enter year”)
Call the librarycode() function… code = librarycode(title, year)
… with the two parameters that match myFile =
input values openWrite(“bookcodes.txt”)
… write out code obtained to the text myFile.writeLine(code)
file MyFile.close()
Close text file
Note, pseudocode shown above is an
example – candidates may answer very
differently, but award marks if intention can
be seen.

Bullet points 3,4 and 5 could be done in


one line:
myFile.writeLine(librarycode(ti
tle, year))

Do not award bullet point 3 if candidate is


defining the function rather than calling it.

Allow bullet point 2 (opening text file) if


correctly referred to during write operation.

Bullet point 3 must include brackets () to


signify it is the function being called or
indication that is being called.

Examiner’s Comments

This question was answered extremely


poorly by candidates and shows a lack of
understanding of the use of functions (and
subroutines in general). Where candidates
scored highly here, it was a very good
indicator that they would score highly
across the paper as a whole.

The majority of candidates were able to


access the first mark for inputting the two
requested values. However, a significant
number did not make it clear that the value
inputted had to be stored somewhere*
(typically in a variable). Therefore although
x = input(‘enter a title’) was
OK, simply stating input(‘enter a

© OCR 2023. You may photocopy this page. 104 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

title’)was too vague to achieve the


mark. Another common misunderstanding
was that both values could be input at the
same time; a variable will only ever store
one value and so asking for both in one go
is unlikely to achieve the marks.

* Where higher ability candidates showed


an understanding of how to do this
differently, e.g. using the input value as the
argument to pass into the function, this
was of course credited by examiners.

However, the bigger misconception was


around the use of pre-existing functions.
One of the benefits of subroutines is that
code can be modularised and re-used
without requiring programmers to copy and
paste code if they require it multiple times.
Perhaps the most common student answer
for this question was to write out the code
from the function again to try to calculate
the book code. This was not what was
required from the question and shows a
fundamental lack of understanding of the
use of functions.

Marks were given for calling the existing


function, passing in the values previously
input and then writing the returned code to
the text file. The vast majority of
candidates achieved none of these marks.

Other independent marks were given for


opening and closing the text file and a
pleasing number of candidates were able
to do this successfully.

Misconception
Functions modularise code; they can be
written once and used multiple times in a
program. If a pre-written function is given
as part of a question and candidates are
told to use it, they will NOT be credited for
simply copying and pasting the code inside
the function to use; this shows a lack of
understanding.

© OCR 2023. You may photocopy this page. 105 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Exemplar 3

In the exemplar above, the candidate has


successfully input two values from the
user. They have then called the pre-
existing function librarycode() with the
values previously input as arguments (in
parenthesis). This will return a value which
is stored in the variable bookCode. The
correct text file is then opened, the
returned value is written to the text file and
then the file is closed. This response
covered everything required from the
question and so is credited with full marks
[6 out of 6].

Exemplar 4

In the exemplar above, the candidate has


successfully input two values from the
user. However, they then misunderstand
the purpose of a function and instead of
calling this, re-write out the function code.
Note that there is no call to this function,

© OCR 2023. You may photocopy this page. 106 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

which could have made it correct; the


assumption is that the candidate thinks
they must place the code here for it to run,
which is incorrect.

The candidate does gain a mark from


opening the text file but they cannot get the
mark for writing to it (as no book code was
ever calculated) and they do not close the
file. This response gained two out of six
marks and is typical of the average
candidate answer.

b i 1 mark per bullet, max 2. 2 Allow “does not” for second mark if
intention is clear (ie if it is obvious that the
“not” refers to not returning a value).
Function returns a value
Procedure does not return a value Allow discussion of how returned value in a
function can be used (e.g. to assign to a
variable or to use this returned value in
some way).

ii 1 mark per bullet, max 4. Mark in pairs. 4 Maximum of two benefits with expanstions
to be marked as per question.
e.g.

Breaks down / decomposes /


modularises the problem / program // Allow other sensible expansions.
structures the program
…making it easier to design/create/test Allow expansions which cross over to other
…each subroutine can be tested benefits (e.g. breaks down the problem / to
separately make it easier to maintain).

Reuse code (in different programs) Allow “can be called multiple times”
…quicker to develop (new) programs
…build on existing work / use of a Allow “file size is smaller”.
library of subroutines
Do not allow “more efficient” without further
Avoid repetition of code (in the same explanation.
program)
…makes program shorter / smaller
… subprogram called instead of
copying/pasting. Examiner’s Comments
… quicker to develop (new) programs
Although candidates had struggled on the
Easier to maintain previous questions to demonstrate that
…as code is easier to understand/read they could use functions, a much larger
…as code is shorter number were able to describe why
subprograms such as functions are
Easier to debug beneficial. This demonstrates that

© OCR 2023. You may photocopy this page. 107 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

…as code is shorter candidates do understand this in theory but


…same bugs will not have been copied may not perhaps have had the practical
to other areas of the program. programming time in lessons to apply this
on screen. For example, a common correct
Work can be split up in a team answer frequently given was that code did
not have to be copied and pasted multiple
…to suit developers’ skill set times but could instead be called from
…to work on different subprogram at other parts of the program, but candidates
the same time / develop separately then did exactly the opposite of this when
asked to use a function themselves.
Allows for abstraction / removes
complexity A good number of candidates were also
…subprograms can be used by able to describe other potential benefits,
programmers who do not need to such as making the code easier to
understand how they work. maintain and debug or allowing work to
split up between programmers of different
skill sets.

Centres should be aware of the command


word given in questions and match this up
to the number of marks allocated; in this
case, ‘describe’ two benefits for 4 marks
means that short single sentence answers
area unlikely to hit sufficient points on the
mark scheme to be given full marks. The
command words that will be used
consistently in examinations are shown in
appendix 5e of the specification.

Total 15

© OCR 2023. You may photocopy this page. 108 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

22 a Will loop Will not 4 1 mark per row.


infinitely loop infinitely
✓ More than one tick in a row = 0 marks for
✓ that row.

✓ Examiner’s Comments

It was thought that candidates of all


abilities would be able to attempt this
question, with iteration possibly a relatively
simple topic. Many candidates showed a
lack of understanding on this question, with
far fewer receiving full marks than perhaps
was expected. Again, perhaps candidates
have had fewer opportunities to experience
programming on screen than would be
expected. Understanding of basic
programming constructs and their
application is certainly something which
centres would do well to focus on.

b 1 mark per bullet, max 3. 3 Example algorithm

FOR loop used for i = 1 to 10


That outputs the counter variable print i
loops 10 time next

Do not accept WHILE loop for first mark,


although other marks can be accessed.

No need for next

If candidate manually increments counter


within FOR loop, do not award bullet point
3.

Accept pseudocode that suggests looping


10 times, even if this may not function
correctly in a specific language.

Examiner’s Comments

Very few candidates achieved full marks


on this question, mainly due to a lack of
understanding of what a count-controlled
loop is – this is defined by example in
appendix 5f of the specification. Many
candidates used a condition controlled
(WHILE) loop and although the condition

© OCR 2023. You may photocopy this page. 109 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

was set to be a comparison of a variable


which was incremented on every iteration,
this was still condition controlled and
therefore did not achieve the first mark.
However, where this met the requirement
of the question, the other marks were
achievable.

A FOR loop is truly count-controlled and so


was able to achieve full marks. However,
some candidates then went on to manually
increment the counter variable inside the
FOR loop which is at best not necessary
and at worst harmful to the correct
operation of the loop. These candidates did
not therefore achieve full marks.

Examiners were instructed to be generous


this time where answers were slightly
ambiguous because of the way that certain
high-level languages (such as Python)
handle count-controlled iteration. Centres
should be aware that Python is only one of
many suitable high-level languages and
that it is perhaps best practice to introduce
candidates to overall concepts before
looking at how these are implemented in
the centre’s language of choice. Where
possible, if candidates were able to use
multiple high-level languages during the
course of their learning, this would be
extremely beneficial.

Total 7

© OCR 2023. You may photocopy this page. 110 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

23 a 1 mark per bullet, to max 3 3 Accept text / varchar for string. Do not
accept character.
Do not accept number/numeric for integer
String Accept yes/no, true/false for Boolean.
Integer / Int
Boolean
Examiner’s Comments

This question was answered very well by


the majority of candidates, with most
achieving full marks. Where candidates did
fail to do well, it tended to be through a
misunderstanding of the term ‘data type’,
leading the answers such as ‘Kirstie’ or -3.

b i 1 mark per bullet, max 2 if not in correct 3 Capitalisation does not affect the mark.
order or additional statements given. Spellings of fields, tables must be correct.

SELECT StudentName Ignore brackets. Ignore quotes around


FROM conduct StudentName, Conduct or Points. Mark
WHERE Points < 0 quotes around 0 in WHERE clause as
incorrect.

StudentName must not include space

Accept <= –1 or equivalent for 3rd bullet


point.

Examiner’s Comments

Despite ‘the use of SQL to search for data’


being listed under section 2.2 of the
specification, the vast majority of candidate
answers showed a lack of understanding of
SQL in general. It was common to see
incorrect answers that attempted to use
pseudocode to respond to this and a large
number leaving this question blank. Where
candidates did use the keywords of
SELECT, FROM and WHERE answers
were much more successful. The SQL
keywords and terms that candidates are
required to know are listed in appendix 5f
of the specification.

© OCR 2023. You may photocopy this page. 111 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

ii */ star / asterisk 1 Wildcard (*) must be clearly identified as


the answer.

Do not allow any other SQL statements


alongside this unless this is given as an
example.

Examiner’s Comments

As with the previous question, where


candidates were familiar with SQL and
understood the term ‘wildcard’, this
question was answered successfully.
However, the majority of candidates did not
appear to be confident with either of these
and so gave answers more suited to
algorithm questions.

Candidates should also be encouraged to


provide answers which match the keyword
in the question; in this case ‘state’’ means
to give a specific name, value or other brief
answer without explanation. The wildcard
in question (an asterisk / * ) was
sometimes surrounded by other SQL code
and so it was impossible to tell whether the
candidate understood which part of this
was the wildcard.

A small number of candidates incorrectly


identified ‘%’ as the wildcard; although this
would be a valid wildcard in the WHERE
clause, it is not used to select all fields
from a table.

SQL coverage
Appendix 5f of the specification lists all of
the SQL keywords and wildcards that
candidates are required to understand.
This is available from http://www.ocr.org.uk

© OCR 2023. You may photocopy this page. 112 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

c 1 mark per bullet, max 4 4 Example algorithm

•     Selection(IF) used if studentdata[3] == “TRUE”


•     Comparing studentdata[3]… then
•     …with “TRUE” or “FALSE” // print “sent”
TRUE or FALSE else
•     Correct outputs (“sent” and “not print “not sent”
    sent”) end if

Bullet point 3 can only be awarded If an


attempt is made at identifying
studentdata (e.g. with the wrong index
or no index). Do not allow simply
comparing anything with True / False.

Bullet point 3 can be implicit.

Capitalisation not important.

“Sent” and “not sent” do not have to be


exactly this – can be alternative message
conveying same idea.

Examiner’s Comments

This question was generally well


answered, at least in part, by candidates of
all abilities. The use of selection (IF) is
obviously well understood and this,
together with the linked multiple outcomes
of outputting ‘sent’ or ‘not sent’ were the
most commonly credited mark points.
However, despite the question providing
very specific guidance on how to access
the array, many candidates did not even
attempt to do this.

Where the array was accessed correctly, a


common mistake was to access the wrong
element, usually index 4 rather than index
3. Arrays in questions on this specification
will always be zero based and this fact was
also given in the question by means of an
example. Candidates should be
encouraged to read all parts of a question
before beginning to attempt it.

© OCR 2023. You may photocopy this page. 113 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Exemplar 1

In the above exemplar response, the


candidate has achieved full marks by
accessing the correct element in the array
and using this to decide if the letter should
be sent.

Exemplar 2

In the above exemplar response, the


candidate has not attempted to access the
array at all, instead asking the user to input
a value; this does not do what is required
and so is only given 2 of the 4 marks (for a
valid use of selection and outputting a
message correctly).

Total 11

© OCR 2023. You may photocopy this page. 114 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

24 1 mark per bullet, max 6. 6 Example algorithm

Initialisation of A, B and C as zero.


Allows input (of anything) from the user
Incrementing A, B and C depending on acount = 0
input acount = 0
Repeats bullet points 2 and 3 bcount= 0
…stopping only when “END” is entered ccount= 0
Prints out all 3 individual counts and vote = ““
prints calculated total count while vote != “END”
vote = input(“enter A, B or
C”)
if vote == “A” then
acount = acount + 1
elseif vote == “B” then
bcount = bcount + 1
elseif vote == “C” then
ccount = ccount + 1
end if
endwhile
print acount
print bcount
print ccount
print acount+bcount+ccount

Do not penalise for missing initialisation of


variable used in the while loop or total (if
used)

Comparison with value inputted MUST be


a string (e.g. if vote == A) is incorrect
as A here is a variable, not a string.

Answer can be any recognised algorithm –


pseudocode, flowcharts, structured
English, etc. Mark on whether the bullet
points on the left hand side have been met.
Does not have to match algorithm above.

4th bullet point (repeat) can be given for


any sensible attempt at iteration.

Use professional judgement on where


loops end (WHILE / END WHILE or
indentation).

© OCR 2023. You may photocopy this page. 115 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Examiner’s Comments

This question required candidates to write


an algorithm (which could equally have
been pseudocode or a flowchart) to count
how many votes three candidates received
in an election. The essential elements of
the algorithm were given as bullet points to
help candidates to decompose the
problem.

The majority of candidates attempted to


allow the user to input their choice and
then increment a counter variable based
on this choice. However, for many
candidates, the response provided was not
logically correct and so did not achieve all
of the marks available. One typical problem
was the comparison missing the required
quotation marks (or similar) around the
literal string value, so while if vote ==
‘B’ checks the value of the variable vote
against the string ‘B’, if vote == B
instead compares two variables. Other
common issues included candidates
mixing up the left and right side of an
assignment operation (e.g. c = 1 is not
the same as 1 = c) or overwriting the
value of their counters rather than
incrementing them (e.g. a = 1 rather than
a = a + 1 or a +=1).

Many candidates stopped at this point with


relatively few even attempting to use
iteration (or other methods) to ensure that
further votes could be counted. Where this
was attempted, it was pleasing to see
candidates understanding condition
controlled loops to successfully end when
required.

The final criterion was to print the number


of votes for each candidate and the
number of votes overall. Many candidates
successfully completed the first part of this
but completely missed out even an attempt
at the second part even though it appears
to be relatively straightforward; centres
should encourage candidates to carefully
read the questions and check their

© OCR 2023. You may photocopy this page. 116 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

answers for completeness.

Examiners saw many answers which used


alternative techniques (such as storing the
vote counts in an array, or achieving
repetition by use of subprograms) and
where these were logically correct they
were able to achieve full marks.

Exemplar 6

This response gained 3 marks. The


candidate successfully takes an input from
the user and stores this in the variable
vote [1 mark]. This is then compared
against string values ‘A’, ‘B’ and ‘C’,
incrementing the appropriate value [1
mark]. The counter variables have
previously been initialised to zero [1 mark].
There is some attempt to loop on the very
last line, but this is weak and would have
the effect of re-initialising the counter
values back to zero every time and so is
incorrect. The candidate attempts to print
the three variables but misses off
outputting the total vote count (which would
have just been A+B+C).

© OCR 2023. You may photocopy this page. 117 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

Exemplar 7

This response achieved 5 marks, just 1


mark short of the maximum. The three
counter values are initialised [1 mark] and
user input successfully taken and stored in
a variable [1 mark]. This input is then
compared against A, but the lack of
quotation marks (or equivalent) around A
means that this is a variable (which has
been defined on the very first line),
meaning that the comparison being
undertaken is effectively ‘is the user input
equal to zero?’, which is incorrect.
However, there is a loop present around
the relevant instructions [1 mark] and this
does repeat until the user enters ‘END’ [1
mark] (the initial error of missing the
quotation marks on comparisons being
followed through and only penalised once),
at which point the values of A, B, C and the
total are all output [1 mark]. It is pleasing to
see that the candidate also includes some
basic input validation, although this is not
asked for in the question and so cannot be
credited.

Total 6

© OCR 2023. You may photocopy this page. 118 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

25 Sequence 1
Examiner's Comments

This question was appropriate


programming theory and techniques.

This question was answered well, with


many candidates correctly getting
sequence. Some candidates did not read
the question, and gave a response other
than the three options the question gave.

Total 1

© OCR 2023. You may photocopy this page. 119 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

26 a A location in memory 2 0 mark for “a variable that does not


change”

The value / contents cannot be 0 marks for “stays the same”


changed (whilst the program is
running) Examiner's Comments

This question was appropriate


programming theory and techniques.

This question was not answered well by


many candidates. Some candidates did not
appear to have any understanding of what
a constant was, and made a guess based
on the English definition of the word. Some
candidates did not differentiate between a
constant and a variable in their response,
saying that the value doesn't change in the
program, which could also be the case for
a variable. The better candidates were able
to correctly identify that it can't be
changed.

b Integer / Int 2 Do not allow 'need to ignore the decimal'


It is a whole number / you can't have Cannot get reason if data type incorrect
half a word
Examiner's Comments

This question was appropriate


programming theory and techniques.

This question was answered well by many


candidates, who were able to identify the
appropriate data type. Many candidates did
not know what a data type was, and gave
other responses.

© OCR 2023. You may photocopy this page. 120 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

c String (name) 2
Real / Single / Double / Currency / Examiner's Comments
Float / (Decimal) (price)
This question was appropriate
programming theory and techniques.

As with Q.4(d), where candidates knew


what a data type as, they were able to give
good responses to this question. There
was a significant number of candidates
who did not know what a data type was.
Some candidates did not fully read the
question, and gave one data type and then
a reason for it.

Total 6

© OCR 2023. You may photocopy this page. 121 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

27 1 mark per bullet 6 The output mark can only be awarded if a


reasonable attempt at adding the free
Taking the move as input spaces have been performed
Checking if array element input is free

…Outputting if it is taken
Writing “A” to the correct array element Counting how many free spaces there are
Counting how many free space there can be done by either:
are…
…Outputting the number of free Looping through each element of the
spaces (if good attempt at counting array and updating a variable if free /
free spaces) taken
Subtracting 1 each time an element is
taken (this must work, i.e. there is no
initialisation of the variable e.g. to 101,
as that would run every time and reset
the variable). If Initialisation is used,
this must be outside a loop and must
be 101.

Examiner's Comments

Candidates were required to write an


algorithm to access specific array elements
and then either keep track of the number of
taken elements, or to loop through and
count the number not taken.

Most candidates were able to take the


number as input. Few candidates had a
good understanding of arrays and how to
access specific array elements. Some
candidates attempted to keep track of the
number of spaces taken by adding 1 to a
variable each time through, but a common
mistake was to also reset this value each
time so that it was not actually keeping
track correctly.

Many candidates who tackled this question


used pseudo code and often made a better
attempt at the question. When a flow chart
was used, there was rarely any use of
arrays and accessing the array elements.

Total 6

© OCR 2023. You may photocopy this page. 122 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

28 a One piece of valid data for each of the 1 Accept any valid / reasonable data for each
fields in the user table e.g. J123, Joe, field Username, First name, Surname,
blogs, 1/4/1982 DateOfBirth

Examiner's Comments

This question was not well answered.


Candidates confused record with field, and
gave an example of a field from the table.

b i 00215 1 Correct answer only


Must have leading 0s
0 marks if any additional

Examiner's Comments

This question was answered well. Some


candidates did not read the question fully,
and gave more fields that was being asked
for.

ii 1 mark per bullet 3 Comedy must have speech marks


Ignore speech marks around 2015
Year = 2015 “ok for”
AND Spellings must be accurate
Category=“Comedy”
Examiner's Comments

The majority of candidates made a good


attempt at this question. There were often
some minor errors, such as not including
the speech marks around the string
Comedy.

Total 5

© OCR 2023. You may photocopy this page. 123 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

29 It is a foreign key 3 It must be clear that foreign key is in the


It is a Primary Key in FILM rating table.
It links to the FILM table // create a
relationship to the FILM table Examiner's Comments
To get details about the film the rating
refers to Candidates had a good attempt at this
Do not have to repeat the data / film / question, with a significant number
rating // reduces data redundancy correctly identifying that it was to identify
1 film can be given many ratings which film the rating was for. The better
candidates were then able to explain how
this was set up in the databases, correctly
referencing the primary and foreign keys. A
common error was that the candidates did
not identify which table the PK and FK was
in, or which tables were linked.

Total 3

© OCR 2023. You may photocopy this page. 124 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

30 a Lidia 1 Accept incorrect spelling if intention is


clear.

b Program finds there is no position 7 in 2 Only award bullet 1 if answer is clearly


the array / array index out of bounds about the contents of the array and not
An error will occur / an error message about the context.
would be displayed / program will crash
Do not award bullet 2 if candidate
specifically mentions syntax error.

c Example 6 If there is more than one loop, award


bullets 3 and 4 for any non-trivial loop that
contributes to the solution.

For bullet 3, “sensible” use of a loop,


requires that the loop clearly address the
problem (e.g. move every player from pos
a to b). Although candidates can get partial
marks here, candidates will only get full
marks (incl bullet 6) if all conditions of all
loops are correct.

Award marks for:

Input the number of places to move


(e.g. Num)
Use of temporary variable(s) or second
array to avoid overwriting values in the
array
Sensible use of a loop
… with correct end condition
Correctly deals with moving from
position 1 (e.g. 1 + Num)
Correctly deals with moving from
position 6 (e.g. Num)

Total 9

© OCR 2023. You may photocopy this page. 125 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

31 a radius 2
area

b i 3.142 1 Maximum of 1 mark


2
1
30

ii The number does not need to be 1 Maximum of 1 mark


changed while the program is running
The number can be updated once and
it updates throughout 1 (A01 1a)
Maximum of 1 mark

Total 4

© OCR 2023. You may photocopy this page. 126 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

32 a Reduce the size of the file. 1

Transmits more quickly / uses less 1 Accept other valid advantages to do with
bandwidth sending files, NOT storage

Examiner's Comments

This question was generally answered well


by most candidates.

b i Lossless compression 3 Explanation must follow from the type of


The code has to be exactly as it was compression given.
originally written
… or else it will not work. ?Examiner's Comments??

Middle ability candidates were largely able


to show their understanding of lossless and
lossy compression by identifying which
was to be used in the scenarios given, and
stronger candidates were able to also
justify why. It was pleasing to see
significantly better performance on this
topic than in previous sessions, suggesting
that centres have heeded to the advice
given in previous reports.

ii Lossy compression 3 ?Examiner's Comments


Achieves higher compression / smaller ??
file size / faster streaming than lossless When candidates were justifying the use of
Video can still be viewed at lower lossy compression for the large video,
quality (from the data compressed). most stated the fact that the loss of detail
was relatively inconsequential but only the
most able candidates went on to add that
in addition it provides better compression
ratios than lossless to give a full
justification.

Total 8

© OCR 2023. You may photocopy this page. 127 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

33 a i 64 + 32 + 8 + 1 2
105.

ii Answer: 10011010 2 Allow 1 mark for 01011001


(one mark per nibble if partly wrong)
Examiner's Comments
??
Candidates usually perform well at binary
conversions and continued to do so this
year which is pleasing to see. The majority
of candidates obtained full marks

b i Answer: 9 7 B 3 ?Examiner's Comments


(one mark per hex digit) ??
The majority of candidates obtained full
marks.

ii it is 4 bits per hex digit / straightforward 2 ?Examiner's Comments


to convert
shorter number to remember / quicker Some of the weaker candidates showed a
to enter / less susceptible to error. clear lack of understanding of the
importance and relevance of hex, for
example by suggest that hex requires less
memory to store than binary. In applying
their understanding to the scenario, many
candidates also gave vague answers such
as stating that numbers in hex are “easier
to understand” than their binary equivalent.

Total 9

© OCR 2023. You may photocopy this page. 128 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

34 1 kilobyte = 1024 bytes / ?1000 bytes 2 1024 × 1024 × 1024 = 1073741824.


1 gigabyte = 1024 × 1024 × 1024 bytes
/ ?1000000000 bytes. ?Examiner's Comments??

Most candidates were able to say that


1024 or 1000 bytes in a kilobyte but many
struggled with giving the number of bytes
in a gigabyte. Some of these simply failed
to read the question carefully and give the
number of megabytes in a gigabyte. In
other cases the difficulty was due in part to
attempting to calculate the answer using
pencil and paper methods. Centres should
note that we are primarily concerned with
the difference in order of magnitude
between different units, not mathematical
skills, so answers such as
1024x1024x1024 are acceptable.

Total 2

© OCR 2023. You may photocopy this page. 129 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

35 a A value that does not change (while 2 For the example do not accept the whole
the program is running) line of code; candidate should show that
eg Noise they know where the constant is.

Note that “A constant is a variable which


does not change” is a contradictory answer
(because by definition variables change)
and when candidates give a contradictory
answer award no marks.

Examiner's Comments

Given the good ability shown by


candidates to follow the algorithm in (c)
and the fact that prior to taking this
examination, candidates would have
completed the controlled assessment tasks
in A453, one would have expected
stronger answers for the definitions of
constants and variables in (a) and (b) than
those seen. Typically vague answers such
as “something that does not change” and
“something that can change” do not
demonstrate to the examiner an
understanding of the meaning of these
terms in the context of programming as
they more closely describe their everyday
meaning, and were not awarded any
marks. Some candidates stated that “a
constant is a variable which does not
change” which was considered a self-
contradictory answer. Another common
mistake was to state that constants and
variables were numbers. Also, candidates
needed to be more precise when
identifying constants and variables in the
pseudocode provided by stating the name
only. By quoting the whole line in which a
constant appears, such as “CONST noise
= 10), candidates indicate to the examiner
that they either do not know what a
constant is, or they do not know precisely
where it is in that line of code. In (c) many
candidates followed the algorithm correctly
and were awarded full marks. Weaker
candidates demonstrated a
misunderstanding of the abstractions used
and seemed distracted by alternative
possible meanings of the identifiers in the

© OCR 2023. You may photocopy this page. 130 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

question, for example by assuming that


“Net” means the ball has touched the net
and equating it to the number of goals.

b A location in memory to store / a value 2


that may change (as the program is
running)
eg Wins / Losses/ Net / Goals

c Net = 5 which is less than Noise 2 1 mark for the subtraction and result of the
Goals = 0 comparison
1 mark for correct result

Net = 15 which is greater than Noise 3 1 mark for the subtraction and result of the
Runs Loop once {Goals = Goals + 1, comparison
Net = Net ? Noise}… 1 mark for clearly indicating that the loop is
Goals = 1 executed once
1 mark for correct result

Remember to enter a total mark out of 5 for


both sections.

Total 6

36 3 1 mark per row

Examiner's Comments

This part was generally well answered,


although a large number of candidates
gave Integer as the data type for a
customer card number. Centres should
ensure that candidates understand the
difference between numerical data
(integers and real numbers), where it is the
numerical value that is significant, and data
which happens to be a string of digits and
where it is the sequence of digits rather
than their value that is significant, such as
telephone numbers, PIN codes, ID
numbers etc. In this case, an example
customer number beginning with 5 leading
zeros, was provided to alert candidates of
this issue, but this was ignored by many
candidates.

Total 3

© OCR 2023. You may photocopy this page. 131 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

37 a Allows multiple items of data to be 2 1 mark for each bullet to a maximum of 2.


stored …
under one identifier / name
Can store a table structure
Reduces need for multiple variables

b i Integer 1 Any data type that stores a whole number


only

ii It is a whole number / no decimals / to the 1


nearest minute.

c i print (hoursPlayed[0,2]) 1 Correct Answer Only

ii 1 Correct Answer Only

iii 80 1 Correct Answer Only

iv Adding all correct elements 3 1 mark per bullet to a maximum of 3.


Outputting correctly If used, a flowchart should represent the
Using a loop bulleted steps in the answer column

e.g.
total = 0
for x = 0 to 4
total = total + hoursPlayed[0,x]
next x
print (total)

© OCR 2023. You may photocopy this page. 132 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

d Appropriate declaration of a function 5 1 mark per bullet to a maximum of 5.


that takes day number as parameter
and returns day If used, a flowchart should represent the
Use of selection (if / switch) bulleted steps in the answer column.
Appropriate comparison
Correct identification of each day
Case default

e.g.

function returnDay(dayNo As String) As


String
switch dayNo
case 0:
returnDay = “Monday”
case 1:
returnDay = “Tuesday”
case 2:
returnDay = “Wednesday”
case 3:
returnDay = “Thursday”
case 4:
returnDay = “Friday”
case default:
returnDay = “Invalid”
endswitch
endfunction

e Loop 0 to 29 6 Accept any type of average calculation


Loop 0 to 4 (mean, median, mode).
Accessing hoursplayed[x,y]
Addition of hoursplayed[x,y] to total If used, a flowchart should represent the
Calculating average correctly outside bulleted steps in the answer column.
of loops
Outputting the results

e.g.
total = 0
for x = 0 to 29
for y = 0 to 4
Total = total + hoursPlayed[x,y]
next y
nextx
average = total / (30*5)
print (average)

Total 23

© OCR 2023. You may photocopy this page. 133 of 134 Created in ExamBuilder
Mark Scheme

Question Answer/Indicative content Marks Guidance

38 Taking a number as input 4 1 mark for each bullet.


Using HEX subroutine correctly
Calculating Digit 1 There are no marks associated with data
Calculating Digit 2 types or conversions of data types.

INPUT decimal If used, a flowchart should represent the


digitl = decimal DIV 16 bulleted steps in the answer column.
IF digitl>=10 THEN digit1 = HEX(digit1)
digit2 = decimal - (digit1*16)
IF digit2>=10 THEN digit2=HEX(digit2)

Total 4

39 50 2 Examiner's Comments
250.
This was generally well answered although
a few candidates lost both marks by
confusing the less than and greater than
symbols.

Total 2

40 Variable Data Type 3 Allow known equivalent names of data


types:
Gender String
Dose Real String: alphanumeric / text. Do not accept
isPregnant Boolean character but accept an array of character
or pointer to character. Real: single,
1 mark per row double, float, decimal. Do not accept
Number. Boolean: Yes / No, True / False

Total 3

© OCR 2023. You may photocopy this page. 134 of 134 Created in ExamBuilder

Powered by TCPDF (www.tcpdf.org)

You might also like