QP
QP
Do not use:
* 1 3 8 0 0 2 8 9 0 7 *
• a calculator
* J 2 7 7 0 2 *
First name(s)
Last name
INSTRUCTIONS
• Use black ink.
• Write your answer to each question in the space provided. If you need extra space use
the lined pages at the end of this booklet. The question numbers must be clearly shown.
• Answer all the questions.
INFORMATION
• The total mark for this paper is 80.
• The marks for each question are shown in brackets [ ].
• This document has 20 pages.
ADVICE
• Read each question carefully before you start your answer.
• We advise you to spend approximately 50 minutes on Section A and approximately
40 minutes on Section B.
1 Tick (✓) one box in each row to identify the programming construct where each keyword is used.
Programming construct
Keyword
Selection Iteration
if
for
while
[3]
The flowchart statements have been written for the algorithm, but the flowchart is incomplete.
Start
INPUT num
OUTPUT "Even"
End
[4]
© OCR 2024
3
3
(a) State what is meant by the term syntax error. Give one example of a syntax error in a program.
Definition ..........................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
[2]
(b) A student writes an algorithm to input two numbers and add them together to create a total.
Identify the line number of the two logic errors in the algorithm and refine the code to correct
each logic error.
Correction .........................................................................................................................................
..........................................................................................................................................................
Correction .........................................................................................................................................
..........................................................................................................................................................
[4]
1 2 5 6 7 10 20
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..................................................................................................................................................... [3]
..........................................................................................................................................................
..................................................................................................................................................... [1]
(iii) Tick (✓) one box to identify the name of the sorting algorithm that splits data into individual items
before recombining in order.
Bubble sort
Insertion sort
Merge sort
[1]
4 A program allows users to search for and watch videos. Users give a rating to the videos they watch.
(a) Identify one input and one output for the program.
Input .................................................................................................................................................
Output ..............................................................................................................................................
[2]
(b) Describe one method of defensive design that can be used when creating the program.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..................................................................................................................................................... [2]
© OCR 2024
5
5
(a) Complete the truth table for P = (A AND B) OR C
A B C P
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
[4]
B
P
[3]
message = "abcd1234"
(a) Complete the table to show the output when each statement executes.
Statement Output
print(message.length) 8
print(message.upper)
print(message.left(4))
print(int(message.right(4))*2)
[3]
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..................................................................................................................................................... [3]
© OCR 2024
7
7 Programs can be written in high-level languages or low-level languages.
(a) Give two reasons why some programs are written in a low-level language.
1 .......................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
[2]
(b) Describe the benefits of using a compiler instead of an interpreter when writing a program.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..................................................................................................................................................... [3]
p = random(1, 512)
print("The position is ", p)
a = ""
while a != "left" and a != "right"
a = input("Enter direction, left or right")
endwhile
1 .......................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[4]
© OCR 2024
9
(b) If the character moves left, 5 is subtracted from the position.
If the character moves right, 5 is added to the position.
The position of the character can only be between 1 and 512 inclusive.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
endfunction
[6]
© OCR 2024
11
SECTION B
Some questions require you to respond using either the OCR Exam Reference Language or a
high-level programming language you have studied. These are clearly shown.
9 Students take part in a sports day. The students are put into teams.
Students gain points depending on their result and the year group they are in. The points are
added to the team score.
The team with the most points at the end of the sports day wins.
(a) Data about the teams and students is stored in a sports day program.
(i) Identify the most appropriate data type for each variable used by the program.
teamName "Super-Team"
studentYearGroup 11
javelinThrow 18.2
[3]
Index 0 1 2 3 4 5
theTeam
A linear search function is used to find whether a student is in the team. The function:
function linearSearch(studentName)
return …………….….....……………
endif
next count
return False
endfunction
[4]
© OCR 2024
13
(b) This algorithm calculates the number of points a student gets for the distance they throw in the
javelin:
Complete the trace table for the algorithm when a student in year 10 throws a distance of 14.3
You may not need to use all the rows in the table.
Line
javelinThrow yearGroup score Output
number
[4]
© OCR 2024 Turn over
14
(c) The height a student jumps in the high jump needs to be input and validated.
The height is entered in centimetres (cm) and must be between 40.0 and 180.0 inclusive.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..................................................................................................................................................... [4]
Complete the table to identify an example of test data for each type of test.
Test data
Type of test Expected output
(height jumped in cm)
Normal "VALID"
Boundary "VALID"
[3]
© OCR 2024
15
(d) The individual results for each student in each event are stored in a database.
The database table TblResult stores the times of students in the 100 m race. Some of the data
is shown:
Complete the SQL statement to show the Student ID and team name of all students who are in
year group 11
FROM .............................................................................
.......................................................................................
[4]
(e) Abstraction and decomposition have been used in the design of the sports day program.
(i) Identify one way that abstraction has been used in the design of this program.
..........................................................................................................................................................
..................................................................................................................................................... [1]
(ii) Identify one way that decomposition has been used in the design of this program.
..........................................................................................................................................................
..................................................................................................................................................... [1]
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
[6]
© OCR 2024
17
BLANK PAGE
© OCR 2024
18
EXTRA ANSWER SPACE
If you need extra space use these lined pages. You must write the question numbers clearly in
the margin.
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
© OCR 2024
19
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
© OCR 2024
20
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
..................................................................................................................................................................
© OCR 2024