0% found this document useful (0 votes)
834 views24 pages

Question Paper Practice 2023 (J27702)

Uploaded by

sykeszain
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)
834 views24 pages

Question Paper Practice 2023 (J27702)

Uploaded by

sykeszain
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/ 24

Practice Paper 2023

GCSE (9–1) Computer Science


J277/02 Computational thinking, algorithms and programming
Time allowed: 1 hour 30 minutes

Do not use:
• a calculator

Please write clearly in black ink. Do not write in the barcodes.

Centre number Candidate number

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 24 pages.

ADVICE
• Read each question carefully before you start to answer.
• We advise you to spend approximately 50 minutes on Section A and approximately 40
minutes on Section B.

© OCR 2023 OCR is an exempt Charity Turn over


1 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

THIS PAGE IS BLANK

PLEASE DO NOT WRITE ON THIS PAGE

2 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

SECTION A
We advise you to spend approximately 50 minutes on Section A.

1 Tick (✓) one box in each row to identify if each operator is a comparison operator or an
arithmetic operator.

Operator Comparison Arithmetic


==
+
DIV
>

[4]

2 Give the output of each algorithm.

(a) temp = 7

if temp < 10 then

print(temp)

endif

……..……..…………………………………….…………………………………………….………….. [1]

(b) value = 3

value = value - 1

print(value * 2)

……...…………………………………………………..…………………………………….………….. [1]

(c) scores = [3, 6, 6, 9, 2, 8]

number = scores[2]

print(number)

……..……………………………………..….……………………………………………….………….. [1]

Turn over
3 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(d) day = "Monday"

x = day.length

print(x)

……..…….….………………..………………………………………….………………….……….….. [1]

3 An array stores a collection of words. The array has the identifier data.

data = ["or", "and", "it", "when", "and", "or", "and", "it"]

A searching algorithm is used to find a word in the array data. The algorithm used to search for
a word is shown.

word = input("Enter a word to find")


found = False
for i = 0 to 7
if data[i] == word then
found = True
endif
next i
print(found)

(a) State the name of this searching algorithm.

….…..…………………………………………………………………………………….……………… [1]

4 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(b) Some words appear in the array more than once.

Refine the algorithm to:


• count the number of times a word appears in the array
• output this number.

For example, the algorithm should output 3 if the input is "and".

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………………………………………………………………………...…………………..

...….……………………..………………………..…..………………………………………...………. [4]

Turn over
5 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(c) An insertion sort is used to put the array with the identifier data into alphabetical order.
The diagram shows the array when the insertion sort is almost complete.

and and and it or when or it

Section A Section B

(i) Explain why the array is shown with two sections.

.......…..….……………….….……………………………………………………………………………….

.…...……......………….…………………………………………………………………………..…………

........…..….….………….……………………………………………………………………………………

..……........….…………….…………………………………………………………………………..…. [2]

(ii) Describe the steps an insertion sort takes to complete sorting the array data.

………………….…….…………….….………………………………………………………………..……

………………….…….…………….….………………………………………………………………..……

………………….…….…………….….………………………………………………………………..……

………………….…….…………….….………………………………………………………………..……

………………….…….…………….….………………………………………………………………..……

…………………….….………………….……………………….…………………………………..….. [3]

(d) One sorting algorithm splits an array into single items and then combines them into an ordered
array.

State the name of this sorting algorithm.

………………………………………………….………………………….……..…………………..…. [1]

6 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

4 Complete the description of computational thinking using the given list of terms.

Not all terms will be used.

abstraction algorithm computation decomposition

evaluation flowchart origin program

pseudocode research sequence thinking

Computational thinking is the process of analysing problems so that they can be solved in a

logical way.

The process of ……………………………………… breaks down a problem into smaller, more

manageable parts.

The process of …………………………………….. removes unnecessary detail from the problem,

so that the main components can be focused on.

Algorithmic …………………………………. identifies the main steps needed to solve the problem

and the …………………………. that the steps are completed.

[4]

Turn over
7 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

5 A programmer uses a high-level language and an Integrated Development Environment (IDE) to


create a computer game.

(a) Describe two advantages to the programmer of using a high-level language instead of a
low-level language.

1 ...………………………….…………………………………………………………………...…………..

…………………….…..……………………………………………………………………………………..

………………………...……………………………………………………………………………………..

………………………...……………………………………………………………………………………..

2 ………………………...………………………………………….……………...………………………..

………………………...……………………………………………………………………………………..

…….…..……………………………………………………………………………………………………..

…….…….……………………………………………………………………………………..……..…. [4]

(b) The IDE includes a translator, such as a compiler or an interpreter.

Tick (✓) one box in each row to identify whether each statement describes the use of a
compiler, an interpreter, or both.

Statement Compiler Interpreter Both

Translates high-level code to low-level


instructions.

Produces an executable file.

Program needs to be translated every


time it is run.
[3]

8 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

6 A computer game uses a controller with three inputs, A, B and C.

An action P is carried out if the player presses A with either B or C at the same time.

(a) Draw the logic system for P.

B P

[3]

(b) Complete the truth table for P = NOT A OR (B AND C).

A B C P

0 0 0

0 0 1

0 1 0

0 1 1

0 0

0 1

1 0

1 1

[3]

Turn over
9 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(c) In the computer game, a player collects items. Each item has a score. The score for each
item is stored using the data type real.

State what is meant by the data type real.

……………………………………..…………………………………………………………………….. [1]

(d) The result of the game can be a win, a loss or a draw. The result is stored in a variable with
the identifier result.

(i) State why result cannot be stored using a Boolean data type.

...……………………………….………………………………………………………...…………………..

…..……..………………………….…………………………………………………………..………… [1]

(ii) Give a suitable data type for result. Explain your answer, showing how each result
could be stored.

Data type ...…………………………….……..………………………………….…………………………

Explanation ……………………..…………………………………………………….………………..…..

……………………………………………………………………………………..…………….…………..

…………………………………….…………………………………………………………...………... [2]

10 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(e) A player enters a code at the beginning of the game. The code is three characters long.
The code sets the level of the game. The game has three levels.

A variable level is assigned a value based on the code entered.

(i) Write an algorithm that:


• asks the user to enter a three-character code
• repeats the previous step if the code is not 3 characters long
• if the code entered is SVA, assigns the value 2 to level
• if the code entered is UTV, assigns the value 3 to level
• assigns the value 1 to level if any other three-character code is entered.

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

..………………………………………………………..……………………..…………………………. [6]

Turn over
11 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

When a player completes a level, they move to the next level.


Once level 3 is completed, the game starts again at level 1.

(ii) Write a function called nextlevel() that:


• takes the current level as a parameter
• works out the integer value of the next level the player moves to
• returns the integer value.

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

...…………………………………………………………………………………………..…….………...…

…………………………………………………………………………………………………………… [3]

(iii) Complete the line of code to output the value returned from the function nextlevel()
when the integer value 3 is passed in as a parameter.

print(…………………….……………..….……..…..(…………………….…....……………..….))

[1]

12 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

SECTION B
We advise you to spend approximately 40 minutes on 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.

7 OCR Drones flies goods around the country using drones.

(a) Details about the drones that pilots fly are stored in a database table called TblDrone.
Some of the data stored in this table is shown.

DroneID DroneType Mileage LastCheck

001 Quadcopter 65 032 65 000

002 Quadcopter 32 128 21 000

003 Octocopter 98 021 98 000

TblDrone

(i) Complete the SQL statement to display DroneID and Mileage for all Octocopter type
drones that have a mileage of greater than 50 000 miles.

SELECT ……………………………

…………………………… TblDrone

WHERE DroneType = "Octocopter" ……………....… Mileage ……..……..………


[4]

Turn over
13 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(ii) Drones must be checked every 10 000 miles. If the difference between Mileage and
LastCheck is greater than 10 000 then the drone needs to be checked.
A flowchart shows the steps needed to check a drone.
The flowchart outputs "Check" if the drone needs to be checked.

The flowchart outputs "No Check" if the drone does not need to be checked.

Complete the flowchart for the algorithm.

Start

Read Mileage from


TblDrone

Read LastCheck from


TblDrone

if
False
………….……………………….
…………………… Output
……………………
………….………………………. ………….……….…….
……………………

True

Output

…………..…………….

End

[2]

14 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(b) A pilot code is automatically generated when a new pilot joins the company.

This algorithm generates a code for each pilot:


01 a = input("Enter first letter of first name")
02 b = input("Enter first letter of second name")
03 c = random(1,100)
04 while c < 100
05 c = c * 10
06 endwhile
07 pilotCode = a + b + str(c)
08 print(pilotCode)

Complete the trace table for the given algorithm.

Lines 01 to 03 have already been completed.

You may not need to use all rows in the trace table.

Line number a b c pilotCode Output

01 H

02 K

03 9

[4]

Turn over
15 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(c) A pilot's flying experience is validated. An algorithm checks that the experience is between 0 and
20 years.

exp = input("Enter number of years")

if exp >= 0 and exp <= 20 then

print(True)

else

print(False)

endif

Complete this test plan for the algorithm.

Experience in years Type of test Expected output

Normal True

20 Boundary

32

[4]

16 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(d) Pilots are paid a set amount each day. Pilots also get an additional payment for each
mile they have flown that day. These payments are shown in the table.

Flying experience Pay per day Pay per mile

Fewer than 2 years £120.00 £0.45

2 years to 5 years inclusive £150.00 £0.65

More than 5 years £180.00 £0.85

For example, a pilot with 3 years’ experience who flies 100 miles in one day will receive a total of
£215.00 pay. This is calculated in the following way:

• £150.00 pay for the day


• £65.00 additional payment (£0.65 pay per mile x 100 miles)
• Add £150.00 and £65.00 together to get £215.00 total pay

(i) Complete the algorithm to:

• Calculate the total pay for the pilot for that day

You must use either:

• OCR Exam Reference Language, or


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

experience = input(“Enter years of experience”)

miles = input(“Enter miles flown”)

totalPay = 0

…………….………………………………………………………………………………………….……....

…………….………………………………………………………………………………………….……....

…………….………………………………………………………………………………………….……....

…………….…………………………………………………………………………………………….…....

…………….………………………………………………………………………………………….……....

…………….…………………………………………………………………………………….…………....

…………….………………………………………………………………………………….………….…...

…………….……………………………………………………………………………………..…………...

print(totalPay)
[4]

Turn over
17 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(ii) The programmer decides to make a function to calculate the total pay for the pilot.
The function is called calculatePay().

The function takes the values for experience and miles as two parameters and returns the
total pay for the pilot.

Refine the algorithm to use this function and output the pay for the pilot.

You must use either:


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

experience = input(“Enter years of experience”)

miles = input(“Enter miles flown”)

…………………… = calculatePay( ………………………… , …………………………)

print( totalPay )

[2]

18 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(e) A text file is used to store pilot’s codes and date of birth.

The text file is named pilots.txt . The contents of some of this file is shown:

JP670,17/05/1986
CC200,31/06/1980
SM720,01/04/1976
GC730,06/06/1978

Design an algorithm to:


• Ask the user to input a pilot code and a date of birth
• Write these inputs to the pilots.txt text file

……………………………………………………………………………………….……………….……..

…………………………………………………………………………………………….………….……..

…………………………………………………………………………………………….…………….…..

…………………………………………………………………………………………….………………...

……………………………………………………………………………………………….……………...

……………………………………………………………………………………………….………….…..

……………………………………………………………………………………………….………….…..

………………………………………………………………………………………………….……….…..

………………………………………………………………………………………………….……….…..

…………………………………………………………………………………………………….………...

……………………………………………………………………………………………………….….…..

…………………………………………………………………………………………………….…….…..

……………………………………………………………………………………………………….……...

………………………………………………………………………………………………………..… [4]

Turn over
19 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

(f) A pilot is allowed to fly a maximum of 9 hours per day. The pilot code and the hours flown for
each flight in one day are stored in a 2D array of strings with the identifier journeys.
The data in journeys is shown.

[0] [1]
[0] "SM720" "4.5"
[1] "GC730" "3"
[2] "JP670" "2"
[3] "GC730" "3.5"
[4] "CC200" "9"
[5] "RY320" "12"

The value of journeys[3,1] is "3.5".


Create a function, pilotValid(), that:
• takes a pilot code as a parameter
• uses the 2D array journeys to calculate the number of hours that the pilot has flown
• returns valid if the pilot has flown 9 hours or fewer or warning if the pilot has flown
for more than 9 hours
• uses casting where needed.

You must use either:


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

………………………………………………………………………………………...……………………..

………………………………………………………………………………………………...……………..

………………………………………………………………………………………………………...……..

…………………………………………………………………………………………………………….....

…………………………………………………………………………………………………………...…..

…………………………………………………………………………………………………………….....

…………………………………………………………………………………………………………...…..

………………………………………………………………………………………………...……………..

……………………………………………………………………………………………………...………..

…………………………………………………………………………………………………...…………..

……………………………………………………………………………………………...………………..

………………………………………………………………………………………...……………………..

………………………………………………………………………………………………...……………..

20 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

………………………………………………………………………………………………………...……..

…………………………………………………………………………………………………………….....

…………………………………………………………………………………………………………...…..

…………………………………………………………………………………………………………….....

…………………………………………………………………………………………………………...…..

………………………………………………………………………………………………...……………..

……………………………………………………………………………………………………...………..

…………………………………………………………………………………………………...…………..

……………………………………………………………………………………………...………………..

……………………………………………………………………………………………...………………..

……………………………………………………………………………………………..……….…… [6]

END OF QUESTION PAPER

Turn over
21 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

ADDITIONAL ANSWER SPACE


If additional space is required, you should use the following lined page(s). The question number(s)
must be clearly shown in the margin(s).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

22 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Copyright Information:
OCR is committed to seeking permission to reproduce all third-party content that it uses in the assessment materials. OCR has attempted to
identify and contact all copyright holders whose work is used in this paper. To avoid the issue of disclosure of answer-related information to
candidates, all copyright acknowledgements are reproduced in the OCR Copyright Acknowledgements booklet. This is produced for each
series of examinations and is freely available to download from our public website (www.ocr.org.uk) after the live examination series.

If OCR has unwittingly failed to correctly acknowledge or clear any third-party content in this assessment material, OCR will be happy to
correct its mistake at the earliest possible opportunity.

For queries or further information please contact the Copyright Team, The Triangle, Shaftesbury Road, Cambridge, CB2 8EA.

OCR is part of the Cambridge Assessment Group; Cambridge Assessment is the brand name of University of Cambridge Local
Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge

23 © OCR 2023
GCSE (9-1) Computer Science J277/02 Practice paper

Please note – web links are correct at date of publication but other websites may
change over time. If you have any problems with a link you may want to navigate
to that organisation’s website for a direct search.

We’d like to know your view on the resources we produce. Click ‘Like’ or ‘Dislike’ to send us an auto generated email about this
resource. Add comments if you want to. Let us know how we can improve this resource or what else you need. Your email will not be
used or shared for any marketing purposes.
Looking for another resource? There is now a quick and easy search tool to help find free resources for your qualification.

OCR is part of Cambridge University Press & Assessment, which is itself a department of the University of Cambridge.

For staff training purposes and as part of our quality assurance programme your call may be recorded or monitored.
Oxford Cambridge and RSA Examinations is a Company Limited by Guarantee. Registered in England. Registered office
The Triangle Building, Shaftesbury Road, Cambridge, CB2 8EA. Registered company number 3484466. OCR is an exempt charity.

OCR operates academic and vocational qualifications regulated by Ofqual, Qualifications Wales and CCEA as listed
in their qualifications registers including A Levels, GCSEs, Cambridge Technicals and Cambridge Nationals.

OCR provides resources to help you deliver our qualifications. These resources do not represent any particular teaching method we
expect you to use. We update our resources regularly and aim to make sure content is accurate but please check the OCR website so
that you have the most up to date version. OCR cannot be held responsible for any errors or omissions in these resources.

Though we make every effort to check our resources, there may be contradictions between published support and the specification, so
it is important that you always use information in the latest specification. We indicate any specification changes within the document
itself, change the version number and provide a summary of the changes. If you do notice a discrepancy between the specification and
a resource, please contact us.
© OCR 2023 - You can copy and distribute this resource freely if you keep the OCR logo and this small print intact and you
acknowledge OCR as the originator of the resource.
OCR acknowledges the use of the following content: N/A
Whether you already offer OCR qualifications, are new to OCR or are thinking about switching, you can request more information
using our Expression of Interest form.

Please get in touch if you want to discuss the accessibility of resources we offer to support you in delivering our qualifications.

24 © OCR 2023

You might also like