ExamBuilder Programming-1
ExamBuilder Programming-1
switch newstate:
statevalue = 1
statevalue = 2
statevalue = 3
default:
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]
[1]
[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.
[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.
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.
venditem()
giveChange(money – price)
else
endif
[1]
(ii) State how many parameters are passed into the giveChange() subroutine.
[1]
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.
© 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:
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.
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()
endif
.........................
procedure accessData()
endif
endif
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.
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.
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.
FROM tblStock
FROM table
FROM database
[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.
[5]
[2]
© OCR 2023. You may photocopy this page. 14 of 134 Created in ExamBuilder
(iii) Write a program that:
© 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.
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.
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 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.
[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)
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]
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]
[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.
© 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.
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]
© 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.
© 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.
[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.
[2]
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.
The following pseudocode algorithm takes a string of uppercase letters as input and uses the Caesar cipher
to encrypt them.
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)
(iii) The algorithm needs adapting. An extra line (line 12) is needed to output the encrypted message.
[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]
[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)
[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.
© OCR 2023. You may photocopy this page. 35 of 134 Created in ExamBuilder
(ii) Use pseudocode to write an algorithm that does the following :
[6]
© OCR 2023. You may photocopy this page. 36 of 134 Created in ExamBuilder
(b) Functions and procedures are both examples of sub programs.
[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.
© 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.
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:
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.
© 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;
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.
[1]
[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;
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]
© 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
[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 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).
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:
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 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).
Fig. 1
[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”.
[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:
[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.
[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.
[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.
Type of
compression
Explanation
[3]
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]
[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 …
(i) When the number is converted into hexadecimal, the first two digits are 8F as shown below.
[3]
[2]
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.
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.
[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.
For example, student 1, on Monday (day 0), played 30 minutes of computer games.
[2]
(b)
(i) Identify a data type that could be used to store the number of minutes in this array.
[1]
[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])
(i) Write the code to output the number of minutes student 0 played computer games on Wednesday.
[1]
print (hoursPlayed[2,1])
[1]
[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.
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 = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[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.
© 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.
© OCR 2023. You may photocopy this page. 67 of 134 Created in ExamBuilder
Mark Scheme
e.g.
newstate = input("Enter the new state : ")
statevalue = 1
statevalue = 2
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
© OCR 2023. You may photocopy this page. 68 of 134 Created in ExamBuilder
Mark Scheme
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
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
Examiner’s Comments
Question (c) asked candidates to write an
algorithm to:
© OCR 2023. You may photocopy this page. 70 of 134 Created in ExamBuilder
Mark Scheme
AfL
Total 6
© OCR 2023. You may photocopy this page. 71 of 134 Created in ExamBuilder
Mark Scheme
AO2
1b(1)
Total 2
Misconception
Total 4
© OCR 2023. You may photocopy this page. 72 of 134 Created in ExamBuilder
Mark Scheme
Misconception
© OCR 2023. You may photocopy this page. 73 of 134 Created in ExamBuilder
Mark Scheme
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.
© OCR 2023. You may photocopy this page. 74 of 134 Created in ExamBuilder
Mark Scheme
ii Comments 1
Use of constants
AO2
1b(1)
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
Total 14
© OCR 2023. You may photocopy this page. 75 of 134 Created in ExamBuilder
Mark Scheme
procedure storeData()
endif
store data in next free space in H/RAM
F/endprocedure
procedure accessData()
endif
move required data from HD to RAM
endif
read data from H/RAM
endprocedure
Total 6
Total 2
© OCR 2023. You may photocopy this page. 76 of 134 Created in ExamBuilder
Mark Scheme
Total 3
Total 2
© OCR 2023. You may photocopy this page. 77 of 134 Created in ExamBuilder
Mark Scheme
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
© OCR 2023. You may photocopy this page. 78 of 134 Created in ExamBuilder
Mark Scheme
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
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. π
Total 11
© OCR 2023. You may photocopy this page. 80 of 134 Created in ExamBuilder
Mark Scheme
Real (1)…
Total 7
© OCR 2023. You may photocopy this page. 81 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
Total 3
© OCR 2023. You may photocopy this page. 82 of 134 Created in ExamBuilder
Mark Scheme
Total 1
© OCR 2023. You may photocopy this page. 83 of 134 Created in ExamBuilder
Mark Scheme
example algorithm
function ticketprice(numadult,
numchild)
price = (numadult * 19.99) +
(numchild * 8.99) + 2.50
return price
end function
Examiner’s Comments
© OCR 2023. You may photocopy this page. 84 of 134 Created in ExamBuilder
Mark Scheme
Misconception
Exemplar 3
Exemplar 4
© OCR 2023. You may photocopy this page. 85 of 134 Created in ExamBuilder
Mark Scheme
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.
© OCR 2023. You may photocopy this page. 86 of 134 Created in ExamBuilder
Mark Scheme
Misconception
Exemplar 5
© OCR 2023. You may photocopy this page. 87 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
© OCR 2023. You may photocopy this page. 88 of 134 Created in ExamBuilder
Mark Scheme
© OCR 2023. You may photocopy this page. 89 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
© OCR 2023. You may photocopy this page. 90 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
© OCR 2023. You may photocopy this page. 91 of 134 Created in ExamBuilder
Mark Scheme
© OCR 2023. You may photocopy this page. 92 of 134 Created in ExamBuilder
Mark Scheme
Exemplar 6
Total 24
© OCR 2023. You may photocopy this page. 93 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
Total 2
© OCR 2023. You may photocopy this page. 94 of 134 Created in ExamBuilder
Mark Scheme
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.
© OCR 2023. You may photocopy this page. 95 of 134 Created in ExamBuilder
Mark Scheme
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
Examiner’s Comments
Total 8
© OCR 2023. You may photocopy this page. 96 of 134 Created in ExamBuilder
Mark Scheme
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.
Examiner’s Comments
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
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
Total 4
© OCR 2023. You may photocopy this page. 98 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
ii 15 1 Accept 3 × 5
Examiner’s Comments
© OCR 2023. You may photocopy this page. 99 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
© OCR 2023. You may photocopy this page. 100 of 134 Created in ExamBuilder
Mark Scheme
c i 1 mark per bullet, max 2 2 Do not accept “will change” for bullet point
4.
Examiner’s Comments
© OCR 2023. You may photocopy this page. 101 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
Total 8
© OCR 2023. You may photocopy this page. 102 of 134 Created in ExamBuilder
Mark Scheme
© OCR 2023. You may photocopy this page. 103 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
© OCR 2023. You may photocopy this page. 104 of 134 Created in ExamBuilder
Mark Scheme
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
Exemplar 3
Exemplar 4
© OCR 2023. You may photocopy this page. 106 of 134 Created in ExamBuilder
Mark Scheme
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.
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
Total 15
© OCR 2023. You may photocopy this page. 108 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
© OCR 2023. You may photocopy this page. 109 of 134 Created in ExamBuilder
Mark Scheme
Total 7
© OCR 2023. You may photocopy this page. 110 of 134 Created in ExamBuilder
Mark Scheme
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
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.
Examiner’s Comments
© OCR 2023. You may photocopy this page. 111 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
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
Examiner’s Comments
© OCR 2023. You may photocopy this page. 113 of 134 Created in ExamBuilder
Mark Scheme
Exemplar 1
Exemplar 2
Total 11
© OCR 2023. You may photocopy this page. 114 of 134 Created in ExamBuilder
Mark Scheme
© OCR 2023. You may photocopy this page. 115 of 134 Created in ExamBuilder
Mark Scheme
Examiner’s Comments
© OCR 2023. You may photocopy this page. 116 of 134 Created in ExamBuilder
Mark Scheme
Exemplar 6
© OCR 2023. You may photocopy this page. 117 of 134 Created in ExamBuilder
Mark Scheme
Exemplar 7
Total 6
© OCR 2023. You may photocopy this page. 118 of 134 Created in ExamBuilder
Mark Scheme
25 Sequence 1
Examiner's Comments
Total 1
© OCR 2023. You may photocopy this page. 119 of 134 Created in ExamBuilder
Mark Scheme
© OCR 2023. You may photocopy this page. 120 of 134 Created in ExamBuilder
Mark Scheme
c String (name) 2
Real / Single / Double / Currency / Examiner's Comments
Float / (Decimal) (price)
This question was appropriate
programming theory and techniques.
Total 6
© OCR 2023. You may photocopy this page. 121 of 134 Created in ExamBuilder
Mark Scheme
Examiner's Comments
Total 6
© OCR 2023. You may photocopy this page. 122 of 134 Created in ExamBuilder
Mark Scheme
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
Examiner's Comments
Total 5
© OCR 2023. You may photocopy this page. 123 of 134 Created in ExamBuilder
Mark Scheme
Total 3
© OCR 2023. You may photocopy this page. 124 of 134 Created in ExamBuilder
Mark Scheme
Total 9
© OCR 2023. You may photocopy this page. 125 of 134 Created in ExamBuilder
Mark Scheme
31 a radius 2
area
Total 4
© OCR 2023. You may photocopy this page. 126 of 134 Created in ExamBuilder
Mark Scheme
Transmits more quickly / uses less 1 Accept other valid advantages to do with
bandwidth sending files, NOT storage
Examiner's Comments
Total 8
© OCR 2023. You may photocopy this page. 127 of 134 Created in ExamBuilder
Mark Scheme
33 a i 64 + 32 + 8 + 1 2
105.
Total 9
© OCR 2023. You may photocopy this page. 128 of 134 Created in ExamBuilder
Mark Scheme
Total 2
© OCR 2023. You may photocopy this page. 129 of 134 Created in ExamBuilder
Mark Scheme
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.
Examiner's Comments
© OCR 2023. You may photocopy this page. 130 of 134 Created in ExamBuilder
Mark Scheme
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
Total 6
Examiner's Comments
Total 3
© OCR 2023. You may photocopy this page. 131 of 134 Created in ExamBuilder
Mark Scheme
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
e.g.
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
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
Total 3
© OCR 2023. You may photocopy this page. 134 of 134 Created in ExamBuilder