0% found this document useful (0 votes)
3 views36 pages

Agastya Sharma - J27702 Computational Thinking Algorithms and Programming June 2024

The document is an exam paper that includes various programming and algorithm-related questions, covering topics such as programming constructs, algorithms for determining odd/even numbers, syntax errors, binary search, and data types. It also includes tasks for flowchart completion, truth tables, logic circuits, and pseudocode writing. Additionally, it addresses concepts like defensive design, maintainability, and the use of databases in programming.

Uploaded by

10723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views36 pages

Agastya Sharma - J27702 Computational Thinking Algorithms and Programming June 2024

The document is an exam paper that includes various programming and algorithm-related questions, covering topics such as programming constructs, algorithms for determining odd/even numbers, syntax errors, binary search, and data types. It also includes tasks for flowchart completion, truth tables, logic circuits, and pseudocode writing. Additionally, it addresses concepts like defensive design, maintainability, and the use of databases in programming.

Uploaded by

10723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

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]

2 An algorithm decides if a number is odd or even.


An odd number divided by 2 will give the remainder 1.

The flowchart statements have been written for the algorithm, but the flowchart is incomplete.

Complete the flowchart.

[4]

© OCR 2025. You may photocopy this page. 1 of 36 Created in ExamBuilder


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.

If the total is between 10 and 20 inclusive, "success" is output.

If the total is not between 10 and 20 inclusive, "warning" is output.

01 num1 = input("Enter a number")


02 num2 = input("Enter a number")
03 total = num1 + num1
04 if total >= 10 then
05 print("success")
06 else
07 print("warning")
08 endif

The algorithm does not work correctly.

Identify the line number of the two logic errors in the algorithm and refine the code to correct each logic error.

Line number

Correction

Line number

Correction

[4]

© OCR 2025. You may photocopy this page. 2 of 36 Created in ExamBuilder


(c)

i. Show how a binary search will be used to find the number 10 in the following data set:

1 2 5 6 7 10 20

[3]

ii. State one pre-requisite for a binary search algorithm.

[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) A program allows users to search for and watch videos. Users give a rating to the videos they watch.

Identify one input and one output for the program.

Input

Output [2]

© OCR 2025. You may photocopy this page. 3 of 36 Created in ExamBuilder


(b) Describe one method of defensive design that can be used when creating the program.

[2]

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]

© OCR 2025. You may photocopy this page. 4 of 36 Created in ExamBuilder


(b) Draw a logic circuit for P = NOT A AND (B OR C)

[3]

6(a) The variable message is assigned a value.

message = "abcd1234"

Complete the table to show the output when each statement executes.

The first output has been completed for you.

Statement Output
print(message.length) 8
print(message.upper)
print(message.left(4))
print(int(message.right(4))*2)
[3]

© OCR 2025. You may photocopy this page. 5 of 36 Created in ExamBuilder


(b) Write an algorithm in pseudocode to:

• store "Hello" in the variable word1


• store "Everyone" in the variable word2
• concatenate word1 and word2 to store "HelloEveryone" in the variable message

[3]

7(a) Give two reasons why some programs are written in a low-level language.

[2]

(b) Describe the benefits of using a compiler instead of an interpreter when writing a program.

[3]

© OCR 2025. You may photocopy this page. 6 of 36 Created in ExamBuilder


8(a) An algorithm stores the position of a character on a straight line as an integer. A user can move the character left
or right.

The following algorithm:


• generates one random number between 1 and 512 (inclusive) to store as the position
• prompts the user to input a direction to move (left or right)
• takes a direction as input until a valid direction is input.

p = random(1, 512)

print("The position is ", p)

a = ""

while a != "left" and a != "right"

a = input("Enter direction, left or right")

endwhile

Describe two ways to improve the maintainability of the algorithm.

[4]

(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.

The function moveCharacter():


• takes the direction (left or right) and current position as parameters
• changes position based on direction
• sets position to 1 if the new position is less than 1
• sets position to 512 if the new position is greater than 512
• returns the new position.

Complete the function moveCharacter()

function moveCharacter(direction, position)

© OCR 2025. You may photocopy this page. 7 of 36 Created in ExamBuilder


endfunction
[6]

9(a) 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.

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.

Each data type must be different.

© OCR 2025. You may photocopy this page. 8 of 36 Created in ExamBuilder


Variable Example Data type

teamName "Super-Team"

studentYearGroup 11

javelinThrow 18.2

[3]

ii. The student names for a team are stored in an array with the identifier theTeam

An example of the data in this array is shown:

A linear search function is used to find whether a student is in the team. The function:

• takes a student name as a parameter


• returns True if the student name is in the array
• returns False if the student name is not in the array.

Complete the design of an algorithm for the linear search function.

function linearSearch(studentName)

for count = 0 to …………….….....……………

if theTeam[……………..…...…….………] == …………….….....…………… then

return …………….….....……………

endif

next count

return False

endfunction
[4]

© OCR 2025. You may photocopy this page. 9 of 36 Created in ExamBuilder


(b) This algorithm calculates the number of points a student gets for the distance they throw in the javelin:

01 javelinThrow = input("Enter distance")

02 yearGroup = input("Enter year group")

03 if javelinThrow >= 20.0 then

04 score = 3

05 elseif javelinThrow >= 10.0 then

06 score = 2

07 else

08 score = 1

09 endif

10 if yearGroup != 11 then

11 score = score * 2

12 endif

13 print("The score is", score)

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 number javelinThrow yearGroup score Output

© OCR 2025. You may photocopy this page. 10 of 36 Created in ExamBuilder


[4]
(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.

i. Write an algorithm to:

Each data type must be different.

• take the height jumped as input


• output "VALID" or "NOT VALID" depending on the height input.

You must use either:


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

[4]

ii. The algorithm is tested using a range of tests.

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"

Erroneous "NOT VALID"


[3]

© OCR 2025. You may photocopy this page. 11 of 36 Created in ExamBuilder


(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:

StudentID YearGroup TeamName Time


11GC1 11 Valiants 20.3
10VE1 10 Super-Team 19.7
10SM1 10 Super-Team 19.2
11JP2 11 Champions 19.65

Complete the SQL statement to show the Student ID and team name of all students who are in year group 11

SELECT StudentID, .................................................

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]

© OCR 2025. You may photocopy this page. 12 of 36 Created in ExamBuilder


(f) An algorithm works out which team has won (has the highest score).

Write an algorithm to:


• prompt the user to enter a team name and score, or to enter "stop" to stop entering new teams
• repeatedly take team names and scores as input until the user enters "stop"
• calculate which team has the highest score
• output the team name and score of the winning team in an appropriate message.

You must use either:


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

[6]

END OF QUESTION PAPER

© OCR 2025. You may photocopy this page. 13 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

1 Keyword Programming construct 3


(AO1) Examiner’s Comments
Selection Iteration
if ✓ This question was answered very well by
for ✓ the majority of candidates, showing a good
understanding of the difference between
while ✓
the key programming constructs of
selection and iteration.

Practical programming skills in lessons


should be used to make this explicit link
between technical definitions and use
within a high-level language.

Total 3

2 Correct shape for all three inputs AND 4 No need for arrows – lines are acceptable.
outputs (parallelogram) (AO2)
Correct shape for decision (diamond) BOD for correct answers that include a
True and False // Yes and No labelled loop back to the start
correctly (true/Yes linking to “Even”)
All lines joined up correctly and link to Examiner’s Comments
End.
The majority of candidates recognised the
correct flowchart shapes to be used for a
decision and many also were able to use
the parallelogram shape for inputs and
outputs. However, fewer correctly
connected up the boxes to make sure that
all paths started and ended at appropriate
points and even fewer candidates labelled
up the decision box appropriately with
True/False or Yes/No. These labels are
crucial to be able to follow the path of the
algorithm when a decision is made.

Total 4

3 a Max 1 mark for definition that is clearly 2 BOD code/program etc for BP1
different from a logic error. (AO1)
Do not allow answers linked to data types.
(an error that) breaks the
rules/grammar of the programming "incorrect grammar" by itself is NE
language
Stops the program from running // Do not allow “stop working”, "does not
does not allow program to run // work", etc – TV.
crashes the program // does not allow
program to translate Do not accept missing quotation marks
e.g. print(hello) (could be a variable
Suitable example for 1 mark, e.g. name)

misspelling key word (e.g. printt BOD given code that could cause a syntax

© OCR 2025. You may photocopy this page. 14 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

instead of print) error in a high-level language.


Missing / extra symbol (e.g. missing
bracket, missing semicolon) Examiner’s Comments
Mismatched quotes
Invalid variable or function names (e.g. This question firstly asked for a definition
variable starting with a number or of the term ‘syntax error’. Although many
including a space) candidates were correctly able to do this in
Incorrect use of operators terms of rules of the programming
Use of reserved keywords for variables language being broken, many instead
(e.g. print = 3) gave examples of issues that would cause
Incorrect capitalisation of keywords syntax errors, such as ‘where a bracket is
(e.g. Print instead of print) missing’. This would indeed cause a
Incorrect indentation (of code blocks) syntax error in many high-level languages
Missing concatenation (e.g. but is not a definition in general and so
print(score x) ) was not credited by examiners for this part
of the question.

The second part did ask for an example


and generous interpretation was asked of
examiners so that any issue that could
feasibly cause a syntax error was
awarded, such as missing brackets or
misspelling of key words. One common
misconception here involved missing
quotation marks/string delimiters around a
string, which could instead be a reference
to a variable if this was a single word.

Misconception

A syntax error is a mistake with the


rules/grammar of the programming
language that means the program will not
run/execute or compile.

Code such as print(temp) would not


necessarily be a syntax error because
temp could plausibly be a variable.

b 1 mark each 4 Allow other logical corrections that will fix


(AO3) the problem identified and does not
line 03 introduce any further errors.
total = num1 + num2
Allow descriptions of changes as long as
Line 04 clear exactly what will change. Do not
if total >= 10 and total allow ambiguous descriptions of changes
<=20 then to code.

Allow other logical equivalent code e.g. Ignore missing then from line 04.
total = int(num1) + int(num2) if
10 <= total <= 20 Ignore capitalisation.

© OCR 2025. You may photocopy this page. 15 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

Examiner’s Comments

Line 03 was commonly identified as


containing a logic error and many
candidates were able to correct this.
Where a candidate attempted to explain
what changes should be made, this was
only credited where the explanation was
unambiguous and precise.

The correction to line 04 was commonly


done incorrectly due to the need to check
multiple values.

Misconception

Where multiple values are required to be


checked in a selection statement, a line
such as :

if total >= 10 and <= 20 then

is incorrect as the second part of the


statement has nothing to compare 20
against. The first part will clearly evaluate
to true or false, but the second part is
ambiguous. Instead, candidates should be
encouraged to use :

if total >= 10 and total <= 20


then

Alternatives that work in high-level


languages would also obviously be
accepted.

Exemplar 1

Although this candidate has correctly


identified lines 03 and 04, the correction
for line 04 is incorrect due to the missing
reference to total when comparing the
upper boundary. This achieves three
marks out of four.

© OCR 2025. You may photocopy this page. 16 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

c i 1 mark each 3 BP1 can be given for generic answer. BP2


(AO2) and 3 must be linked to data set given
Compare to / pick out middle value
(which is 6) For BP2, must remove 1, 2,5 and 6 from
discard only left side // retain only right list if discussing individual numbers. Allow
side (because 6 < 10)… FT for BP3 if this done incorrectly.
… Compare to / pick out (middle value
which is) 10

ii Data must be sorted / in order 1


(AO1)

iii Merge sort 1


(AO1)

Total 11

© OCR 2025. You may photocopy this page. 17 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

4 a Input e.g. 2 1 mark for a suitable input,


(AO1) 1 mark for a suitable output
Name / keyword for video (to be
searched for) // search text Allow input / print pseudocode statements
Controls for watching video (e.g. play / if meets mark point(s). Does not have to
pause) be valid pseudocode.
Rating given to video
Do not allow examples of inputs (e.g.
Output e.g. “music videos”)

Video to be watched // audio Examiner’s Comments


Results of search
(total / overall / average) rating of Identification of inputs and outputs for a
video problem is covered in specification point
Number of views (of video) 2.1.2 and candidates are expected to be
Confirmation of data entry / data precise with their responses. Answers
validity such as ‘video’ as input are problematic
Messages to user // example because the candidate would not upload
messages (e.g “enter a rating”, “your or use a video for their input. Candidates
rating has been saved”) in quotation who were more precise and used terms
marks such as ‘name of video’ of ‘keywords
searched for’ were positively recognised
for this.

b Only 1 method asked for. Could be name 2 Allow validation / input sanitisation /
and description/example or description (AO1) passwords as expansion of anticipating
and example misuse.

Authentication Allow mark for description with no /


…checking users allowed to access incorrect name
the site / know identity of users
…by example (e.g. username and Allow any 2 points from mark scheme as
password) long as clearly linked to a single defensive
Anticipating misuse // preventing design method.
misuse
…stopping the user breaking / hacking Examiner’s Comments
into the system
…by example (e.g. restricting entry to The specification (Section 2.3.1) lists
integers) multiple ways that defensive design could
Validation be used in a program and any of these,
…check / only allow sensible data to plus other sensible options, were allowed
be entered / check data is sensible as an acceptable response. The describe
…by example (e.g. restrict ratings to 1 command word then required candidates
to 10 / presence check / format check) to add further detail to obtain a second
Input sanitisation mark, in this case by describing how it
…removing invalid/special characters could be used, either generically or as a
…by example (e.g. remove quotation specific example. Many points on the mark
marks / semicolons) scheme crossed over with each other,
Maintainability such as a validation example being a
…ensuring program is able to be sensible expansion for anticipating
understood by others misuse, and hence two marks were able to
…by example (e.g. modularisation / be obtained in multiple ways.
comments)

Total 4

© OCR 2025. You may photocopy this page. 18 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

5 a 1 mark per group of 2 rows 4 Accept True / False etc.


(AO2)

b 1 mark each 3 Max 2 if not logically correct or any


(AO3) additional / missing gates.
NOT A
B OR C Shapes of gates must be correct with
AND gate with two inputs correct number of inputs. Ignore
annotation of gate names.

NOT gate must include circle. Other gates


must not include circle.

Examiner’s Comments

Drawing logic circuits is now a commonly


asked question and candidates are
generally competent at doing this. Where
issues did arise, they tended to be missing
the circle from the NOT gate (and
therefore turning it into a buffer, not a logic
gate) or including the incorrect number of
inputs into a gate.

Key point – logic gates

Candidates are expected to be able to


draw the correct shapes for each gate. A
number of candidates labelled their gates
up, but this is not necessary; examiners
are instructed to mark the shape of each
gate and ignore any labelling.

Candidates are not allowed to take


stencils or other tools that allow them to
more easily draw these gates into an
examination unless as part of a specific
access arrangement agreed by OCR.

Total 7

© OCR 2025. You may photocopy this page. 19 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

6 a 1 mark for each output 3 Case must be correct but BOD if


(AO2) ambiguous.

print(message. ABCD1234 Allow quotation marks in answer.


upper) (upper case)
print(message. abcd (lower Examiner’s Comments
left(4)) case)
This question assessed string
print(int(mess 2468 manipulation and used OCR Exam
age.right(4))* Reference Language(ERL) to present
2) each statement. This highlights the
importance of candidates being taught
how to interpret ERL as questions in the
exam will be written in this format.

Candidates were generally confident with


the use of .upper and .left(). Candidates
were less confident when this was
combined with casting in the last part.

© OCR 2025. You may photocopy this page. 20 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

b 1 mark per bullet point : 3 Accept & / + / . etc as valid methods of


(AO3) concatenation. Allow use of sensible
storing both strings correctly in word1 concatenation functions e.g. concat() . Do
and word2 not allow commas.
correct concatenation (word1 then
word2)… Do not allow == for assigning value to
…storing in variable message string. Do not allow spaces in variable
names. Penalise once then FT.
Example
word1 = "Hello" Ignore additional code given. Ignore case.
word2 = "Everyone"
message = word1 + word2 Reasonable attempt at BP2 needed to
access BP3.

Examiner’s Comments

This question was intended to be


straightforward and aimed at all
candidates, including those expecting to
achieve lower grades. However, a
significant number of candidates dropped
marks, either through perhaps not reading
the question requirements or through not
understanding the term concatenation.

There is no requirement in the question to


print out the message obtained, simply to
store it in the variable message. Where
this was done in addition, this was not
penalised but often it was done instead of
storing the concatenated message.

A common mistake was to use the comma


for concatenation when in most high-level
languages (and especially Python), this is
simply used to print out two items or pass
two arguments to a subroutine and not
actually concatenate values. Another
common mistake was with the names of
the variables given – if these included
spaces or differed from those given in the
question (such as word 1, wordone or
world1 instead of word1) examiners
were instructed to not allow these
alternatives.

Total 6

© OCR 2025. You may photocopy this page. 21 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

7 a 1 mark each to max 2 2 "More efficient" by itself is TV.


(AO1)
(machine code) does not need to be Mark first answer on each line.
translated / compiled / interpreted
Direct control of hardware / memory BP6 relates to Assembly language being a
Faster execution time one-to-one direct mapping to machine
Code can be optimised / shorter code / code.
use less memory
Can program for specific hardware Examiner’s Comments
Assembly language is fast to translate.
These questions assessed understanding
of low-level languages and the use of
compilers to translate from high-level
code. Many candidates were able to do
this well and clearly understood the need
for high-level languages to be translated
into machine code before the processor
can execute this. The questions, however,
did not ask just for this but specifically
asked for reasons and benefits. Where
candidates left their response as simply a
discussion of the difference between high-
level and low-level code or between
translators and compilers, it was difficult
for examiners to award marks.

Better responses were able to give clear


reasons for the use of low-level code
(such as direct control of hardware and
faster execution of code) and the benefits
of using a compiler instead of an
interpreter (such as being able to distribute
an executable file with no access to
source code and not needing to translate
code again once this has been done).

© OCR 2025. You may photocopy this page. 22 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

b 1 mark each to max 3 3 Allow in reverse (e.g. “interpreter


(AO1) translates every time”)
Can produce an executable file
program/code runs/executes faster Do not allow "no access to source code"
(than interpreted version) unless clearly talking about end user.
end users do not need translator Allow if in context of distribution.
Can be run again/multiple times
without re-translating // only needs to Do not allow descriptions of how a
translate once compiler translates (e.g. "translates whole
End users have no access to source code in one go")
code // distributed with no source
code… “Faster / quicker” by itself is TV
…cannot steal/copy/modify
code/program Examiner’s Comments
Shows all/multiple errors // shows
errors at the end (of compilation) // These questions assessed understanding
creates error file of low-level languages and the use of
Compiler can optimise the code compilers to translate from high-level
code. Many candidates were able to do
this well and clearly understood the need
for high-level languages to be translated
into machine code before the processor
can execute this. The questions, however,
did not ask just for this but specifically
asked for reasons and benefits. Where
candidates left their response as simply a
discussion of the difference between high-
level and low-level code or between
translators and compilers, it was difficult
for examiners to award marks.

Better responses were able to give clear


reasons for the use of low-level code
(such as direct control of hardware and
faster execution of code) and the benefits
of using a compiler instead of an
interpreter (such as being able to distribute
an executable file with no access to
source code and not needing to translate
code again once this has been done).

Total 5

© OCR 2025. You may photocopy this page. 23 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

8 a 2 marks max per group 4 Do not accept "what variables do" –


(AO2) incorrect verb, variables store/hold data.
Meaningful identifiers // meaningful
variable names BOD notes (and alternatives) for
…to describe/show what they store // comments. Do not allow instructions.
purpose of variable
An example of a meaningful variable Do not allow indentation (already done in
identifier for this algorithm program given)
Comments
…to make it easier for other Allow whitespace / blank lines (same
programmers to follow / understand expansions as comments)
(part of) the code // explains what the
code does // easier to debug Do not award expansion without being
An example of a suitable comment for clear which method is being discussed.
this algorithm “Makes it easier to understand” by itself is
Use of subroutines TV.
…to reuse blocks of code // make
code easier to follow Examiner’s Comments
An example of a subroutine for this
algorithm It was pleasing that the majority of
Use of constants candidates understood the term
…to store data that will not change maintainability and were able to suggest
(during program execution) // so data suitable improvements on a generic level,
can be changed in one place only such as improving the naming of variables
An example of a constant for this and adding comments. Better responses
algorithm (e.g. store 512 as a that achieved full marks were able to apply
constant) this to the code given, such as suggesting
more suitable variable names.

Candidates who suggested adding


indentation were not credited with marks
as this has clearly already been done in
the code given and thus would not be an
improvement.

Key point – generic versus. context driven


responses

Where a question gives a context or


scenario (such as data or a program being
given), it is important that candidates refer
to this context in their response if they are
hoping to achieve full marks. For this
question, the question text was:

‘Describe two ways to improve the


maintainability of this algorithm’

This is a very different question from


‘Describe two ways to improve the
maintainability of an algorithm’ where a
generic response would suffice.

© OCR 2025. You may photocopy this page. 24 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

b 1 mark each to max 6 6 Allow else for BP3/4 (validated in


(AO3) question 8a)
Appropriate use of both parameters
and no additional inputs / incorrect Allow <=, >= and equivalents (e.g. <= 0)
overwrites that affect outcome of for BP5.
algorithm
Attempt at selection… Do not award BP5 if before BP3 and 4
…correctly checking if direction is (otherwise will alter position value)
"left" and subtracting 5 from
position (or equivalent) BP6 only to be given if attempt made at
…correctly checking if direction is calculating new position. Calculation can
"right" and adding 5 to position (or be partial/incorrect.
equivalent)
Ensuring position (or equivalent) is Ignore repeat of function header / end.
between 1 and 512 inclusive
Returning the updated position Accept flowchart / structured English but
must not just repeat the question.
Example
if direction == "left" then If response uses loop to incorrectly
position = position - 5 change position multiple times, do not
elseif direction == "right" award BP1 (incorrect overwrite)
then
position = position + 5 For minor syntax errors (e.g. missing
endif quotation marks or == for assignment,
spaces in variable names) penalise once
if position < 1 then then FT.
position = 1
elseif position > 512 then Examiner’s Comments
position = 512
endif This question was an excellent
discriminator in terms of candidate
return position achievement. In particular, correct use of
the given parameters (direction and
position) was only seen from the most
successful candidates. Many candidates
instead started their response by asking
for input from the user and therefore
overwriting the parameters, losing crucial
marks in the process.

As on previous papers, this question


provided one mark for any attempt made
at a section of the requirement, in this
case selection. Candidates who attempted
to use an if or select case statement,
even incorrectly or in the wrong context
were able to achieve at least this mark;
centres should therefore continue to
encourage all candidates to attempt each
and every question and not leave
responses blank.

It was challenging to achieve full marks,


but many candidates did because of their
excellent levels of practical programming

© OCR 2025. You may photocopy this page. 25 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

experience in school.

Exemplar 2

This candidate achieved full marks. The


given parameters (direction and position)
are both used and not overwritten by
inputs before the position is modified
depending on the direction given. The
position is then validated to make sure that
it is between 1 and 512 before being
returned.

Note the use of position +=5 to add 5


to the position. This is an entirely
acceptable alternative to position =
position + 5

Total 10

© OCR 2025. You may photocopy this page. 26 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

9 a i String 3 Accept alternative equivalent correct data


Integer (AO3) types (e.g. single/double/decimal for BP3)
Real / Float
Do not accept char for BP1

Examiner’s Comments

This question was completed very well by


the vast majority of candidates, showing
that the use of data types are now well
understood by centres.

ii theTeam.length() - 1 // 5 4 Accept 6 // theTeam.length() for BP1


count (AO3) (Python).
studentName
True Accept alternative length functions e.g.
len()

Accept count = 5 (and equivalents) for


BP1. Accept "True" for BP4.

Do not allow obvious spaces in variable


names.

Ignore capitalisation.

Examiner’s Comments

This was a challenging question revolving


around the use of an array that is iterated
through to implement a linear search.
Many candidates achieved two marks for
the first and last points, understanding that
the loop would repeat from indexes 0 to 5
and that the value True would be returned
if the item was found. As usual, allowance
was given for off-by-one errors with this
loop because of the prevalence of Python
in centres and how loops are count
controlled loops are handled in this
language.

It was far less common for candidates to


achieve the middle two marks, perhaps
because the level of technical knowledge
needed was greater. A number of
candidates attempted here to fashion a 2D
array and refer to multiple indexes, but this
was not appropriate given the data
structure given. The most challenging
mark was certainly the use of count as
the index of the theTeam array, with very
few candidates correctly identifying this as
the missing element.

© OCR 2025. You may photocopy this page. 27 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

Assessment for learning

Centres are encouraged to link the topics


of arrays (both single and two-
dimensional) to count controlled loops to
be confident in answering questions like
this one.

A very common programming exercise is


to iterate through every item in an array,
either to search for an item, count or add
items or as the pre-cursor for a search.
Candidates are expected to have
significant practical programming
experience over the duration of their
studies.

© OCR 2025. You may photocopy this page. 28 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

b javelinThrow set to 14.3 on line 01 4 Max 3 if in wrong order or additional


and yearGroup set to 10 on line 02 (AO3) (incorrect) changes. Penalise line numbers
score set to 2 on line 06 once then FT.
score set to 4 on line 11
"The score is 4" output on line 13 with Allow FT for BP4 for current value of
no additional outputs (allow input score.
statements)
BP4 must not include comma. Ignore
Example superfluous spaces. Ignore quotation
marks.

Treat any entry in output column as an


output, even if "x", "-" or "0".

Examiner’s Comments

Answer may include lines where no Trace tables have appeared multiple times
changes or output happens (i.e. lines 3, 4, in J277 examination papers now and
5, 7, 8, 9, 10, 12). candidates are hopefully familiar with the
expectations, which are consistent across
Where variable doesn't change, current series.
value may be repeated on subsequent
lines. Most candidates correctly traced through
the given algorithm, which was more
accessible than usual due to not
containing any loops. Where mistakes
were made, this was typically to do with
either incorrect line numbers being given
for each change (this was penalised once
only and then subsequent mistakes with
line numbers followed through) or
additional incorrect output being given.

Candidates should be encouraged to


simply leave boxes blank if no output is
given on a particular line. If (for example)
‘x’ is written, examiners are unsure
whether the candidate meant no output or
the letter ‘x’ should be output. This
ambiguity would mean that no mark could
be given.

c i inputs a value from the user and 4 Answers using AND/OR for BP2 and BP3
stores/uses (AO3) must be logically correct e.g. if height
checks min value (>= 40.0 // < 40) >=40 and height <=180. Do not
checks max value (<=180.0 // > 180) accept if height >=40 and <=180
…outputs both valid / not valid
correctly based on checks Answers using OR will reverse output for
BP4 (see examples).
Example 1 (checking for valid input)
h = input("Enter height BP4 needs reasonable attempt at either
jumped") BP2 or BP3. Need to be sure what is
if h >= 40 and h <= 180 then being checked to be able to decide which
print("valid") way around valid/invalid should be.
else

© OCR 2025. You may photocopy this page. 29 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

print("not valid") Allow FT for BP4 if reasonable attempt at


endif validating (must include at least one
boundary)
Example 2 (checking for invalid input)
h = input("Enter height Ignore conversion to int on input. input
jumped") cannot be used as a variable name.
if h < 40 or h > 180 then
print("not valid") Greater than / less than symbols must be
else appropriate for a high-level language /
print("valid") ERL. Do not accept => (wrong way
endif around) or > (not available on keyboard).
No obvious spaces in variable names.
Penalise once and then FT.

Examiner’s Comments

This question was done very well by the


majority of candidates, with multiple ways
of achieving the marks possible.

One common problem was consistent with


Question 3 (b), as again multiple
conditions could be evaluated using a
single if statement. Candidates needed
to refer to their input value for each
comparison if they were to achieve full
marks. Another common problem was with
the boundaries used; the tests must check
40 to 80 inclusive (for valid response) to
be marked as correct. Obviously, if an
input on these boundaries would produce
the wrong output then full marks could not
be given.

One final common problem involved the


use of greater than or equal to signs (and
also less than or equal to). The common
signs used in mathematics are not
available on a typical keyboard and so
would not be allowed in Section B of this
paper. Instead, >= or <= should be used,
and these should be the correct way
around.

ii Any normal value (between 40 and 3 No need to include decimals, e.g. accept
180 inclusive) (AO3) 50. Ignore cm if given.
40.0 // 180.0
Any value less then 40 // any value Answer must be actual data (e.g. 50) and
greater that 180 // any non-numeric not description of data (e.g. "a value
value between 40 and 180"). If descriptions
given, do not accept this as non-numeric
for BP3

© OCR 2025. You may photocopy this page. 30 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

d TeamName only in first space 4 Max 3 if not in correct order / includes


TblResult in second space (AO3) other logical errors.
WHERE
…YearGroup = 11 Ignore capitals.
Do not accept * or additional fields for BP1

Spelling must be accurate (e.g. not


TblResults).

No spaces in field names, penalise


obvious spaces once and then FT.
Allow quotation marks around field names,
table name and 11

Accept == for BP4 (invalid SQL but works


in some environments)

Examiner’s Comments

A number of candidates struggled with this


question. Problems included spaces in
field names, misspelling of the table name
(such as TblResults plural when
TblResult singular was given) or
misunderstanding of the WHERE clause.

Allowance was given where == was used


for comparison and examiners were
instructed to allow this (as this is used for
comparison in high-level languages such
as Python), although this is incorrect as
defined in the most recent ANSI SQL
standards.

© OCR 2025. You may photocopy this page. 31 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

e i any example of simplification / 1 Must be applicable to this program (in the


removing data or focussing on data (in (AO3) context of students and a sports day), not
the design) a generic description of what abstraction
is. Give BOD where this is unclear.
Examples :
- “focus on student names and events” Examiner’s Comments
- “ignore data such as students’ favourite
subjects” Both questions here asked about
- “store year groups instead of ages or abstraction and decomposition of the
DOB” sports day program. As explained
- “shows student IDs instead of full student previously in this report, where a scenario
details” or context is given, candidates are
expected to use this context. No marks
were given by examiners for generic
definitions of what the term abstraction or
decomposition means.

Abstraction in the sports day program


could have been for focusing on anything
sensible (such as event names) or
removing/ignoring anything sensible (such
as showing student IDs instead of names).
Where the context of the sports day was
used, candidates were generally
successful in achieving this mark.

Decomposition use was more tricky to


correctly identify, as many candidates
simply referred to how already separate
data was stored. Where this extended to
true decomposition (such as breaking
down data into multiple tables, splitting up
event data, etc.) this was credited but the
average candidate fell short here. A much
more successful approach was to discuss
the decomposition of the program, such as
having a separate algorithm for each
event. Candidates attempting this angle of
response did very well.

Examiners were instructed for both


questions to be generous in deciding
whether candidates had indeed referred to
the sports day context.

ii any example of breaking down the 1 Must be applicable to this program, not a
program into sections/subroutines (AO3) generic description of what decomposition
any example of breaking down the is. Give BOD where this is unclear.
database into tables
Do not give answers discussing splitting
Examples : into fields (e.g. split into StudentID,
- “splits the program up into different YearGroup, etc).
events”
- “separates the validation routines into BOD if answer discusses one table but
subroutines” suggests other tables could be used.

© OCR 2025. You may photocopy this page. 32 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

- “breaks the database down into a table


per event” Do not give answers relating simply to
data being split into smaller groups unless
this clearly relates to how data is
decomposed into tables in the DB.

Allow reference to sports day to mean


sports day program.

Examiner’s Comments

Both questions here asked about


abstraction and decomposition of the
sports day program. As explained
previously in this report, where a scenario
or context is given, candidates are
expected to use this context. No marks
were given by examiners for generic
definitions of what the term abstraction or
decomposition means.

Abstraction in the sports day program


could have been for focusing on anything
sensible (such as event names) or
removing/ignoring anything sensible (such
as showing student IDs instead of names).
Where the context of the sports day was
used, candidates were generally
successful in achieving this mark.

Decomposition use was more tricky to


correctly identify, as many candidates
simply referred to how already separate
data was stored. Where this extended to
true decomposition (such as breaking
down data into multiple tables, splitting up
event data, etc.) this was credited but the
average candidate fell short here. A much
more successful approach was to discuss
the decomposition of the program, such as
having a separate algorithm for each
event. Candidates attempting this angle of
response did very well.

Examiners were instructed for both


questions to be generous in deciding
whether candidates had indeed referred to
the sports day context.

© OCR 2025. You may photocopy this page. 33 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

f Input team name AND score and store 6 For BP3, allow "stop" to be entered for
/ use separately (AO3) either team name or score (or both). Allow
Attempt at using iteration… third input (e.g. "do you wish to stop?")
…to enter team/score until "stop"
entered Allow use of break (or equivalent) to exit
Calculates highest score loop for BP3.
Calculates winning team name…
…Outputs highest score and team Allow use of recursive function(s) for
name BP2/3.

Example 1 Initialisation of variables not needed -


highscore = 0 assume variables are 0 or empty string if
while team != "stop" not set.
team = input("enter team
name") Ignore that multiple teams could get the
score = input("enter score") same high score, assume only one team
if score > highscore then has the highest score.
highscore = score
highteam = team BP4/5 could be done in many ways – see
endif examples. Allow any logically valid
endwhile method. Allow use of max/sum functions
print(highscore) and use of arrays/lists.
print(highteam)
FT for BP6 if attempt made at calculating
Example 2 (alternative) highest score/name
scores = []
teams = [] If answer simply asks for multiple entries
while team != "stop" (not using iteration), BP2 and 3 cannot be
team = input("enter team accessed but all others available.
name")
score = input("enter score") For minor syntax errors (e.g. missing
scores.append(score) quotation marks or == for assignment,
teams.append(team) spaces in variable names) penalise once
endwhile then FT.
highscore = max[scores]
highteam = input cannot be used as a variable
teams[scores.index(highscore)] name.
print(highscore)
print(highteam) Examiner’s Comments

The final question in Section B is expected


to be challenging and this proved to be the
case, although again was perhaps more
accessible than previous papers' final
questions.

Marks were available for inputs (one mark)


and correctly iterating over as required
(two marks), with these three marks
proving to be the easiest to achieve. The
next three marks required significant
processing in terms of calculating the
highest score and team name from
multiple values entered by the user. The
vast majority of candidates simply kept a

© OCR 2025. You may photocopy this page. 34 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

running ‘highest score’ and updated this


on each iteration. Where this was
attempted, it was mostly successful. Other
candidates attempted more complex
solutions, including adding data to arrays
and then calculating highest values; where
this was done successfully, this of course
achieved full marks but frequently small
logic mistakes meant that not all marks
were given. Centres should encourage
candidates to keep their responses simple
and not produce over-elaborate solutions if
a simpler alternative is available.

A common mistake was where candidates


attempted to use loops in the style of for
x in list : . In this case, the variable x
is a reference to an item in the array and
not an index. It would therefore not be
appropriate to try to access list[x] later
in the code.

A significant number of candidates were


able to create a solution that fully met the
requirements of the question, doing so in
an elegant and efficient manner. This is
extremely pleasing and show excellent
understanding, produced from excellent
teaching and significant amounts of
practical programming experience.

Exemplar 3

The candidate response shown here


achieved six out of six marks. Both the
name and score are input as required,
with this being inside a while loop.
Perhaps unconventionally (but
acceptably), the candidate has used a
break command to end the loop (which
otherwise is infinite) upon stop being
entered. This could have been more

© OCR 2025. You may photocopy this page. 35 of 36 Created in ExamBuilder


Mark Scheme

Question Answer/Indicative content Marks Guidance

elegantly rewritten as while name !=


‘stop’ but this would not have achieved
any further marks.

Within the loop, the candidate uses two


variables to keep track of the current
highest score and associated team, before
printing these out in a message once the
loop has ended.

Total 30

© OCR 2025. You may photocopy this page. 36 of 36 Created in ExamBuilder

Powered by TCPDF (www.tcpdf.org)

You might also like