a level computer science revision pack 02 – algorithms and

167
A Level Computer Science Revision Pack 02 – Algorithms and Programming The mark scheme for each paper follows the questions Included (in order of appearance) 2019 2018 2017 How to revise Computer Science Practice questions from past papers are one of the best methods of revising topics from the course. This approach, accompanied by creating notes and reading the course textbook as a source for information, has proven successful for many of our previous students. How to revise a particular topic this is generic and by no means a one size fits all approach 1. On a single sheet of A4, write down everything you currently know about the topic. Do this prior to reading the course textbook or seeking help from previous notes. 2. Now consult course textbook for the topic and add to this sheet, anything you did not know that is necessary – once complete, highlight these points – these are the areas you need to learn. 3. Locate questions based around this topic in the past paper pack and attempt to answer them. 4. Confirm with the mark scheme as to your success in answering the question. The end goal of this approach would be that you are comfortably able to produce a piece of A4 for each topic of the course and then apply this information to the past paper questions. Obtaining feedback for answers The students who succeed the best in computer science are those who seek constant feedback from teachers, not just in the scope of a lesson. Any work you produce out of lesson such as past paper question answers or programming challenges, you should want to seek feedback for. This can be achieved by: 1. Taking work to a teacher during school time. 2. Emailing a teacher your answers, questions etc. Mr Ravenscroft – [email protected] Mr Ebrahim – [email protected] As your teachers we want to give you feedback!

Upload: others

Post on 05-Dec-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

A Level Computer Science Revision Pack

02 – Algorithms and Programming

The mark scheme for each paper follows the questions

Included (in order of appearance) 2019 2018 2017

How to revise Computer Science Practice questions from past papers are one of the best methods of revising topics from the course. This approach, accompanied by creating notes and reading the course textbook as a source for information, has proven successful for many of our previous students. How to revise a particular topic this is generic and by no means a one size fits all approach

1. On a single sheet of A4, write down everything you currently know about the topic. Do this prior to reading the course textbook or seeking help from previous notes.

2. Now consult course textbook for the topic and add to this sheet, anything you did not know that is necessary – once complete, highlight these points – these are the areas you need to learn.

3. Locate questions based around this topic in the past paper pack and attempt to answer them.

4. Confirm with the mark scheme as to your success in answering the question. The end goal of this approach would be that you are comfortably able to produce a piece of A4 for each topic of the course and then apply this information to the past paper questions. Obtaining feedback for answers The students who succeed the best in computer science are those who seek constant feedback from teachers, not just in the scope of a lesson. Any work you produce out of lesson such as past paper question answers or programming challenges, you should want to seek feedback for. This can be achieved by:

1. Taking work to a teacher during school time. 2. Emailing a teacher your answers, questions etc.

Mr Ravenscroft – [email protected] Mr Ebrahim – [email protected]

As your teachers we want to give you feedback!

Study Skills and Support

Exam board: OCR Course length: 2 years How is it assessed? 2 written exams on 01 – Computer Systems and 02 – Algorithms and Programming (each worth 40%) and a programming project worth 20%. Modules covered: 01 – Processors, Input – Output and Storage, Systems software, software development, compression, databases, networks, web technologies, data types, data structures, Boolean algebra, morals and ethics. 02 – Thinking abstractly; ahead; procedurally; logically; concurrently, programing techniques, computational methods, algorithms.

Resource Link Useful For… Requirements Course Textbook

N/A Independent revision & study

Course textbook from the school library.

YouTube YouTube Knowledge booster, second voice

N/A

Past Paper Packs

N/A Exam style question practice, independent study

Past paper pack from class teacher

Departmental resources

All stored within the Microsoft Teams Team for the group.

Accessing departmental materials and lessons

School email and password login.

Mr Fraser www.mrfraser.org Accessing resources and work sheets

mrfraser.org login account (free to create)

Craig n Dave craigndave.org

Resources for topics – broken down by spec

Access is free for most content – school has a paid account

AQA Past Papers

Search ‘AQA A Level Computer Science Past Papers’ on Google.

Different phrasing of exam style questions.

N/A

Class Teachers [email protected] [email protected]

Familiarity with assessment objectives is necessary in exam answers to ensure

application and evaluation

Embed and commit knowledge and understanding to long term memory for

examination recall

Develop awareness and appreciation for the use of computer science in the

wider world; which can be included in extended answers

Develop understanding of programming beyond the curriculum to enable

success in the programming project

Purp

ose

of

inde

pend

ent S

tudy

*7678005047*

Turn over© OCR 2019 [601/4911/5]DC (JC/TP) 173313/4

OCR is an exempt Charity

* H 4 4 6 0 2 *

Oxford Cambridge and RSA

Tuesday 11 June 2019 – MorningA Level Computer ScienceH446/02 Algorithms and programmingTime allowed: 2 hours 30 minutes

You may use:• a ruler (cm/mm)• an HB pencil

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.• Answer all the questions. • Write your answer to each question in the space provided. Additional paper may be

used if required but you must clearly show your candidate number, centre number and question number(s).

INFORMATION• The total mark for this paper is 140.• The marks for each question are shown in brackets [ ].• Quality of extended responses will be assessed in questions marked with an

asterisk (*).• This document consists of 24 pages.

2

© OCR 2019

Section A

1 The temperatures of an ocean are input into a computer system. They are recorded, and will be accessed, in the order in which they arrive. The data for one week is shown:

5, 5.5, 5, 6, 7, 6.5, 6

(a) The data is to be stored in a data structure. The programmer stores the data in a queue.

Explain why a queue is used instead of a stack.

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

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

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

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

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

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

[2]

(b) The data is processed. After processing, the value for the first day is stored as 0. The value for each following day is stored as an increase, or decrease, from the first day.

For example: if the first day was 7, the second was 6 and the third was 9, after processing it would be stored as 0, –1, 2.

(i) The queue uses dequeue() to return the first element of the queue.

dequeue() is a function.

Explain why dequeue() is a function, not a procedure.

[1]

(ii) Complete the algorithm to process the data in the queue and store the results in an array called processedData.

processedData[0] = 0

firstDay = ………………………………………

for count = 1 to 6

processedData[………………………………] = dequeue() – …………………………………

next count[3]

3

Turn over© OCR 2019

(iii) The contents of processedData are shown.

0 0.5 0 1 2 1.5 1

The data needs to be sorted into ascending order.

Explain how a bubble sort algorithm sorts data. Use the current contents of processedData in your explanation.

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

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

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

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

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

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

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

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

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

...................................................................................................................................... [5]

4

© OCR 2019

(iv) A bubble sort has the following complexities:

Best time O(n)

Average and worst time O(n2)

Worst space O(1)

Describe what each of these complexities mean.

Best time O(n)

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

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

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

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

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

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

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

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

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

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

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

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

Average and worst time O(n2)

Worst Space O(1)

[6]

5

Turn over© OCR 2019

2 A program needs to store the names of plants that are in a garden, so they can be easily found and accessed in alphabetical order.

The data is stored in a tree structure. Part of the tree is shown.

Begonia HostaPeony

Daisy Sunflower

Rose

Lily

Fig. 2.1

(a) (i) State the type of tree shown in Fig. 2.1.

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

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

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

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

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

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

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

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

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

[1]

(ii) Show the output of a breadth-first traversal of the tree shown in Fig. 2.1.

[3]

6

© OCR 2019

(iii) Explain how backtracking is used in a depth-first (post-order) traversal. Use the tree in Fig. 2.1 in your explanation.

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

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

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

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

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

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

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

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

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

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

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

(b) The elements in the tree in Fig. 2.1 are read into a linked list producing an alphabetised list.

(i) Complete the following table to show the linked list for the data.

Data item Data NextPointer

0 Begonia

1 Daisy

2 Hosta

3 Lily

4 Peony

5 Rose

6 Sunflower

[2]

7

Turn over© OCR 2019

(ii) A new plant, Lavender, needs adding to the linked list. The linked list needs to retain its alphabetical order.

Complete the table to show the linked list after Lavender is added.

Data item Data NextPointer

0 Begonia

1 Daisy

2 Hosta

3 Lily

4 Peony

5 Rose

6 Sunflower

[3]

(iii) Hosta needs removing from the linked list.

Explain how a data item is removed from a linked list. Use the removal of Hosta in your answer.

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

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

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

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

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

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

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

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

8

© OCR 2019

(iv) The linked list is stored as a 2D array with the identifier plantList. The index of the first element of the linked list is stored in the identifier firstElement.

All contents of the linked list need to be output in alphabetical order.

Write an algorithm to follow the pointers to output the contents of the linked list in alphabetical order.

Add comments to explain your code.

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

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

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

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

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

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

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

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

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

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

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

...................................................................................................................................... [5]

9

Turn over© OCR 2019

3 A recursive function, GCD, is given in pseudocode.

function GCD(num1, num2)

if num2 == 0 then

return num1

else

return GCD(num2, num1 MOD num2)

endif

endfunction

(a) The function uses branching.

(i) Identify the type of branching statement used in the function.

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

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

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

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

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

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

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

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

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

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

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

[1]

(ii) Explain the difference between branching and iteration.

[2]

(iii) Identify the two parameters in the function.

1

2 [1]

(iv) State whether the parameters should be passed by value, or by reference. Justify your answer.

[2]

10

© OCR 2019

(v) Describe the arithmetic operation of MOD. Use an example in your answer.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[2]

(b) Trace the recursive function when it is called by the statement GCD(250, 20). Give the final value returned.

Final return value: .[3]

(c) The function has been rewritten using iteration instead of recursion.

(i) State one benefit and one drawback of using iteration instead of recursion.

Benefit

Drawback

[2]

11

Turn over© OCR 2019

(ii) Complete the missing statements in this iterative version of the function.

function newGCD(num1, num2)

temp = 0

while (num2 != ………………………………

………………………………

………………………………

………………………………

)

= num2

num2 = num1 MOD

num1 = temp

endwhile

return

endfunction[4]

4 Mabel is a software engineer. She is writing a computer game for a client. In the game the main character has to avoid their enemies. This becomes more difficult as the levels of the game increase.

(a) Mabel uses decomposition to design the program.

Explain how decomposition can aid the design of this program.

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

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

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

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

(b) The computer game allows a user to select a character (e.g. name, gender). They can then choose a level for the game (easy, normal, challenging). The user controls their character by moving it left or right. The character can jump using space bar as an input. If the character touches one of the enemies then it loses a life. The character has to make it to the end of the level without losing all their lives.

The game is designed in a modular way.

12

© OCR 2019

(i) One sub-procedure will handle the user input.

Describe three other sub-procedures Mabel could create for the given game description.

1 .........................................................................................................................................

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2

3

[6]

(ii) Describe the decision that the program will need to make within the user input sub-procedure and the result of this decision.

[2]

(iii) Define pipelining and give an example of how it could be applied in the program.

[2]

13

Turn over© OCR 2019

(c) The game’s ‘challenging’ level has intelligent enemies that hunt down the character in an attempt to stop the user from winning. The program plans the enemies’ moves in advance to identify the most efficient way to stop the user from winning the game.

The possible moves are shown in a graph. Each node represents a different state in the game. The lines represent the number of moves it will take to get to that state.

AB E

F G

HD

C

2

14

1

3

12

2

4

Show how Dijkstra’s algorithm would find the shortest path from A to H.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

14

© OCR 2019

(d)* Mabel has been told that true programmers write programs in a text editor, and do not use IDEs. Mabel does not agree with this statement.

Discuss the use of an IDE in the development of this program.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.............................................................................................................................................. [9]

15

Turn over© OCR 2019

5 A 1-dimensional array stores the following data:

Index 0 1 2 3 4 5

Data 2 18 6 4 12 3

(a) The array needs sorting into descending order.

Describe how a merge sort would sort the given array into descending order.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[6]

(b) An insertion sort can be used to sort the array instead of a merge sort.

Explain why an insertion sort might use less memory than a merge sort.

[2]

16

© OCR 2019

6* Benedict runs a social networking website. He has been told he should use data mining to help him enhance and improve his website.

Evaluate the use of data mining to help Benedict enhance and improve his social networking website.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

..................................................................................................................................................... [9]

17

Turn over© OCR 2019

BLANK PAGE

PLEASE DO NOT WRITE ON THIS PAGE

18

© OCR 2019

Section B

7 A program is needed to plan the layout of a garden.

The program will allow the user to create an image of the garden, for example:

Vegetable bed

Flower bed

Path Patio

Peartree

PeartreeApple

tree

(a) The programmer will use abstraction to produce the program interface to represent the garden.

(i) Give two different examples of how abstraction has been used to produce the layout of the garden.

1 .........................................................................................................................................

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

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

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

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

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

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

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

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

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

2

[2]

(ii) Explain the need for abstraction in the production of this program.

[3]

19

Turn over© OCR 2019

(iii) The user needs to input data into the program to set up their garden layout.

Identify three pieces of data that the user may input into this program.

1 .........................................................................................................................................

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2

3

[3]

(b) The program is to be built using object oriented programming.

All items that can be added to the garden are declared as instances of the class GardenItem.

The class has the following attributes:

Attribute Description Example

itemName The name of the item Flowerbed

length The length of the item in metres 2

width The width of the item in metres 1

(i) The constructor method sets the attributes to values that are passed as parameters.

Write pseudocode or program code to declare the class GardenItem and its constructor. All attributes should be private and initialised through the constructor (e.g. daisies = new GardenItem("Flowerbed",2,1) ). [4]

20

© OCR 2019

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(ii) The trees in the garden layouts are defined by the class Tree. This class inherits from GardenItem.

The class Tree has the additional attributes: height, sun, shade.

If sun is true then the tree can grow in full sun, if it is false then it cannot.

If shade is true then the tree can grow in full shade, if it is false then it cannot.

The length and width of a tree are the same. Only one value for these measurements is passed to the constructor.

Write an algorithm, using pseudocode or program code, to declare the class Tree. Declare all attributes as private.

[5]

21

Turn over© OCR 2019

(iii) The Common Oak is a type of tree. It has a maximum height, length and width of 40 m. It can grow in sun and shade.

Write a statement, using pseudocode or program code, to declare an instance of tree for the Common Oak. Give the object the identifier firstTree.

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

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

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

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

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

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

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

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

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

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

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

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

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

[4]

(iv) The classes GardenItem and Tree use get and set methods to access and alter their private attributes.

Write the get method getItemName and set method setItemName for class GardenItem. The set method takes the new value as a parameter.

Do not write any other methods, or re-declare the class.

[4]

22

© OCR 2019

(v) The trees in the garden layouts are stored in a 1-dimensional array, treeArray. The array can store a maximum of 1000 items. The array has global scope.

A procedure, findTree, takes as parameters:

• The maximum height of a tree• The maximum width of a tree• Whether the tree can live in full sun• Whether the tree can live in full shade.

It searches the array, treeArray, for all trees that do not exceed the maximum height and width, and that can grow in the conditions available. If there are no suitable trees, a suitable message is output.

It outputs the name and details of the trees found in an appropriate message.

Call the get methods, getItemName, getHeight, getWidth, getSun, getShade, to access the attributes.

Write, using pseudocode or program code, the procedure findTree.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

23

© OCR 2019

(c)* The programmer is designing the program to make use of caching and re-useable components.

Explain and evaluate the use of caching and re-useable components in the design of the garden program.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

...................................................................................................................................... [9]

24

© OCR 2019

PLEASE DO NOT WRITE ON THIS PAGE

Oxford Cambridge and RSA

Copyright Information

OCR is committed to seeking permission to reproduce all third-party content that it uses in its 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 OCR Copyright Team, The Triangle Building, 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.

Oxford Cambridge and RSA Examinations

GCE Computer Science

H446/02: Algorithms and programming

Advanced GCE

Mark Scheme for June 2019

OCR (Oxford Cambridge and RSA) is a leading UK awarding body, providing a wide range of qualifications to meet the needs of candidates of all ages and abilities. OCR qualifications include AS/A Levels, Diplomas, GCSEs, Cambridge Nationals, Cambridge Technicals, Functional Skills, Key Skills, Entry Level qualifications, NVQs and vocational qualifications in areas such as IT, business, languages, teaching/training, administration and secretarial skills. It is also responsible for developing new specifications to meet national requirements and the needs of students and teachers. OCR is a not-for-profit organisation; any surplus made is invested back into the establishment to help towards the development of qualifications and support, which keep pace with the changing needs of today’s society. This mark scheme is published as an aid to teachers and students, to indicate the requirements of the examination. It shows the basis on which marks were awarded by examiners. It does not indicate the details of the discussions which took place at an examiners’ meeting before marking commenced. All examiners are instructed that alternative correct answers and unexpected approaches in candidates’ scripts must be given marks that fairly reflect the relevant knowledge and skills demonstrated. Mark schemes should be read in conjunction with the published question papers and the report on the examination. © OCR 2019

An

no

tatio

ns

An

no

tatio

n

Me

an

ing

Om

issio

n m

ark

Be

nefit o

f the d

oubt

Inco

rrect p

oin

t

Follo

w th

rou

gh

No

t an

sw

ere

d q

uestio

n

No

ben

efit o

f doubt g

ive

n

Re

pe

at

Co

rrect p

oin

t

To

o v

ag

ue

Zero

(big

)

Le

ve

l 1

Le

ve

l 2

Le

ve

l 3

Su

bje

ct-s

pe

cific

Ma

rkin

g In

stru

ctio

ns

IN

TR

OD

UC

TIO

N

Yo

ur firs

t task a

s a

n E

xa

min

er is

to b

ecom

e th

oro

ug

hly

fam

iliar w

ith th

e m

ate

rial o

n w

hic

h th

e e

xa

min

atio

n d

ep

en

ds. T

his

ma

teria

l inclu

de

s:

th

e s

pecific

atio

n, e

spe

cia

lly th

e a

ssessm

ent o

bje

ctiv

es

th

e q

uestio

n p

ap

er a

nd its

rubric

s

th

e m

ark

sch

em

e.

Yo

u s

hou

ld e

nsu

re th

at y

ou h

ave

co

pie

s o

f these

ma

teria

ls.

Yo

u s

hou

ld e

nsu

re a

lso

that y

ou a

re fa

milia

r with

the a

dm

inis

trativ

e p

rocedu

res re

late

d to

the m

ark

ing p

roce

ss. T

hese

are

se

t out in

the O

CR

boo

kle

t Instru

ctio

ns fo

r Ex

am

iners

. If yo

u a

re e

xa

min

ing

for th

e firs

t time

, ple

ase

read c

are

fully

Ap

pen

dix

5 In

trod

uc

tion

to S

crip

t Ma

rkin

g:

No

tes

for N

ew

Ex

am

iners

. P

lease

ask fo

r help

or g

uid

an

ce w

hen

eve

r yo

u n

ee

d it. Y

our firs

t poin

t of c

onta

ct is

yo

ur T

eam

Lead

er.

US

ING

TH

E M

AR

K S

CH

EM

E

Ple

ase

stu

dy th

is M

ark

Sch

em

e c

are

fully

. Th

e M

ark

Sch

em

e is

an in

teg

ral p

art o

f the p

rocess th

at b

eg

ins w

ith th

e s

ettin

g o

f the q

uestio

n p

ap

er a

nd

e

nd

s w

ith th

e a

wa

rdin

g o

f gra

de

s. Q

uestio

n p

ap

ers

and

Ma

rk S

ch

em

es a

re d

eve

lope

d in

asso

cia

tion

with

ea

ch

oth

er s

o th

at is

su

es o

f d

iffere

ntia

tion

an

d p

ositiv

e a

ch

ieve

me

nt c

an b

e a

ddre

ssed

from

the v

ery

sta

rt. T

his

Ma

rk S

ch

em

e is

a w

ork

ing d

ocu

men

t; it is n

ot e

xh

au

stiv

e; it d

oe

s n

ot p

rovid

e ‘c

orre

ct’ a

nsw

ers

. Th

e M

ark

Sch

em

e c

an o

nly

pro

vid

e ‘b

est

gu

esses’ a

bo

ut h

ow

the q

uestio

n w

ill wo

rk o

ut, a

nd it is

su

bje

ct to

revis

ion a

fter w

e h

ave

loo

ke

d a

t a w

ide ra

ng

e o

f scrip

ts.

Th

e E

xa

min

ers

’ Sta

nd

ard

isa

tion

Me

etin

g w

ill ensu

re th

at th

e M

ark

Sch

em

e c

ove

rs th

e ra

ng

e o

f can

did

ate

s’ re

spo

nses to

the

qu

estio

ns, a

nd th

at a

ll E

xa

min

ers

und

ers

tand

an

d a

pp

ly th

e M

ark

Sch

em

e in

the s

am

e w

ay. T

he

Ma

rk S

ch

em

e w

ill be d

iscu

ssed

an

d a

me

nd

ed

at th

e m

eetin

g, a

nd

adm

inis

trativ

e p

roced

ure

s w

ill be c

onfirm

ed. C

o-o

rdin

atio

n s

crip

ts w

ill be is

su

ed

at th

e m

eetin

g to

exe

mp

lify a

spe

cts

of c

an

did

ate

s’ re

spo

nses a

nd

achie

ve

me

nts

; the c

o-o

rdin

atio

n s

crip

ts th

en

be

co

me

part o

f this

Ma

rk S

ch

em

e.

Be

fore

the S

tand

ard

isatio

n M

eetin

g, y

ou s

hou

ld re

ad

an

d m

ark

in p

en

cil a

num

ber o

f scrip

ts, in

ord

er to

ga

in a

n im

pre

ssio

n o

f the ra

ng

e o

f re

spo

nse

s a

nd

achie

ve

me

nt th

at m

ay b

e e

xp

ecte

d.

In y

our m

ark

ing

, yo

u w

ill enco

un

ter v

alid

respo

nse

s w

hic

h a

re n

ot c

ove

red b

y th

e M

ark

Sch

em

e: th

ese re

spo

nse

s m

ust b

e c

redite

d. Y

ou w

ill e

nco

un

ter a

nsw

ers

wh

ich

fall o

uts

ide th

e ‘ta

rge

t rang

e’ o

f Ba

nd

s fo

r the p

ape

r wh

ich

yo

u a

re m

ark

ing

. Ple

ase

ma

rk th

ese

an

sw

ers

accord

ing

to th

e

ma

rkin

g c

riteria

. P

lease

read

care

fully

all th

e s

crip

ts in

yo

ur a

llocatio

n a

nd

make

eve

ry e

ffort to

look p

ositiv

ely

for a

ch

ieve

me

nt th

roug

hou

t the

ab

ility ra

ng

e. A

lwa

ys

be p

rep

are

d to

use th

e fu

ll rang

e o

f ma

rks.

LE

VE

LS

OF

RE

SP

ON

SE

QU

ES

TIO

NS

: T

he in

dic

ativ

e c

on

tent in

dic

ate

s th

e e

xp

ecte

d p

ara

me

ters

for c

and

idate

s’ a

nsw

ers

, but b

e p

repa

red

to re

cog

nis

e a

nd

cre

dit u

ne

xp

ecte

d a

ppro

ach

es

wh

ere

they s

how

rele

va

nce

. U

sin

g ‘b

est-fit’, d

ecid

e firs

t wh

ich

se

t of B

AN

D D

ES

CR

IPT

OR

S b

est d

escrib

es th

e o

ve

rall q

uality

of th

e a

nsw

er. O

nce

the b

an

d is

locate

d, a

dju

st

the m

ark

co

nce

ntra

ting

on

featu

res o

f the a

nsw

er w

hic

h m

ake it s

trong

er o

r we

ake

r follo

win

g th

e g

uid

elin

es fo

r refin

em

ent.

H

igh

est m

ark

: If cle

ar e

vid

en

ce o

f all th

e q

ualitie

s in

the b

an

d d

escrip

tors

is s

how

n, th

e H

IGH

ES

T M

ark

sh

ou

ld b

e a

wa

rde

d.

L

ow

est m

ark

: If the a

nsw

er s

how

s th

e c

and

idate

to b

e b

ord

erlin

e (i.e

. they h

ave

ach

ieve

d a

ll the q

ua

lities o

f the b

an

ds b

elo

w a

nd

sh

ow

lim

ited e

vid

ence

of m

eetin

g th

e c

riteria

of th

e b

and

in q

uestio

n) th

e L

OW

ES

T m

ark

sh

ou

ld b

e a

wa

rde

d.

M

idd

le m

ark

: Th

is m

ark

sh

ou

ld b

e u

sed fo

r ca

nd

idate

s w

ho a

re s

ecure

in th

e b

an

d. T

hey a

re n

ot ‘b

ord

erlin

e’ b

ut th

ey h

ave

only

achie

ve

d

so

me

of th

e q

ualitie

s in

the b

an

d d

escrip

tors

. B

e p

repa

red to

use th

e fu

ll rang

e o

f ma

rks. D

o n

ot re

serv

e (e

.g.) h

igh B

an

d 3

ma

rks ‘in

ca

se

’ so

me

thin

g tu

rns u

p o

f a q

uality

yo

u h

ave

no

t ye

t se

en.

If an a

nsw

er g

ive

s c

lea

r evid

en

ce o

f the q

ualitie

s d

escrib

ed

in th

e b

an

d d

escrip

tors

, rew

ard

appro

pria

tely

.

A

O1

A

O2

A

O3

Hig

h (th

oro

ug

h)

Pre

cis

ion in

the u

se o

f que

stio

n

term

inolo

gy. K

now

ledg

e s

how

n is

co

nsis

tent a

nd

we

ll-deve

lope

d.

Cle

ar a

pp

recia

tion o

f the q

uestio

n

from

a ra

ng

e o

f diffe

rent

pers

pectiv

es m

akin

g e

xte

nsiv

e

use o

f acq

uire

d k

now

led

ge a

nd

u

nd

ers

tand

ing

.

Kn

ow

ledg

e a

nd

un

de

rsta

ndin

g

sh

ow

n is

co

nsis

tently

app

lied to

co

nte

xt e

na

blin

g a

log

ical a

nd

su

sta

ined

arg

um

ent to

de

ve

lop.

Exa

mp

les u

se

d e

nh

an

ce ra

ther

than

detra

ct fro

m re

spo

nse

.

Co

nce

rted e

ffort is

ma

de to

co

nsid

er a

ll aspe

cts

of a

syste

m /

pro

ble

m o

r we

igh

up b

oth

sid

es to

a

n a

rgum

ent b

efo

re fo

rmin

g a

n

ove

rall c

onclu

sio

n. J

udg

em

ents

m

ade

are

ba

se

d o

n a

pp

ropria

te

and

co

ncis

e a

rgu

me

nts

that h

ave

b

ee

n d

eve

lope

d in

respon

se

resultin

g in

them

bein

g b

oth

su

pp

orte

d a

nd

realis

tic.

Mid

dle

(rea

so

nab

le)

Aw

are

ne

ss o

f the m

ean

ing o

f the

term

s in

the q

uestio

n. K

no

wle

dg

e

is s

oun

d a

nd e

ffectiv

ely

d

em

onstra

ted. D

em

and

s o

f q

uestio

n u

nd

ers

tood a

ltho

ug

h a

t tim

es o

pp

ortu

nitie

s to

ma

ke u

se o

f a

cq

uire

d k

now

ledg

e a

nd

und

ers

tand

ing

not a

lwa

ys ta

ke

n.

Kn

ow

ledg

e a

nd

un

de

rsta

ndin

g

app

lied to

co

nte

xt. W

hils

t cle

ar

evid

en

ce th

at a

n a

rgum

en

t build

s

and

de

ve

lops th

roug

h re

sp

on

se

there

are

times w

hen

o

pp

ortu

nitie

s a

re m

isse

d to

use a

n

exa

mp

le o

r rela

te a

n a

spe

ct o

f kn

ow

ledg

e o

r und

ers

tand

ing

to

the c

onte

xt p

rovid

ed

.

Th

ere

is a

reaso

na

ble

atte

mp

t to

reach

a c

onclu

sio

n c

onsid

erin

g

aspe

cts

of a

syste

m / p

rob

lem

or

we

igh

ing u

p b

oth

sid

es o

f an

arg

um

ent. H

ow

eve

r the im

pact o

f th

e c

onclu

sio

n is

ofte

n le

sse

ne

d

by a

lack o

f su

pp

orte

d ju

dg

em

ents

w

hic

h a

cco

mp

an

y it. T

his

inab

ility

to b

uild

on

an

d d

eve

lop lin

es o

f a

rgu

me

nt a

s d

eve

lope

d in

the

respo

nse

ca

n d

etra

ct fro

m th

e

ove

rall q

uality

of th

e re

spo

nse

.

Lo

w (b

as

ic)

Co

nfu

sio

n a

nd

ina

bility

to

deco

nstru

ct te

rmin

olo

gy a

s u

se

d

in th

e q

uestio

n. K

now

led

ge p

artia

l a

nd

su

pe

rficia

l. Focu

s o

n q

uestio

n

narro

w a

nd

ofte

n o

ne

-d

ime

nsio

na

l.

Inab

ility to

ap

ply

kn

ow

ledg

e a

nd

u

nd

ers

tand

ing

in a

ny s

usta

ined

w

ay to

co

nte

xt re

sultin

g in

te

nu

ou

s a

nd u

nsu

pp

orte

d

sta

tem

ents

bein

g m

ade.

Exa

mp

les if u

sed

are

for th

e m

ost

part irre

leva

nt a

nd

unsu

bsta

ntia

ted.

Little

or n

o a

ttem

pt to

prio

ritise o

r w

eig

h u

p fa

cto

rs d

urin

g c

ours

e o

f a

nsw

er. C

onclu

sio

n is

ofte

n

dis

locate

d fro

m re

sp

on

se

an

d a

ny

judg

em

ents

lack s

ubsta

nce

du

e in

p

art to

the b

asic

leve

l of a

rgu

me

nt

that h

as b

ee

n d

em

onstra

ted

thro

ug

hout re

spo

nse.

A

ssessme

nt O

bje

ctive

AO

1

Dem

on

strate kno

wled

ge and

un

derstan

din

g of th

e prin

ciples an

d co

ncep

ts of co

mp

ute

r science, in

clud

ing ab

straction

, logic, algo

rithm

s and

data

represe

ntatio

n.

AO

1.1

D

emo

nstrate kn

ow

led

ge o

f the p

rincip

les and

con

cepts o

f abstractio

n, lo

gic, algorith

ms, d

ata represe

ntatio

n o

r oth

er as app

rop

riate.

AO

1.2

D

emo

nstrate u

nd

erstan

din

g of th

e prin

ciples an

d co

ncep

ts of ab

straction

, logic, algo

rithm

s, data rep

resentatio

n o

r oth

er as app

rop

riate.

AO

2

Ap

ply kn

ow

ledge an

d u

nd

erstand

ing o

f the p

rincip

les and

con

cepts o

f com

pu

ter scien

ce inclu

din

g to an

alyse pro

blem

s in co

mp

utatio

nal te

rms.

AO

2.1

A

pp

ly kno

wled

ge and

un

derstan

din

g of th

e prin

ciples an

d co

ncep

ts of co

mp

ute

r science.

AO

2.2

A

nalyse

pro

blem

s in co

mp

utatio

nal te

rms.

AO

3

Design

, pro

gram an

d evalu

ate co

mp

ute

r systems th

at solve p

rob

lems, m

aking reaso

ned

jud

gemen

ts abo

ut th

ese an

d p

resentin

g con

clusio

ns.

AO

3.1

D

esign co

mp

ute

r systems th

at solve p

rob

lems.

AO

3.2

P

rogram

com

pu

ter system

s that so

lve pro

blem

s.

AO

3.3

Evalu

ate com

pu

ter systems th

at solve p

rob

lems, m

aking re

ason

ed ju

dgem

ents ab

ou

t these an

d p

resen

ting co

nclu

sion

s.

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

1a

1 m

ark

per b

ulle

t

Q

ueu

e o

utp

uts

data

in a

Firs

t In F

irst O

ut fa

shio

n

It w

ill retrie

ve

the te

mp

era

ture

va

lues in

the o

rder th

ey w

ere

re

cord

ed

or

S

tack o

utp

uts

the d

ata

in a

Last In

Firs

t Out fa

shio

n

It w

ill retrie

ve

the te

mp

era

ture

va

lues in

the re

ve

rse

of th

e o

rder

they w

ere

record

ed

2

AO

1.2

(1

) A

O2

.2

(1)

Ma

rk P

oin

t 1 is

the d

efin

ition

Ma

rk P

oin

t 2 is

for c

onte

xt o

f the te

mp

era

ture

va

lues

1bi

It retu

rns a

va

lue

1

AO

2.1

(1

)

1bii

1 m

ark

per c

om

ple

ted w

ord

processedData[0] = 0

firstDay = dequeue()

for count = 1 to 6

processedData[count] = dequeue() - firstDay

next count

3

AO

2.2

(1

) A

O3

.2

(2)

Exa

ct a

nsw

ers

only

1biii

1 m

ark

per b

ulle

t to m

ax 5

.

Ma

x 3

if no a

pp

lica

tion

to d

ata

in processedData

C

om

pa

res e

ach

pa

ir of d

ata

e.g

. 0 a

nd 0

.5

If th

ey a

re in

the c

orre

ct o

rde

r it mo

ve

s to

the n

ext p

air e

.g. 0

.5

and

0

If th

ey a

re in

the w

rong

ord

er it s

wa

ps th

em

e.g

. 0.5

an

d 0

b

eco

me

s 0

an

d 0

.5

C

ontin

ue

s to

the e

nd

of th

e a

rray e

.g. P

ass 1

com

ple

te

If th

ere

ha

s b

ee

n a

sw

ap it c

hecks a

ga

in e

.g. P

ass 2

com

ple

te

If th

ere

ha

ve

be

en n

o s

wa

ps it is

so

rted

0

0.5

0

1

2

1.5

1

Pa

ss 1

0

0

0.5

1

2

1.5

1

0

0

0.5

1

1.5

2

1

0

0

0.5

1

1.5

1

2

0

0

0.5

1

1

1.5

2

Pa

ss 2

0

0

0.5

1

1

1.5

2

No

sw

aps

5

AO

1.1

(2

) A

O1

.2

(1)

AO

2.1

(1

) A

O2

.2

(1)

Allo

w (fu

ll) cre

dit fo

r table

s s

ho

win

g th

e

bub

ble

sort b

ein

g c

om

ple

ted.

1biv

1 m

ark

per b

ulle

t O

(n)

Lin

ea

r

B

est tim

e g

row

s a

t the s

am

e ra

te a

s th

e n

um

ber o

f ele

me

nts

T

his

is th

e c

ase w

hen

the

da

ta is

alre

ad

y in

ord

er

O(n

2)

P

oly

nom

ial / Q

uad

ratic

W

ors

t and a

ve

rag

e tim

e is

pro

portio

na

l to th

e s

qua

re (p

oly

nom

ial)

of th

e n

um

ber o

f ele

me

nts

W

ors

t case

is w

hen

the d

ata

is in

itially

in th

e re

ve

rse

ord

er

O(1

) C

onsta

nt

W

ill alw

ays ta

ke

the s

am

e a

mo

unt o

f mem

ory

(in a

dd

ition to

the

list its

elf).

6

AO

1.1

(3

) A

O1

.2

(3)

No

te: F

irst M

ark

Po

int is

for th

e id

en

tifica

tion,

se

con

d M

ark

Po

int is

for th

e d

escrip

tion

No

te: D

o n

ot a

llow

descrip

tion

s re

latin

g to

time

co

mp

lexity

for 'W

ors

t Spa

ce O

(1)'

No

te: D

o n

ot a

llow

‘eq

ual to

’ in d

escrip

tion

s,

O(n

) and O

(n2) g

row

in p

ropo

rtion to

the n

um

ber

of ite

ms

2ai

Bin

ary

Tre

e / B

inary

Se

arc

h T

ree

1

AO

2.1

(1

)

2a

ii

1 m

ark

per b

ulle

t

1

st la

ye

r: Lily

2

nd la

ye

r: Da

isy, S

unflo

we

r

3

rd laye

r: Beg

onia

, Ho

sta

, Pe

on

y

4th la

ye

r: Ro

se

3

AO

1.2

(1

) A

O2

.1

(1)

AO

2.2

(1

)

2a

iii

1 m

ark

per b

ulle

t to m

ax 4

. Ma

x 2

mark

s fo

r no a

pplic

atio

n to

the tre

e.

D

epth

first s

tarts

at th

e ro

ot (L

ily)

and

go

es a

ll the w

ay d

ow

n o

ne

bra

nch

to th

e b

otto

m (B

eg

onia

)

It s

tore

s w

hic

h n

od

es it h

as v

isite

d / p

ush

es n

od

es v

isite

d o

nto

a

sta

ck

W

hen

it ca

nn

ot g

o a

ny fu

rther

It then b

acktra

cks/re

turn

s to

the p

revio

us n

od

e

A

nd c

ontin

ue

s to

backtra

ck u

ntil a

nod

e is

reach

ed

with

un

vis

ited

ch

ildre

n.

and

ch

ecks d

ow

n th

at b

ran

ch

In

the tre

e s

how

n, a

fter v

isitin

g B

eg

onia

, the a

lgo

rithm

wo

uld

b

acktra

ck to

Dais

y…

and

wo

uld

then

vis

it Ho

sta

(Acce

pt a

ny o

ther e

xa

mp

le)

4

AO

1.1

(1

) A

O1

.2

(1)

AO

2.1

(1

) A

O2

.2

(1)

2bi

1 m

ark

per b

ulle

t

C

orre

ct N

extP

oin

ter v

alu

es

S

uita

ble

en

d/n

ull p

oin

ter

Da

ta

item

D

ata

N

extP

oin

ter

0

Be

go

nia

1

1

Da

isy

2

2

Ho

sta

3

3

Lily

4

4

Pe

on

y

5

5

Ro

se

6

6

Su

nflo

we

r n

ull

2

AO

2.1

(2

)

Exa

ct v

alu

es o

nly

. Allo

w -1

for n

ull p

oin

ter o

r e

qu

iva

lent s

uch a

s Φ

. D

o n

ot a

llow

a b

lank o

r 0.

2b

ii

1 m

ark

per b

ulle

t

L

ave

nd

er a

dd

ed

in p

ositio

n 7

Ho

sta

poin

ts to

7

Lave

nd

er p

oin

ts to

3

Da

ta

item

D

ata

N

extP

oin

ter

0

Be

go

nia

1

1

Da

isy

2

2

Ho

sta

7

3

Lily

4

4

Pe

on

y

5

5

Ro

se

6

6

Su

nflo

we

r n

ull

7

Lave

nd

er

3

3

AO

1.2

(1

) A

O2

.2

(2)

Do

no

t cre

dit a

nsw

ers

tha

t do n

ot p

lace la

ve

nd

er

in p

ositio

n 7

an

d th

en u

pd

ate

po

inte

r positio

ns

2b

iii

1 m

ark

per b

ulle

t

T

rave

rse th

e lis

t to th

e ite

m im

me

dia

tely

prio

r to th

e ite

m to

be

rem

oved (1

)

wh

ich

is D

ata

Item

1 - D

ais

y

F

ind th

e v

alu

e o

f the N

extP

oin

ter o

f the ite

m to

be re

mo

ve

d

wh

ich

is th

e N

extP

oin

ter o

f Da

taIte

m 2

- Ho

sta

, va

lue 7

S

et th

e n

extP

oin

ter o

f the

item

prio

r to th

e ite

m to

be re

mo

ve

d to

th

e N

extP

oin

ter v

alu

e o

f the D

ata

Item

to b

e re

move

d

upd

ate

the N

extP

oin

ter o

f Da

taIte

m 1

- Da

isy fro

m 2

to 7

(L

ave

nd

er)

4

AO

1.1

(1

) A

O1

.2

(1)

AO

2.2

(2

)

Fin

d th

e ite

m b

efo

re ite

m to

be d

ele

ted (D

ais

y)

Fin

d n

extP

tr of ite

m to

be

de

lete

d (H

osta

) U

pda

te n

extP

tr of th

e ite

m b

efo

re (D

ais

y) to

the

nextP

tr of ite

m to

be d

ele

ted (H

osta

) i.e

. Da

isy 2

is u

pd

ate

d to

Da

isy 7

A

llow

FT

from

2b(ii/iii) if c

and

idate

ha

s u

sed

ta

ble

in fig

2.1

(e.g

. Da

isy w

ould

no

w p

oin

t to

Lily

at p

ositio

n 3

)

2b

iv

1 m

ark

per b

ulle

t

S

tart a

t the firstElement

in th

e lis

t

C

orre

ctly

loop

ing u

ntil n

ull p

oin

ter fo

un

d / e

nd o

f list

O

utp

uttin

g th

e d

ata

ele

me

nt

A

cce

ssin

g th

e p

oin

ter to

the n

ext e

lem

ent

A

ppro

pria

te c

om

me

nt(s

) e

.g.

currentElement = firstElement

while(currentElement != null) //Continue until last

node

print(plantList[currentElement,0])

currentElement = plantList[currentElement,1]

endwhile

5

AO

2.1

(1

) A

O2

.2

(2)

AO

3.2

(2

)

No

te: S

olu

tion m

ust u

tilise

po

inte

rs in

a lin

ke

d

list; it c

ann

ot u

se a

FO

R lo

op

as th

e n

um

ber o

f e

lem

en

ts is

not k

now

n a

nd th

e d

ata

is n

ot in

o

rde

r by in

de

x n

um

ber

No

te: id

entifie

rs g

ive

n in

the q

uestio

n a

s

plantList

and firstElement

sh

ou

ld b

e

used

accura

tely

in th

e s

olu

tion

N

ote

: allo

w c

redit fo

r answ

ers

that in

terp

ret th

e

data

stru

ctu

re a

s a

n a

rray o

f record

s/s

tructu

res

with

data

/poin

ter fie

lds

3a

i if

1

AO

1.1

(1

)

3aii

1 m

ark

per b

ulle

t

B

ranch

ing d

ecid

es w

hic

h c

od

e is

run / o

nly

runs c

ode

on

ce

Ite

ratio

n re

pe

ate

dly

runs th

e s

am

e c

ode

in th

e s

am

e s

eq

uence

2

AO

1.2

(2

)

3a

iii n

um

1, n

um

2

1

AO

2.1

(1

)

Exa

ct id

en

tifier n

am

es re

qu

ired

3aiv

1 m

ark

per b

ulle

t

B

y V

alu

e

the o

rigin

al v

alu

es d

o n

ot n

ee

d to

be m

odifie

d

byR

ef w

ould

no

t wo

rk / w

ould

ca

use

the ro

utin

e to

cra

sh

2

AO

2.2

(2

)

3av

1 m

ark

per b

ulle

t

G

ive

s th

e re

ma

inder a

fter d

ivis

ion

E

.g. 1

0 M

OD

3 =

1

2

AO

1.1

(1

) A

O1

.2

(1)

3b

1 m

ark

per b

ulle

t to m

ax 3

N

um

2 !=

0 th

ere

fore

retu

rn G

CD

(20,1

0)

N

um

2 !=

0 th

ere

fore

retu

rn G

CD

(10,0

)

F

inal re

turn

va

lue =

10

3

AO

2.1

(1

) A

O2

.2

(2)

Allo

w F

T fo

r num

eric

al e

rrors

3ci

1 m

ark

for b

en

efit, 1

ma

rk fo

r dra

wb

ack

Be

ne

fit:

T

he p

rog

ram

ca

n/m

igh

t run fa

ste

r

C

ann

ot ru

n o

ut o

f sta

ck s

pace

/mem

ory

E

asie

r to tra

ce/fo

llow

D

raw

back:

Ite

ratio

n c

an le

ad

to le

ng

thie

r co

de

Ite

ratio

n c

an le

ad

to c

ode

that lo

oks m

ore

co

mp

lex / is

hard

er to

u

nd

ers

tand

so

me

pro

ble

ms a

re m

ore

ele

ga

ntly

co

de

d w

ith a

recurs

ive

so

lutio

n

2

AO

1.1

(1

)

3cii

1 m

ark

for e

ach c

orre

ct s

tate

me

nt

function newGCD(num1, num2)

temp = 0

while (num2 != 0)

temp = num2

num2 = num1 MOD num2

num1 = temp

endwhile

return num1

endfunction

4

AO

2.2

(2

) A

O3

.2

(2)

4a

1 m

ark

per b

ulle

t

S

he c

an s

plit th

e p

rob

lem

dow

n in

to s

ub p

rob

lem

s

It w

ill cre

ate

s a

mo

re m

an

ag

eab

le p

roble

m / s

imple

r to

und

ers

tand / m

ain

tain

ca

n ta

ckle

ea

ch s

ub p

roble

m in

de

pe

nd

en

tly

2

AO

1.2

(1

) A

O2

.2

(1)

4bi

1 m

ark

per b

ulle

t, ma

x 2

per s

ub-p

roce

dure

e

.g.

Se

lect c

hara

cte

r (nam

e, g

end

er)

G

ive

s th

e u

ser o

ptio

ns fo

r ch

oo

sin

g a

ch

ara

cte

r

C

hoo

se le

ve

l

G

ive

the u

ser th

e c

hoic

e o

f leve

l (easy, n

orm

al, c

ha

lleng

ing

) and

take

the u

se

r inpu

t

T

ouch e

ne

my

C

alle

d to

de

term

ine if th

e c

hara

cte

r touch

es a

n e

ne

my

L

ose

life

R

em

ove

a life

, if <0

then

gam

e o

ve

r

E

nd le

ve

l

M

ove

on

to n

ext le

ve

l O

ne m

ark

for id

en

tifyin

g s

ensib

le s

ub

routin

e, 1

ma

rk fo

r descrip

tion

6

AO

2.1

(2

) A

O2

.2

(2)

AO

3.2

(2

)

Do

no

t aw

ard

any u

ser in

put re

late

d p

roced

ure

s

e.g

. Left/R

igh

t inpu

t (but c

hara

cte

r mo

vem

ent

outp

ut o

n s

cre

en le

ft/right w

ould

be

va

lid)

Allo

w o

the

r reaso

na

ble

respo

nse

s fro

m th

e

sce

na

rio e

.g. g

ene

rate

en

em

y()

4bii

1 m

ark

per b

ulle

t

D

ecis

ion b

ase

d o

n w

hat th

e u

ser h

as in

pu

t

E

.g. If th

ey c

lick le

ft mo

ve

the c

hara

cte

r left // if th

ey c

lick rig

ht

mo

ve

the c

hara

cte

r right // if th

ey c

lick s

pace b

ar m

ake

the

ch

ara

cte

r jum

p

2

AO

2.1

(1

) A

O2

.2

(1)

4biii

1 m

ark

per b

ulle

t

T

he re

sult fro

m o

ne p

roce

ss / p

roce

du

re fe

ed

s in

to th

e n

ext

E

.g. th

e re

sult o

f dete

ctin

g a

ch

ara

cte

r touch

ing

an

en

em

y fe

eds

into

redu

cin

g th

e n

um

ber o

f live

s

2

AO

1.2

(1

) A

O2

.2

(1)

No

te: 1

Ma

rk M

ax fo

r a g

en

eric

descrip

tion

of

pip

elin

ing

4c

1 m

ark

for fin

al s

olu

tion, m

ax 5

for s

how

ing

the s

tag

es

M

ark

A a

s th

e c

urre

nt n

od

e in

itially

R

ecord

B =

1, C

= 2

(mark

A a

s v

isite

d)

R

ecord

E =

5 (a

nd m

ark

B a

s v

isite

d)

(R

ecord

D =

3, F

= 5

(and

mark

B a

s v

isite

d)

C

han

ge

E to

4 (o

ve

rridin

g p

revio

us v

alu

e, a

nd

ma

rk D

as v

isite

d)

R

ecord

G =

6 (a

nd m

ark

E a

s v

isite

d)

Do

no

t ch

ang

e G

as g

reate

r than c

urre

nt (m

ark

F a

s v

isite

d)

(G

as v

isite

d) H

= 1

0 (M

ark

G a

s v

isite

d)

S

olu

tion

: A-C

-D-E

-G-H

pa

th le

ng

th 1

0

No

de

Vis

ited

Fro

m A

P

revio

us N

ode

A

0

- 1

Ma

rk

B

1

A

1 M

ark

C

2

A

D

3

C

1 M

ark

F

5

C

E

5 4

B

D

2 M

ark

s

Initia

l vis

it, plu

s

ove

rride

va

lues

G

6

E

1 M

ark

H

10

G

1 M

ark

6

AO

1.2

(1

) A

O2

.2

(3)

AO

2.2

(2

)

Gu

idan

ce –

1 m

ark

only

for s

tatin

g th

e s

olu

tion

of A

-C-D

-E-G

-H le

ng

th 1

0

4d

Mark

Ban

d 3

– H

igh

lev

el

(7-9

mark

s)

The c

andid

ate

dem

onstra

tes a

thoro

ugh k

no

wle

dge a

nd u

nders

tan

din

g o

f IDE

s;

the m

ate

rial is

genera

lly a

ccura

te a

nd d

eta

iled.

The c

andid

ate

is a

ble

to a

pply

their k

no

wle

dge

an

d u

nders

tand

ing d

irectly

and

consis

tently

to th

e c

onte

xt p

rovid

ed.

Evid

ence/e

xam

ple

s w

ill be

explic

itly re

levan

t to th

e e

xpla

natio

n.

The c

andid

ate

is a

ble

to w

eig

h u

p th

e c

onte

xt w

hic

h re

sults

in a

sup

porte

d a

nd

realis

tic ju

dgm

ent a

s to

wh

eth

er ID

Es a

re u

sefu

l in th

is c

onte

xt.

There

is a

we

ll-develo

pe

d lin

e o

f reason

ing w

hic

h is

cle

ar a

nd lo

gic

ally

stru

ctu

red. T

he

info

rmatio

n p

resente

d is

rele

va

nt a

nd s

ubsta

ntia

ted.

Mark

Ban

d 2

– M

id le

vel

(4-6

mark

s)

The c

andid

ate

dem

onstra

tes re

asonab

le k

nole

dg

e a

nd

und

ers

tand

ing

of ID

Es;

the m

ate

rial is

genera

lly a

ccura

te b

ut a

t times u

nderd

eve

lop

ed.

The c

andid

ate

is a

ble

to a

pply

their k

no

wle

dge

an

d u

nders

tand

ing d

irectly

to th

e

conte

xt p

rovid

ed a

ltho

ugh

one o

r two o

pp

ortu

nitie

s a

re m

issed.

Evid

ence/e

xam

ple

s a

re fo

r the m

ost p

art im

plic

itly re

levan

t to th

e e

xpla

natio

n.

The c

andid

ate

makes a

reasona

ble

atte

mpt to

com

e to

a c

onclu

sio

n s

ho

win

g

som

e re

cognitio

n o

f influ

en

cin

g fa

cto

rs th

at w

ou

ld d

ete

rmin

e w

he

ther ID

Es a

re

usefu

l in th

is c

onte

xt.

There

is a

line

of re

ason

ing

pre

sente

d w

ith s

om

e s

tructu

re. T

he in

form

atio

n

pre

sente

d is

in th

e m

ost p

art re

levan

t an

d s

up

porte

d b

y s

om

e e

vid

ence

M

ark

Ban

d 1

– L

ow

Lev

el

(1-3

mark

s)

The c

andid

ate

dem

onstra

tes a

basic

kno

wle

dg

e o

f IDE

s w

ith lim

ited

unders

tand

ing s

ho

wn; th

e m

ate

rial is

basic

an

d c

onta

ins s

om

e in

accura

cie

s.

The c

andid

ate

s m

akes a

limite

d a

ttem

pt to

ap

ply

acq

uire

d k

no

wle

dge a

nd

unders

tand

ing to

the c

on

text p

rovid

ed.

The c

andid

ate

pro

vid

es n

oth

ing m

ore

than a

n u

nsupp

orte

d a

ssertio

n.

The in

form

atio

n is

basic

an

d c

om

unic

ate

d in

an u

nstru

ctu

red w

ay. T

he

info

rmatio

n is

supp

orte

d b

y lim

ited e

vid

ence a

nd th

e re

latio

nsh

ip to

the e

vid

ence

may n

ot b

e c

lear.

0 m

ark

s

No a

ttem

pt to

answ

er th

e q

uestio

n o

r resp

onse is

not w

orth

y o

f cre

dit.

9

AO

1.1

(2

) A

O1

.2

(2)

AO

2.1

(2

) A

O3

.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t T

ools

to a

id w

riting

C

olo

ure

d fo

nt

P

redic

tive

text

A

uto

-corre

ct

To

ols

to a

id d

e-b

ug

gin

g

S

tepp

ing

B

reak p

oin

ts

V

aria

ble

wa

tch

win

do

w

AO

2: A

pp

licatio

n

e.g

.

C

an w

rite s

ub

routin

es fo

r the p

rog

ram

and

it w

ill tell y

ou w

hat p

ara

mete

rs a

re n

ee

de

d

A

llow

yo

u to

run th

e p

rog

ram

with

ou

t exitin

g

the s

oftw

are

/ havin

g to

load

a s

epara

te

co

mp

iler

In

teg

rate

s o

ther to

ols

such

as v

ers

ion

co

ntro

l.

C

an re

du

ce s

pellin

g e

rrors

C

an u

se to

fix e

rrors

that m

igh

t occur /

debug

A

O3

: Eva

lua

tion

e.g

.

U

se

r friend

ly fo

r novic

es

In

cre

ase s

pee

d o

f writin

g

F

ew

er m

ista

ke

s

In

cre

ase s

pee

d o

f testin

g / fin

din

g e

rrors

C

olla

bo

rativ

e te

am

wo

rkin

g fa

cilita

ted

5a

1 m

ark

per b

ulle

t to m

ax 6

. M

ax 4

if ge

ne

ric d

escrip

tion g

ive

n w

ith n

o a

pp

lica

tion

M

ax 4

if a d

iag

ram

ma

tic s

olu

tion

is g

ive

n w

ith n

o d

escrip

tion

S

plits

the lis

t in h

alf re

pea

ted

ly…

until it is

in in

dep

en

den

t arra

ys / e

lem

ents

e.g

. 2, 1

8, 6

, 4, 1

2,

3

C

om

pa

re th

e firs

t two

item

s (in

de

x 0

an

d 1

) e.g

. 2, 1

8

and

co

mb

ine to

cre

ate

a n

ew

arra

y in

de

sce

nd

ing

ord

er i.e

. 18,

2

R

epe

at w

ith in

dexe

s 2

an

d 3

(6, 4

), then

4 a

nd

5 (1

2, 3

)

C

om

pa

re th

e firs

t ele

men

t in th

e firs

t two

ne

w a

rrays

Ch

oo

se th

e la

rge

st e

lem

ent, w

riting th

is to

the n

ew

arra

y firs

t

repe

at u

ntil n

o e

lem

ents

left

C

om

bin

e th

e tw

o re

ma

inin

g lis

ts in

to o

ne lis

t

e.g

. [2

, 18, 6

, 4, 1

2, 3

] [2

, 18, 6

] [4, 1

2, 3

] [2

, 18] [6

] [4, 1

2] [3

] [2

] [18] [6

] [4] [1

2] [3

] [1

8, 2

] [6, 4

] [12, 3

] [1

8, 6

, 4, 2

] [12, 3

] [1

8, 1

2, 6

, 4, 3

, 2]

e.g

. [2

, 18, 6

, 4, 1

2, 3

] [2

, 18, 6

] [4, 1

2, 3

] [2

, 18] [6

] [4, 1

2] [3

] [2

] [18] [6

] [4] [1

2] [3

] [1

8 2

] [6] [1

2 4

] [3]

[18 6

2] [1

2 4

3]

[18, 1

2, 6

, 4, 3

, 2]

6

AO

1.2

(3

) A

O2

.2

(3)

Allo

w m

ax 5

if corre

ct d

escrip

tion

but in

a

scen

din

g o

rder.

5b

1 m

ark

per b

ulle

t

M

erg

e s

ort m

igh

t cre

ate

a n

ew

arra

y e

ach

time it s

plits

and

m

erg

es / o

ften im

ple

me

nte

d re

curs

ive

ly w

hic

h p

lace

s a

dd

itiona

l d

ata

on th

e s

tack

In

sertio

n s

ort d

oe

s n

ot u

se

an

y a

dd

itiona

l arra

ys//In

sertio

n s

ort is

a

n in

-pla

ce a

lgo

rithm

.

2

AO

1.2

(2

)

6

Mark

Ban

d 3

– H

igh

lev

el

(7-9

mark

s)

The c

andid

ate

dem

onstra

tes a

thoro

ugh k

no

wle

dge a

nd u

nders

tan

din

g o

f data

m

inin

g; th

e m

ate

rial is

ge

ne

rally

accura

te a

nd d

eta

iled.

The c

andid

ate

is a

ble

to a

pply

their k

no

wle

dge

an

d u

nders

tand

ing d

irectly

and

consis

tently

to th

e c

onte

xt p

rovid

ed.

Evid

ence/e

xam

ple

s w

ill be

explic

itly re

levan

t to th

e e

xpla

natio

n.

The c

andid

ate

is a

ble

to w

eig

h u

p th

e c

onte

xt w

hic

h re

sults

in a

sup

porte

d a

nd

realis

tic ju

dgm

ent a

s to

wh

eth

er it is

possib

le to

use d

ata

min

ing in

this

conte

xt.

There

is a

we

ll-develo

pe

d lin

e o

f reason

ing w

hic

h is

cle

ar a

nd lo

gic

ally

stru

ctu

red. T

he

info

rmatio

n p

resente

d is

rele

va

nt a

nd s

ubsta

ntia

ted.

Mark

Ban

d 2

– M

id le

vel

(4-6

mark

s)

The c

andid

ate

dem

onstra

tes re

asonab

le k

no

wle

dg

e a

nd u

nders

tan

din

g o

f data

m

inin

g; th

e m

ate

rial is

ge

ne

rally

accura

te b

ut a

t times u

nderd

evelo

ped

. T

he c

andid

ate

is a

ble

to a

pply

their k

no

wle

dge

an

d u

nders

tand

ing d

irectly

to th

e

conte

xt p

rovid

ed a

ltho

ugh

one o

r two o

pp

ortu

nitie

s a

re m

issed.

Evid

ence/e

xam

ple

s a

re fo

r the m

ost p

art im

plic

itly re

levan

t to th

e e

xpla

natio

n.

Th

e c

and

idate

makes a

reaso

na

ble

atte

mpt to

com

e to

a c

onclu

sio

n

sh

ow

ing

so

me re

cog

nitio

n o

f influ

en

cin

g fa

cto

rs th

at w

ould

de

term

ine

wh

eth

er it is

possib

le to

use d

ata

min

ing

. T

here

is a

line

of re

ason

ing

pre

sente

d w

ith s

om

e s

tructu

re. T

he in

form

atio

n

pre

sente

d is

in th

e m

ost p

art re

levan

t an

d s

up

porte

d b

y s

om

e e

vid

ence

. M

ark

Ban

d 1

– L

ow

Lev

el

(1-3

mark

s)

The c

andid

ate

dem

onstra

tes a

basic

kno

wle

dg

e o

f data

min

ing w

ith lim

ited

unders

tand

ing s

ho

wn; th

e m

ate

rial is

basic

an

d c

onta

ins s

om

e in

accura

cie

s.

The c

andid

ate

s m

akes a

limite

d a

ttem

pt to

ap

ply

acq

uire

d k

no

wle

dge a

nd

unders

tand

ing to

the c

on

text p

rovid

ed.

The c

andid

ate

pro

vid

es n

oth

ing m

ore

than a

n u

nsupp

orte

d a

ssertio

n.

The in

form

atio

n is

basic

an

d c

om

unic

ate

d in

an u

nstru

ctu

red w

ay. T

he

info

rmatio

n is

supp

orte

d b

y lim

ited e

vid

ence a

nd th

e re

latio

nsh

ip to

the e

vid

ence

may n

ot b

e c

lear.

0 m

ark

s

No a

ttem

pt to

answ

er th

e q

uestio

n o

r resp

onse is

not w

orth

y o

f cre

dit.

9

AO

1.1

(2

) A

O1

.2

(2)

AO

2.1

(2

) A

O3

.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t

E

xtra

ctin

g d

ata

from

data

ba

ses

U

sin

g la

rge d

ata

sets

L

oo

kin

g fo

r patte

rns/s

pecific

occurre

nce

s o

f d

ata

G

ath

erin

g d

ata

that c

an b

e a

na

lyse

d a

nd

u

sed

to in

form

decis

ions

A

O2

: Ap

plic

atio

n

e.g

.

U

se

to fin

d o

ut w

hat h

is u

sers

do

F

ind fe

atu

res th

at a

re u

se

d m

ost o

ften

F

ind fe

atu

res th

at a

re n

ot u

sed

F

ind o

ut w

hat p

eo

ple

in h

is ta

rget a

ge g

rou

p

do o

n o

ther s

ites

F

ind o

ut c

hara

cte

ristic

s o

f peo

ple

wh

o u

se

the s

ite

AO

3: E

va

lua

tion

e

.g.

C

an id

en

tify a

rea

s to

focu

s a

ttentio

n

S

ave

time

an

d m

one

y b

y id

en

tifyin

g a

reas

that a

re n

ot p

op

ula

r/use

d

N

ew

featu

res ta

rgete

d a

t sp

ecific

gro

up

s

co

uld

brin

g in

ne

w b

usin

ess e

.g. a

dve

rtisin

g

B

ut c

are

wo

uld

ne

ed to

be

ap

plie

d to

priv

acy

issu

es / G

DP

R a

nd p

ote

ntia

l imp

act o

n th

e

users

7ai

1 m

ark

per e

xa

mp

le

e.g

. N

o a

ctu

al im

ag

es s

ho

wn

Ite

ms a

re n

am

ed / la

be

lled

S

imp

lified la

yo

ut w

ith s

ha

pe

s

2

AO

2.1

(2

)

Allo

w a

ny re

aso

na

ble

exa

mp

les, b

ut th

ey m

ust

be fo

r diffe

rent a

sp

ects

7aii

1 m

ark

per b

ulle

t to m

ax 3

e

.g.

Re

du

ces c

om

ple

xity

of d

esig

n

R

edu

ces c

om

ple

xity

of p

rog

ram

min

g

R

edu

ce m

em

ory

/pro

cessin

g re

qu

irem

ents

C

ould

invo

lve

a la

rge

num

ber o

f imag

es th

at w

ould

take

e

xce

ssiv

e m

em

ory

R

eality

co

nta

ins th

ing

s th

at a

ren’t re

leva

nt to

a c

om

pute

r pro

gra

m

3

AO

1.1

(1

) A

O1

.2

(1)

AO

2.1

(1

)

No

te: d

o n

ot a

llow

answ

ers

rela

ted

to th

e u

ser

exp

erie

nce

/ user in

terp

reta

tion

, the q

uestio

n is

a

bo

ut th

e p

rodu

ctio

n o

f the s

yste

m

7aiii

1 m

ark

per e

xa

mp

le

e.g

. G

ard

en d

ime

nsio

ns/w

idth

/leng

th

N

um

be

r of ite

ms in

the g

ard

en

N

am

e o

f item

s in

the g

ard

en

L

oca

tion

of ite

ms in

the g

ard

en

3

AO

2.1

(3

)

7bi

1 m

ark

per b

ulle

t to m

ax 4

C

lass d

ecla

ratio

n

3

attrib

ute

s d

ecla

red

C

onstru

cto

r

takin

g p

ara

mete

rs

se

tting th

e a

ttribute

s to

the p

ara

me

ters

e.g.

class GardenItem

private itemName

private length

private width

public procedure new(pItemName, pLength, pWidth)

itemName = pItemName

length = pLength

width = pWidth

endprocedure

endclass

4

AO

1.1

(1

) A

O2

.1

(1)

AO

2.2

(1

) A

O3

.2

(1)

No

te th

at e

xa

mp

le a

nsw

ers

are

giv

en in

the

sp

ecific

atio

n p

se

udo

code

. An

y p

seu

do

cod

e

answ

er th

at c

an b

e u

nd

ers

tood b

y a

‘com

pete

nt

pro

gra

mm

er’ s

hou

ld b

e a

cce

pte

d

7bii

1 m

ark

per b

ulle

t

C

lass d

ecla

ratio

n in

heritin

g fro

m gardenItem

A

dditio

na

l 3 p

rope

rties d

ecla

red

as p

riva

te

C

onstru

cto

r takes a

ll 5 p

ara

mete

rs

U

se

of s

upe

r (or e

qu

iva

lent) to

se

t su

per c

lass p

ara

mete

rs

R

em

ain

de

r of p

rope

rties s

et to

para

mete

rs

e.g

. class Tree inherits GardenItem

private height

private sun

private shade

public procedure new(pName, pHeight, pLenWidth,

pSun, pShade)

super.itemName = pName

super.length = pLenWidth

super.width = pLenWidth

height = pHeight

sun = pSun

shade = pShade

endprocedure

endclass

5

AO

1.1

(1

) A

O2

.2

(1)

AO

3.2

(3

)

Acce

pt s

olu

tions th

at c

all th

e p

are

nt’s

co

nstru

cto

r. class Tree inherits GardenItem

private height

private sun

private shade

public procedure new(pName,

pHeight, pLenWidth, pSun, pShade)

height = pHeight

sun = pSun

shade = pShade

super.new(pName,pLenWidth,pLenWidth)

endprocedure

endclass

7biii

1 m

ark

per b

ulle

t

D

ecla

ratio

n o

f insta

nce o

f tree (i.e

. new Tree

)

S

torin

g re

sult in

firstTree

A

ll para

me

ters

inclu

de

d a

nd in

the s

am

e o

rder a

s 7

bii

with

ap

pro

pria

te d

ata

typ

es

e.g

. firstTree = new Tree("Common Oak",40,40,true, true)

4

AO

1.1

(1

) A

O2

.2

(1)

AO

3.2

(2

)

7biv

1 m

ark

per b

ulle

t

G

et m

eth

od d

ecla

ratio

n

R

etu

rns itemName

S

et m

eth

od d

ecla

ratio

n

take

s v

alu

e a

s a

para

me

ter

assig

ns p

ara

mete

r to itemName

e.g

. function getItemName()

return itemName

endfunction

procedure setItemName(newname)

itemName = newname

endprocedure

4

AO

1.2

(2

) A

O2

.2

(2)

7bv

1 m

ark

per b

ulle

t to m

ax 6

P

roced

ure

decla

ratio

n w

ith a

ll four p

ara

me

ters

L

oo

pin

g 1

00

0 tim

es / to

end

of a

rray

C

heckin

g if h

eig

ht a

nd

wid

th a

re le

ss th

an o

r eq

ual to

the

ma

xim

um

heig

ht a

nd w

idth

C

heckin

g if s

un a

nd

sh

ad

e m

atc

h

O

utp

uttin

g v

alu

e(s

) usin

g g

et m

eth

od

s

O

utp

ut a

n a

pp

ropria

te m

essag

e

O

utp

uts

a m

essag

e if n

o m

atc

hin

g tre

e is

foun

d

e.g

. procedure findTree(pHeight, pWidth, pSun, pShade)

flag = false

for i = 0 to 999

if treeArray[i].getHeight() <= pHeight then

if treeArray[i].getWidth() <= pWidth then

if treeArray[i].getSun() == pSun then

if treeArray[i].getShade() == pShade then

flag = true

print(treeArray[i].getItemName() + “

height: “ + treeArray[i].getHeight + “ width: “ +

treeArray[i].getWidth() + “ Sun?: “ +

treeArray[i].getSun() + “ Shade?: “ +

treeArray[i].getShade()

endif

endif

endif

endif

next count

if flag == false then

print(“No suitable trees”)

endif

endprocedure

6

AO

1.2

(1

) A

O2

.2

(2)

AO

3.2

(3

)

7c

Ma

rk B

an

d 3

– H

igh

leve

l (7

-9 m

ark

s)

Th

e c

an

did

ate

dem

onstra

tes a

tho

roug

h k

no

wle

dge

and

unde

rsta

nd

ing

of c

ach

ing

an

d

reu

sea

ble

co

mpo

ne

nts

; the

ma

teria

l is g

en

era

lly a

ccu

rate

and

de

taile

d.

Th

e c

an

did

ate

is a

ble

to a

pp

ly th

eir k

no

wle

dge

and

und

ers

tan

din

g d

irectly

an

d

co

nsis

ten

tly to

the

co

nte

xt p

rovid

ed

. E

vid

en

ce/e

xa

mp

les w

ill be

exp

licitly

rele

va

nt to

the

exp

lan

atio

n.

Th

e c

an

did

ate

is a

ble

to w

eig

h u

p th

e u

se

of b

oth

ca

chin

g a

nd

reusa

ble

co

mpo

nen

ts

wh

ich

results

in a

su

ppo

rted

an

d re

alis

tic ju

dg

me

nt a

s to

wh

eth

er it is

possib

le to

use

the

m in

this

con

text.

Th

ere

is a

we

ll-deve

lop

ed

line

of re

aso

nin

g w

hic

h is

cle

ar a

nd

logic

ally

stru

ctu

red

. Th

e

info

rma

tion

pre

sen

ted

is re

leva

nt a

nd

su

bsta

ntia

ted

. M

ark

Ban

d 2

– M

id le

ve

l (4

-6 m

ark

s)

Th

e c

an

did

ate

dem

onstra

tes re

ason

able

kn

ole

dge

and

und

ers

tand

ing o

f ca

ch

ing

and

re

usea

ble

co

mpo

ne

nts

; the

ma

teria

l is g

en

era

lly a

ccu

rate

but a

t times u

nd

erd

eve

lope

d.

Th

e c

an

did

ate

is a

ble

to a

pp

ly th

eir k

no

wle

dge

and

und

ers

tan

din

g d

irectly

to th

e c

on

text

pro

vid

ed

alth

ou

gh

one

or tw

o o

pp

ortu

nitie

s a

re m

isse

d. E

vid

en

ce

/exa

mp

les a

re fo

r the

m

ost p

art im

plic

itly re

leva

nt to

the

exp

lan

atio

n.

Th

e c

an

did

ate

ma

kes a

reason

ab

le a

ttem

pt to

com

e to

a c

on

clu

sio

n s

ho

win

g s

om

e

reco

gn

ition

of in

flue

ncin

g fa

cto

rs th

at w

ou

ld d

ete

rmin

e w

he

the

r it is p

ossib

le to

use

ca

ch

ing a

nd re

usa

ble

co

mp

onm

en

ts in

this

co

nte

xt.

Th

ere

is a

line

of re

aso

nin

g p

rese

nte

d w

ith s

om

e s

tructu

re. T

he

info

rma

tion

pre

sen

ted is

in

the

mo

st p

art re

leva

nt a

nd s

up

po

rted

by s

om

e e

vid

en

ce

M

ark

Ban

d 1

– L

ow

Le

ve

l (1

-3 m

ark

s)

Th

e c

an

did

ate

dem

onstra

tes a

ba

sic

kn

ow

led

ge

of c

ach

ing

an

d re

use

ab

le c

om

pon

en

ts

with

limite

d u

nd

ers

tan

din

g s

how

n; th

e m

ate

rial is

basic

and

co

nta

ins s

om

e in

accu

racie

s.

Th

e c

an

did

ate

s m

ake

s a

limite

d a

ttem

pt to

ap

ply

acq

uire

d k

no

wle

dg

e a

nd

und

ers

tan

din

g

to th

e c

on

text p

rovid

ed

. T

he

ca

ndid

ate

pro

vid

es n

oth

ing

mo

re th

an

an u

nsu

pp

orte

d a

sse

rtion.

Th

e in

form

atio

n is

ba

sic

an

d c

om

un

icate

d in

an

unstru

ctu

red w

ay. T

he

info

rma

tion

is

su

ppo

rted b

y lim

ited

evid

en

ce

an

d th

e re

latio

nsh

ip to

the

evid

en

ce m

ay n

ot b

e c

lea

r. 0

ma

rks

No a

ttem

pt to

answ

er th

e q

uestio

n o

r resp

onse

is n

ot w

orth

y o

f cre

dit.

9

AO

1.1

(2

) A

O1

.2

(2)

AO

2.1

(2

) A

O3

.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t C

achin

g:

D

ata

that h

as b

ee

n u

sed is

sto

red in

ca

che

/RA

M in

ca

se

it is n

ee

de

d a

ga

in

A

llow

s fa

ste

r access fo

r futu

re u

se

Re

usa

ble

co

mp

on

ents

O

ne p

iece o

f co

de

ca

n b

e u

sed

in m

ultip

le

pla

ces / c

alle

d m

any tim

es

U

se

of s

ubro

utin

es / p

roce

du

res / fu

nctio

ns

U

se

of c

lasses

U

se

of e

xte

rna

l libra

ries

AO

2: A

pp

licatio

n

S

tore

item

s in

ca

ch

e

S

tore

req

uire

me

nts

in c

ach

e

S

tore

gard

en

layo

ut in

cach

e

R

euse

sh

ap

es / d

esig

ns

T

he u

se o

f a c

lass a

llow

s re

plic

atio

n

AO

3: E

va

lua

tion

e.g

.

F

aste

r deve

lopm

ent

F

aste

r/easie

r futu

re a

dap

tatio

n

B

ette

r perfo

rma

nce o

f pro

gra

m

T

ake

s m

ore

time to

pla

n/d

esig

n to

make u

se

of b

oth

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 (Oxford Cambridge and RSA Examinations) Head office Telephone: 01223 552552 Facsimile: 01223 552553 © OCR 2019

OCR (Oxford Cambridge and RSA Examinations)

The Triangle Building

Shaftesbury Road

Cambridge

CB2 8EA OCR Customer Contact Centre

Education and Learning

Telephone: 01223 553998

Facsimile: 01223 552627

Email: [email protected] www.ocr.org.uk For staff training purposes and as part of our quality assurance programme your call may be recorded or monitored

A Level Computer ScienceH446/02 Algorithms and programming

Friday 15 June 2018 – MorningTime allowed: 2 hours 30 minutes

You may use:• a ruler (cm/mm)• an HB pencil

Do not use:• a calculator

INSTRUCTIONS• Use black ink.• Complete the boxes above with your name, centre number and candidate number.• Answer all the questions. • Write your answer to each question in the space provided. Additional paper may be

used if required but you must clearly show your candidate number, centre number and question number(s).

• Do not write in the barcodes.

INFORMATION• The total mark for this paper is 140.• The marks for each question are shown in brackets [ ].• Quality of extended responses will be assessed in questions marked with an

asterisk (*).• This document consists of 28 pages.

Turn over© OCR 2018 [601/4911/5]DC (KS/CB) 157976/5

Last name

First name

Candidatenumber

Centrenumber

Oxford Cambridge and RSA

*7015026144*

OCR is an exempt Charity

* H 4 4 6 0 2 *

2Section A

Answer all the questions.

1 A program stores entered data in a binary search tree.

The current contents of the tree are shown:

Spain

NorwayGermanyAustria

Italy

France

(a) Complete the diagram to show the contents of the tree after the following data is added:

England, Scotland, Wales, Australia [3]

3

Turn over© OCR 2018

(b) Show the order of the nodes visited in a breadth first traversal on the following tree.

Spain

NorwayGermanyAustria

Italy

France

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………

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

[3]

4 (c) A pseudocode algorithm is written to search the tree to determine if the data item “Sweden” is

in the tree.

The function currentNode.left()returns the node positioned to the left of currentNode.

The function currentNode.right()returns the node positioned to the right of currentNode.

function searchForData(currentNode:byVal, searchValue:byVal)

thisNode = getData(……………………………………………………………………………………………………………)

if thisNode == …………………………………………………………………………………………………………… then

return ……………………………………………………………………………………………………………

elseif thisNode < searchValue then

if currentNode.left() != null then

return (searchForData(currentNode.left(), searchValue))

else

return ……………………………………………………………………………………………………………

endif

else

if …………………………………………………………………………………………………………… != null then

return (searchForData(currentNode.right(), searchValue))

else

return false

endif

endif

endfunction

(i) Complete the algorithm.

[5]

(ii) The algorithm needs to be used in different scenarios, with a range of different trees.

Identify two preconditions needed of a tree for this algorithm to work.

1 .........................................................................................................................................

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

5

Turn over© OCR 2018

BLANK PAGE

PLEASE DO NOT WRITE ON THIS PAGE

62 A company merger is joining five e-commerce retailers under one company, OCRRetail. Each

retailer has a different sales system and OCRRetail wants to develop one computer system that can be used by all the retailers.

Mary’s software development company has been employed to analyse and design a solution for

the company.

(a) (i) Two computational methods (techniques used to solve a problem using computational thinking) that Mary will use are problem recognition and decomposition.

State what is meant by problem recognition and decomposition.

Recognition ........................................................................................................................

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

Decomposition ...................................................................................................................

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

(ii) State one additional computational method.

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

(b) Mary plans to use data mining to generate information about OCRRetail’s customers. Mary will use this information to benefit the company.

(i) Define the term ‘data mining’.

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

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

(ii) Identify two pieces of information that data mining could provide OCRRetail about sales, and state how OCRRetail could make use of this information.

1 .........................................................................................................................................

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

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

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

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

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

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

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

2

[4]

7

Turn over© OCR 2018

(c) Mary has developed the program and is considering using performance modelling before installing the system.

(i) Define the term ‘performance modelling’.

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

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

(ii) Identify one way performance modelling could be used to test the new system.

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

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

(d) Mary created the program as a series of sub-programs that can be reused.

Describe one benefit of Mary creating reusable program components.

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

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

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

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

83 A puzzle has multiple ways of reaching the end solution. Fig. 3 shows a graph that represents all

possible routes to the solution. The starting point of the game is represented by A, the solution is represented by J. The other points in the graph are possible intermediary stages.

Fig. 3

(a) The graph in Fig. 3 is a visualisation of the problem.

(i) Identify one difference between a graph and a tree.

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

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

(ii) Explain how the graph is an abstraction of the problem.

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

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

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

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

(iii) Identify two advantages of using a visualisation such as the one shown in Fig. 3.

1 .........................................................................................................................................

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

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

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

2

[2]

9

Turn over© OCR 2018

(b) Demonstrate how Dijkstra’s algorithm would find the shortest path to the solution in Fig. 3.

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

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

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

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

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

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

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

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

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

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

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

.............................................................................................................................................. [7]

10 (c)* The creator of the puzzle has been told that the A* algorithm is more efficient at finding the

shortest path because it uses heuristics.

Compare the performance of Dijkstra’s algorithm and the A* search algorithm, making reference to heuristics, to find the shortest path to the problem.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.............................................................................................................................................. [9]

11

Turn over© OCR 2018

(d) A computer program version of the puzzle is to be developed. A programmer will use an IDE to debug the program during development.

Describe three features of an IDE that help debug the program.

1 .................................................................................................................................................

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

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

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

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

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

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

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

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

2

3 .................................................................................................................................................

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

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

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

[6]

12

© OCR 2018

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

4 A recursive function, generate, is shown.

function generate(num1:byval) if num1 > 10 then return 10 else return num1 + (generate(num1 + 1) DIV 2) endif endfunction

(a) Trace the algorithm to show the value returned when generate(7) is called. Show each step of your working.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(b) The parameter, num1, is passed by value.

Explain why the parameter was passed by value instead of by reference.

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

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

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

[2]

13

Turn over© OCR 2018

(c)* Parameters can be used to reduce the use of global variables.

Compare the use of parameters to global variables in recursive functions.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.............................................................................................................................................. [9]

14 (d) A student called Jason writes a recursive algorithm. The recursive algorithm uses more

memory than if Jason had written it as an iterative algorithm.

Explain why the recursive algorithm uses more memory than the iterative algorithm.

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

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

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

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

15

Turn over© OCR 2018

5 A computer program stores data input on a stack named dataItems. The stack has two sub-programs to add and remove data items from the stack. The stack is implemented as a 1D array, dataArray.

Sub-program Description

push() The parameter is added to the top of the stack

pop() The element at the top of the stack is removed

The current contents of dataItems are shown:

6

15

100

23

(a) Show the contents of the stack dataItems after each line of the following lines of code are run

01 push(13) 02 pop() 03 push(10) 04 push(20)

Line 01 Line 02 Line 03 Line 04 Line 01 Line 02 Line 03 Line 04

6

15

100

23

[4]

16 (b) The main program asks a user to push or pop an item from the stack. If the user chooses

‘push’, the data item is added to the stack. If the user chooses “pop”, the next item is removed from the stack, multiplied by 3 and output.

The main program is shown:

01 userAnswer = input("Would you like to push or pop an item?") 02 if userAnswer == "push" then 03 push(input("Enter data item")) 04 else 05 print(pop() * 3) 06 endif

(i) Before the sub-programs, push() and pop(), can add or remove items from the stack, a selection statement is used to decide if each action is possible.

Describe the decision that needs to be made in each sub-program and how this impacts the next process.

push() ..............................................................................................................................

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

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

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

pop() ................................................................................................................................

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

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

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

[4]

(ii) The algorithm does not work when the user enters "PUSH" or "Push". The algorithm needs to be changed in order to accept these inputs.

Identify the line number to be changed and state the change that should be made.

Line number .......................................................................................................................

Change ...............................................................................................................................

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

[2]

If userAnswer == “push” OR “PUSH” OR “Push”

17

Turn over© OCR 2018

(c) The stack is implemented as a 1D array, dataArray.

Describe how a 1D array can be set up and used to push and pop items as a stack.

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

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

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

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

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

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

[3]

18 (d) As an array, the data in dataArray is sorted and then searched for a specific value.

(i) The data in dataArray is sorted into ascending order using an insertion sort.

The current contents of dataArray are shown:

100 22 5 36 999 12

Show the steps of an insertion sort on the current contents of the array dataArray.

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

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

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

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

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

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

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

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

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

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

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

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

...................................................................................................................................... [5]

19

Turn over© OCR 2018

(ii) The array dataArray can now be searched using a binary search.

Describe the stages of a binary search on an array of size n.

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

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

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

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

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

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

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

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

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

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

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

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

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

...................................................................................................................................... [7]

20 (iii) The array has 50 items.

The function, searchItem(), performs a linear search for a data item.

function searchItem(dataItem) for count = 0 to 49 if dataArray[count] == dataItem then return(count) endif next count return(-1) endfunction

Rewrite the function using a while loop.

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

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

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

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

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

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

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

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

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

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

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

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

21

Turn over© OCR 2018

Section B

Answer all questions.

6 Kamran is writing a program to manipulate the data for a set of items.

For each item, the program needs to store:• Item name (e.g. Box)• Cost (e.g. 22.58)• Date of arrival (e.g. 1/5/2018)• Transferred (e.g. true)

The items are added to a queue for processing.

The queue is defined as a class, itemQueue.

itemQueue

theItems[10] : Itemshead : Integertail : IntegernumItems : Integer

constructorenqueuer()dequeuer()setnumItems()getnumItems()

The head attribute points to the first element in the queue. The tail attribute points to the next available space in the queue. The numItems attribute states how many items are currently in the queue.

(a) The data about the items can be stored using either a record structure, or as objects of a class.

(i) Explain the similarities and differences between a record and a class.

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

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

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

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

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

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

22 (ii) Kamran chooses to use a record structure to store the data about the items.

Record structures may be declared using the following syntax:

recordStructure recordstructurename fieldname : datatype … endRecordStructure

Complete the pseudocode to declare a record called items.

recordStructure …………………………………………………………………………….

itemName : …………………………………………………………………

…………………………………………………….……………: Currency

…………………………………………………….……………: Date

transferred : …………………………………………………….……………

endRecordStructure

[5]

(iii) New records may be created using the following syntax:

recordidentifier : recordstructurename recordidentifier.fieldname = data …

Write a programming statement to create a new item, using the identifier ‘box1’, with the item name “Box”, the cost 22.58, date of arrival 1/5/2018 and transferred true.

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

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

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

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

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

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

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

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

23

Turn over© OCR 2018

(b) The array, theItems, stores the items in the queue. When the tail of the queue exceeds the last element in the array, it adds a new item to the first element if it is vacant.

For example, in the following queue, the next item to be added would be placed at index 0.

Index 0 1 2 3 4 5 6 7 8 9

Element Data Data Data Data Data Data Data

(i) Define the term ‘queue’.

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

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

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

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

(ii) The attributes in itemQueue are all declared as private.

Explain how a private attribute improves the integrity of the data.

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

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

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

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

(iii) The constructor method creates a new instance of itemQueue and sets the head, tail and numItems attributes to 0.

Write an algorithm, using pseudocode or program code, for the constructor including the initialisation for all attributes.

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

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

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

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

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

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

24 (iv) The enqueue method:

• takes as a parameter the item to insert in the queue• checks if the queue is full• reports an error and returns false if the queue is full• does the following if the queue is not full:

o adds the item to the array at the tail position and adjusts the pointer(s)o returns true

The attribute numItems stores the number of items currently in the queue.

Write an algorithm, using pseudocode or program code, for the enqueue method.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

25

Turn over© OCR 2018

(v) Write a programming statement to declare an instance of itemQueue called myItems.

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

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

(vi) Write a procedure, insertItems(), to ask the user to input the data for an item. The item is then added to the queue myItems. The user is continually asked to input data items until the queue is full.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

...................................................................................................................................... [5]

26 (vii) When the main program ends, the items and the queue no longer exist.

Describe how Kamran could amend the program to make sure the items and queue still exist and are used the next time the program is run.

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

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

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

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

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

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

(c)* Kamran wants to expand the program to allow it to handle up to 100,000,000 items and to allow him to search for data about items. Kamran is worried that the increase in the number of items will cause a decrease in the performance of the program. He decides to investigate the benefits of caching and concurrent processing.

Evaluate the use of caching and concurrent processing in this scenario and make a recommendation to Kamran.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

27

© OCR 2018

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.............................................................................................................................................. [9]

END OF QUESTION PAPER

28

PLEASE DO NOT WRITE ON THIS PAGE

Oxford Cambridge and RSA

Copyright Information

OCR is committed to seeking permission to reproduce all third-party content that it uses in its 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, First Floor, 9 Hills Road, Cambridge CB2 1GE.

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.

Oxford Cambridge and RSA Examinations

GCE

Computer Science

Unit H446/02: Algorithms and programming

Advanced GCE

Mark Scheme for June 2018

OCR (Oxford Cambridge and RSA) is a leading UK awarding body, providing a wide range of qualifications to meet the needs of candidates of all ages and abilities. OCR qualifications include AS/A Levels, Diplomas, GCSEs, Cambridge Nationals, Cambridge Technicals, Functional Skills, Key Skills, Entry Level qualifications, NVQs and vocational qualifications in areas such as IT, business, languages, teaching/training, administration and secretarial skills. It is also responsible for developing new specifications to meet national requirements and the needs of students and teachers. OCR is a not-for-profit organisation; any surplus made is invested back into the establishment to help towards the development of qualifications and support, which keep pace with the changing needs of today’s society. This mark scheme is published as an aid to teachers and students, to indicate the requirements of the examination. It shows the basis on which marks were awarded by examiners. It does not indicate the details of the discussions which took place at an examiners’ meeting before marking commenced. All examiners are instructed that alternative correct answers and unexpected approaches in candidates’ scripts must be given marks that fairly reflect the relevant knowledge and skills demonstrated. Mark schemes should be read in conjunction with the published question papers and the report on the examination. © OCR 2018

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

3

An

no

tatio

ns

A

nn

ota

tion

M

ean

ing

Om

issio

n m

ark

Be

ne

fit of th

e d

oubt

Inco

rrect p

oin

t

Follo

w th

rou

gh

No

t an

sw

ere

d q

uestio

n

No b

en

efit o

f doubt g

ive

n

Re

pe

at

Co

rrect p

oin

t

To

o v

ag

ue

Bla

nk P

ag

e –

this

annota

tion m

ust b

e u

sed

on a

ll bla

nk p

ag

es w

ithin

an a

nsw

er b

ookle

t (stru

ctu

red o

r unstru

ctu

red) a

nd o

n e

ach p

ag

e o

f an a

dd

itional o

bje

ct w

he

re th

ere

is n

o c

an

did

ate

response.

Leve

l 1

Leve

l 2

Leve

l 3

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

4

Su

bje

ct-s

pe

cific

Ma

rkin

g In

stru

ctio

ns

IN

TR

OD

UC

TIO

N

Yo

ur firs

t task a

s a

n E

xa

min

er is

to b

ecom

e th

oro

ug

hly

fam

iliar w

ith th

e m

ate

rial o

n w

hic

h th

e e

xa

min

atio

n d

ep

en

ds. T

his

ma

teria

l inclu

de

s:

th

e s

pecific

atio

n, e

spe

cia

lly th

e a

ssessm

ent o

bje

ctiv

es

th

e q

uestio

n p

ap

er a

nd its

rubric

s

th

e m

ark

sch

em

e.

Yo

u s

hou

ld e

nsu

re th

at y

ou h

ave

co

pie

s o

f these

ma

teria

ls.

Yo

u s

hou

ld e

nsure

als

o th

at y

ou a

re fa

milia

r with

the a

dm

inis

trativ

e p

rocedu

res re

late

d to

the m

ark

ing p

roce

ss. T

hese

are

se

t out in

the O

CR

b

oo

kle

t Instru

ctio

ns fo

r Ex

am

iners

. If yo

u a

re e

xa

min

ing

for th

e firs

t time

, ple

ase

read c

are

fully

Ap

pen

dix

5 In

trod

uc

tion

to S

crip

t Ma

rkin

g:

No

tes

for N

ew

Ex

am

iners

. P

lease

ask fo

r help

or g

uid

an

ce w

hen

eve

r yo

u n

ee

d it. Y

our firs

t poin

t of c

onta

ct is

yo

ur T

eam

Lead

er.

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

5

US

ING

TH

E M

AR

K S

CH

EM

E

Ple

ase

stu

dy th

is M

ark

Sch

em

e c

are

fully

. Th

e M

ark

Sch

em

e is

an in

teg

ral p

art o

f the p

rocess th

at b

eg

ins w

ith th

e s

ettin

g o

f the q

uestio

n p

ap

er

and

en

ds w

ith th

e a

wa

rdin

g o

f gra

de

s. Q

uestio

n p

ape

rs a

nd M

ark

Sch

em

es a

re d

eve

lope

d in

asso

cia

tion

with

ea

ch

oth

er s

o th

at is

su

es o

f d

iffere

ntia

tion

an

d p

ositiv

e a

ch

ieve

me

nt c

an b

e a

ddre

ssed

from

the v

ery

sta

rt. T

his

Ma

rk S

ch

em

e is

a w

ork

ing d

ocu

men

t; it is n

ot e

xh

au

stiv

e; it d

oe

s n

ot p

rovid

e ‘c

orre

ct’ a

nsw

ers

. Th

e M

ark

Sch

em

e c

an o

nly

pro

vid

e ‘b

est

gu

esses’ a

bo

ut h

ow

the q

uestio

n w

ill wo

rk o

ut, a

nd it is

su

bje

ct to

revis

ion a

fter w

e h

ave

loo

ke

d a

t a w

ide ra

ng

e o

f scrip

ts.

Th

e E

xa

min

ers

’ Sta

nd

ard

isa

tion

Me

etin

g w

ill ensu

re th

at th

e M

ark

Sch

em

e c

ove

rs th

e ra

ng

e o

f can

did

ate

s’ re

spo

nses to

the

qu

estio

ns, a

nd th

at a

ll E

xa

min

ers

und

ers

tand

an

d a

pp

ly th

e M

ark

Sch

em

e in

the s

am

e w

ay. T

he

Ma

rk S

ch

em

e w

ill be d

iscu

ssed

an

d a

me

nd

ed

at th

e m

eetin

g, a

nd

adm

inis

trativ

e p

roced

ure

s w

ill be c

onfirm

ed. C

o-o

rdin

atio

n s

crip

ts w

ill be is

su

ed

at th

e m

eetin

g to

exe

mp

lify a

spe

cts

of c

andid

ate

s’ re

spo

nses a

nd

achie

ve

me

nts

; the c

o-o

rdin

atio

n s

crip

ts th

en

be

co

me

part o

f this

Ma

rk S

ch

em

e.

Be

fore

the S

tand

ard

isatio

n M

eetin

g, y

ou s

hou

ld re

ad

an

d m

ark

in p

en

cil a

num

ber o

f scrip

ts, in

ord

er to

ga

in a

n im

pre

ssio

n o

f the ra

ng

e o

f re

spo

nse

s a

nd

ach

ieve

me

nt th

at m

ay b

e e

xp

ecte

d.

In y

our m

ark

ing

, yo

u w

ill enco

un

ter v

alid

respo

nse

s w

hic

h a

re n

ot c

ove

red b

y th

e M

ark

Sch

em

e: th

ese re

spo

nse

s m

ust b

e c

redite

d. Y

ou w

ill e

nco

un

ter a

nsw

ers

wh

ich

fall o

uts

ide th

e ‘ta

rge

t rang

e’ o

f Ba

nd

s fo

r the p

ape

r wh

ich

yo

u a

re m

ark

ing

. Ple

ase

ma

rk th

ese

an

sw

ers

accord

ing

to th

e

ma

rkin

g c

riteria

. P

lea

se re

ad

care

fully

all th

e s

crip

ts in

yo

ur a

llocatio

n a

nd

make

eve

ry e

ffort to

look p

ositiv

ely

for a

ch

ieve

me

nt th

roug

hou

t the

ability

rang

e. A

lwa

ys

be p

rep

are

d to

use th

e fu

ll rang

e o

f ma

rks.

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

6

LE

VE

LS

OF

RE

SP

ON

SE

QU

ES

TIO

NS

: T

he in

dic

ativ

e c

on

tent in

dic

ate

s th

e e

xp

ecte

d p

ara

me

ters

for c

and

idate

s’ a

nsw

ers

, but b

e p

repa

red

to re

cog

nis

e a

nd

cre

dit u

ne

xp

ecte

d

app

roa

ch

es w

here

they s

how

rele

va

nce

. U

sin

g ‘b

est-fit’, d

ecid

e firs

t wh

ich

se

t of B

AN

D D

ES

CR

IPT

OR

S b

est d

escrib

es th

e o

ve

rall q

uality

of th

e a

nsw

er. O

nce

the b

an

d is

locate

d, a

dju

st

the m

ark

co

nce

ntra

ting

on

featu

res o

f the a

nsw

er w

hic

h m

ake it s

trong

er o

r we

ake

r follo

win

g th

e g

uid

elin

es fo

r refin

em

ent.

H

igh

est m

ark

: If cle

ar e

vid

en

ce o

f all th

e q

ualitie

s in

the b

an

d d

escrip

tors

is s

how

n, th

e H

IGH

ES

T M

ark

sh

ou

ld b

e a

wa

rde

d.

L

ow

est m

ark

: If the a

nsw

er s

how

s th

e c

and

idate

to b

e b

ord

erlin

e (i.e

. they h

ave

ach

ieve

d a

ll the q

ua

lities o

f the b

an

ds b

elo

w a

nd

sh

ow

lim

ited e

vid

en

ce o

f me

etin

g th

e c

riteria

of th

e b

and

in q

uestio

n) th

e L

OW

ES

T m

ark

sh

ou

ld b

e a

wa

rde

d.

M

idd

le m

ark

: Th

is m

ark

sh

ou

ld b

e u

sed fo

r ca

nd

idate

s w

ho a

re s

ecure

in th

e b

an

d. T

hey a

re n

ot ‘b

ord

erlin

e’ b

ut th

ey h

ave

only

achie

ve

d

so

me

of th

e q

ualitie

s in

the b

an

d d

escrip

tors

. B

e p

repa

red to

use th

e fu

ll rang

e o

f ma

rks. D

o n

ot re

serv

e (e

.g.) h

igh B

an

d 3

ma

rks ‘in

ca

se

’ so

me

thin

g tu

rns u

p o

f a q

uality

yo

u h

ave

no

t ye

t se

en

. If an a

nsw

er g

ive

s c

lear e

vid

en

ce o

f the q

ua

lities d

escrib

ed

in th

e b

and

de

scrip

tors

, rew

ard

app

rop

riate

ly.

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

7

A

O1

A

O2

A

O3

Hig

h (th

oro

ug

h)

Pre

cis

ion in

the u

se o

f que

stio

n

term

inolo

gy. K

now

ledg

e s

how

n is

co

nsis

tent a

nd

we

ll-deve

lope

d.

Cle

ar a

pp

recia

tion o

f the q

uestio

n

from

a ra

ng

e o

f diffe

rent

pers

pectiv

es m

akin

g e

xte

nsiv

e

use o

f acq

uire

d k

now

led

ge a

nd

u

nd

ers

tand

ing

.

Kn

ow

ledg

e a

nd

un

de

rsta

ndin

g

sh

ow

n is

co

nsis

tently

app

lied to

co

nte

xt e

na

blin

g a

log

ical a

nd

su

sta

ined

arg

um

ent to

de

ve

lop.

Exa

mp

les u

se

d e

nh

an

ce ra

ther

than

detra

ct fro

m re

spo

nse

.

Co

nce

rted e

ffort is

ma

de to

co

nsid

er a

ll aspe

cts

of a

syste

m /

pro

ble

m o

r we

igh

up b

oth

sid

es to

a

n a

rgum

ent b

efo

re fo

rmin

g a

n

ove

rall c

on

clu

sio

n. J

udg

em

ents

m

ade

are

ba

se

d o

n a

pp

ropria

te

and

co

ncis

e a

rgu

me

nts

that h

ave

b

ee

n d

eve

lope

d in

respon

se

resultin

g in

them

bein

g b

oth

su

pp

orte

d a

nd

realis

tic.

Mid

dle

(rea

so

nab

le)

Aw

are

ne

ss o

f the m

ean

ing o

f the

term

s in

the q

uestio

n. K

no

wle

dg

e

is s

oun

d a

nd e

ffectiv

ely

d

em

onstra

ted. D

em

and

s o

f q

uestio

n u

nd

ers

tood a

ltho

ug

h a

t tim

es o

pp

ortu

nitie

s to

ma

ke u

se o

f a

cq

uire

d k

now

ledg

e a

nd

und

ers

tand

ing

not a

lwa

ys ta

ke

n.

Kn

ow

ledg

e a

nd

un

de

rsta

ndin

g

app

lied to

co

nte

xt. W

hils

t cle

ar

evid

en

ce th

at a

n a

rgum

en

t build

s

and

de

ve

lops th

roug

h re

sp

on

se

there

are

times w

hen

opp

ortu

nitie

s

are

mis

se

d to

use a

n e

xa

mp

le o

r re

late

an a

spe

ct o

f kn

ow

ledg

e o

r u

nd

ers

tand

ing

to th

e c

onte

xt

pro

vid

ed

.

Th

ere

is a

reaso

na

ble

atte

mp

t to

reach

a c

onclu

sio

n c

onsid

erin

g

aspe

cts

of a

syste

m / p

rob

lem

or

we

igh

ing u

p b

oth

sid

es o

f an

arg

um

ent. H

ow

eve

r the im

pact o

f th

e c

onclu

sio

n is

ofte

n le

sse

ne

d

by a

lack o

f su

pp

orte

d ju

dg

em

ents

w

hic

h a

cco

mp

an

y it. T

his

inab

ility

to b

uild

on

an

d d

eve

lop lin

es o

f a

rgu

me

nt a

s d

eve

lope

d in

the

respo

nse

ca

n d

etra

ct fro

m th

e

ove

rall q

uality

of th

e re

spo

nse

.

Lo

w (b

as

ic)

Co

nfu

sio

n a

nd

ina

bility

to

deco

nstru

ct te

rmin

olo

gy a

s u

se

d in

th

e q

uestio

n. K

now

ledg

e p

artia

l a

nd

su

pe

rficia

l. Focu

s o

n q

uestio

n

narro

w a

nd

ofte

n o

ne

-dim

ensio

na

l.

Inab

ility to

ap

ply

kn

ow

ledg

e a

nd

und

ers

tand

ing

in a

ny s

usta

ined

w

ay to

co

nte

xt re

sultin

g in

tenu

ou

s

and

un

su

pp

orte

d s

tate

me

nts

bein

g

ma

de

. Exa

mp

les if u

se

d a

re fo

r th

e m

ost p

art irre

leva

nt a

nd

unsu

bsta

ntia

ted.

Little

or n

o a

ttem

pt to

prio

ritise o

r w

eig

h u

p fa

cto

rs d

urin

g c

ours

e o

f a

nsw

er. C

onclu

sio

n is

ofte

n

dis

locate

d fro

m re

sp

on

se

an

d a

ny

judg

em

ents

lack s

ubsta

nce

du

e in

p

art to

the b

asic

leve

l of a

rgu

me

nt

that h

as b

ee

n d

em

onstra

ted

thro

ug

hout re

spo

nse.

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

8

A

ss

es

sm

en

t Ob

jec

tive

AO

1

De

mo

nstra

te k

now

ledg

e a

nd

un

ders

tand

ing

of th

e p

rincip

les a

nd

co

nce

pts

of c

om

pute

r scie

nce

, inclu

din

g a

bstra

ctio

n, lo

gic

, alg

orith

ms

and

da

ta re

pre

sen

tatio

n.

AO

1.1

D

em

on

stra

te k

no

wle

dg

e o

f the p

rincip

les a

nd c

on

cep

ts o

f abstra

ctio

n, lo

gic

, alg

orith

ms, d

ata

repre

se

nta

tion

or o

ther a

s a

ppro

pria

te.

AO

1.2

D

em

on

stra

te u

nd

ers

tan

din

g o

f the p

rincip

les a

nd

co

nce

pts

of a

bstra

ctio

n, lo

gic

, alg

orith

ms, d

ata

repre

sen

tatio

n o

r oth

er a

s a

pp

ropria

te.

AO

2

Ap

ply

kn

ow

ledg

e a

nd

und

ers

tand

ing

of th

e p

rincip

les a

nd

co

nce

pts

of c

om

pute

r scie

nce

inclu

din

g to

ana

lyse

pro

ble

ms in

co

mp

uta

tiona

l te

rms.

AO

2.1

A

pply

kn

ow

ledg

e a

nd

und

ers

tand

ing

of th

e p

rincip

les a

nd

co

nce

pts

of c

om

pute

r scie

nce

.

AO

2.2

A

naly

se

pro

ble

ms in

com

puta

tiona

l term

s.

AO

3

De

sig

n, p

rog

ram

and

eva

luate

com

pute

r syste

ms th

at s

olv

e p

roble

ms, m

akin

g re

aso

ne

d ju

dg

em

ents

abo

ut th

ese a

nd

pre

sen

ting

co

nclu

sio

ns.

AO

3.1

D

esig

n c

om

pute

r syste

ms th

at s

olv

e p

roble

ms.

AO

3.2

P

rogra

m c

om

pute

r syste

ms th

at s

olv

e p

roble

ms.

AO

3.3

E

va

luate

co

mp

ute

r syste

ms th

at s

olv

e p

roble

ms, m

akin

g re

ason

ed

judg

em

ents

abo

ut th

ese

an

d p

resen

ting

co

nclu

sio

ns.

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

9

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

1

(a)

1

mark

for e

ach o

f: -

Sco

tlan

d in

corre

ct p

lace

- W

ale

s in

corre

ct p

lace

- A

ustra

lia a

nd

Eng

land b

oth

in c

orre

ct p

lace

3

AO

2.2

(3)

1

(b)

1

mark

per b

ulle

t to m

ax

Ita

ly

F

ran

ce, S

pain

A

ustria

, Germ

any, N

orw

ay

3

AO

1.1

(1

) A

O2

.1 (1

) A

O2

.2 (1

)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

10

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

1

(c)

(i) 1

mark

per b

ulle

t to m

ax 5

function searchForData(currentNode:byVal, searchValue:byVal)

thisNode = getData(currentNode)

if thisNode == searchValue then

return true

elseif thisNode < searchValue then

if currentNode.left () != null then

return (searchForData(currentNode.left (),

searchValue))

else

return false

endif

else

if currentNode.right() != null then

return (searchForData(currentNode.right (),

searchValue))

else

return false

endif

endif

endfunction

5

AO

2.2

(2)

AO

3.2

(3)

Th

e lin

e elseif thisNode <

searchValue then

sh

ou

ld

have

read elseif thisNode

> searchValue then

If ca

nd

idate

s a

ttem

pt to

co

rrect

the c

ode a

nd

their a

nsw

ers

are

co

nsis

tent w

ith, a

nd

wo

rk w

ith

their a

me

ndm

en

t, su

ch

an

sw

ers

sh

ou

ld b

e c

redite

d.

1

(c)

(ii)

It’s a

bin

ary

tree

It’s

ord

ere

d / s

orte

d

2

AO

2.2

(2)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

11

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

2

(a)

(i) R

ecog

nitio

n

Id

en

tify th

ere

is a

pro

ble

m to

be s

olv

ed // w

hat th

e

pro

ble

m is

D

ecom

positio

n

S

plittin

g d

ow

n a

pro

ble

m in

to s

ub-p

rob

lem

s

2

AO

1.1

(2

)

2

(a)

(ii) e

.g.

D

ivid

e a

nd

co

nq

uer

A

bstra

ctio

n

1

AO

1.1

(1

)

Acce

pt o

ther c

red

ible

an

sw

ers

e.g

.: C

ritica

l thin

kin

g, M

ode

lling

, He

uris

tics, C

oncu

rrency,

Vis

ualis

atio

n, B

acktra

ckin

g

2

(b)

(i)

Tu

rnin

g la

rge

qu

antitie

s o

f data

into

usefu

l info

rma

tion

/ F

indin

g p

atte

rns w

ithin

larg

e q

uantitie

s o

f in

form

atio

n

1

AO

1.1

(1)

Mu

st re

fer to

larg

e q

uan

tities o

f data

2

(b)

(ii) 1

mark

per id

entify

ing

data

, 1 fo

r use

e.g

.

Id

en

tify c

usto

mer tre

nd

s

T

o id

en

tify ite

ms to

se

ll/offe

rs to

sen

d c

usto

me

rs

Id

en

tify w

hic

h s

tore

s a

re m

akin

g th

e m

ost p

rofit

T

o id

en

tify w

hat th

e o

ther s

tore

s a

re d

oin

g w

ell

W

hic

h ite

ms a

re n

ot s

ellin

g w

ell

T

o re

pla

ce th

em

with

oth

er ite

ms

4

AO

2.2

(4

) A

cce

pt a

ny v

alid

respo

nse

s

2

(c)

(i) S

imu

late

/test th

e b

eh

avio

ur o

f the s

yste

m b

efo

re it is

used

1

AO

1.1

(1)

2

(c)

(ii) e

.g.

T

estin

g it w

ith a

larg

e n

um

ber o

f sim

ulta

ne

ous o

rders

(s

tress te

stin

g)

T

estin

g it w

ith a

larg

e n

um

ber o

f cu

sto

me

rs/ite

ms/o

rders

1

AO

2.2

(1)

2

(d)

1

mark

per b

ulle

t to m

ax 2

e.g

.

th

e c

om

pon

ents

ca

n b

e u

sed

in a

futu

re p

rog

ram

th

ey d

o n

ot n

ee

d to

be re

writte

n / s

ave

s tim

e

2

AO

1.1

(1)

AO

2.1

(1)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

12

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

th

ey h

ave

alre

ad

y b

ee

n te

ste

d…

it will s

ave

time

3

(a)

(i) A

ny o

ne

from

: -

A g

rap

h h

as c

ycle

s

- A

gra

ph

ca

n b

e d

irecte

d/u

nd

irecte

d

- A

tree h

as a

hie

rarc

hy (e

.g. P

are

nt/C

hild

)

1

AO

1.2

(1)

Allo

w a

ny a

pp

rop

riate

descrip

tion

e.g

. gra

ph c

an b

e

we

igh

ted, tre

e h

as a

root

3

(a)

(ii) 1

mark

per b

ulle

t to m

ax 2

T

he p

uzzle

is n

ot s

how

n in

the d

iag

ram

T

he g

raph s

how

s d

iffere

nt s

eq

uen

ces o

f su

b p

rob

lem

s

in th

e p

uzzle

that c

an b

e s

olv

ed to

ge

t to th

e fin

al

so

lutio

n

T

he p

uzzle

do

es n

ot h

ave

all s

tate

s v

isib

le a

t once

2

AO

1.2

(1)

AO

2.1

(1)

An

sw

ers

mu

st b

e in

co

nte

xt o

f the p

uzzle

3

(a)

(iii) 1

mark

per b

ulle

t to m

ax 2

e

.g.

V

isu

alis

atio

ns b

en

efit h

um

ans ra

ther th

an c

om

pute

rs

V

isu

alis

atio

ns p

resen

t the

info

rma

tion in

a s

imp

ler

form

to u

nd

ers

tan

d

V

isu

alis

atio

ns c

an

best e

xp

lain

co

mp

lex s

ituatio

ns

2

AO

1.1

(1)

AO

2.1

(1

)

3

(b)

1

mark

per b

ulle

t

M

ark

A a

s th

e in

itial n

ode

an

d th

en

vis

it B (5

)

N

ode

E (8

) is th

en v

isite

d (c

hose

n fro

m C

(13), D

(14), E

(8

))

N

ode

I (12) is

then

vis

ited

afte

r E

N

ode

J (1

4) is

then v

isite

d a

fter I

:

V

isitin

g G

(18) fro

m I;

V

isitin

g G

(15) fro

m C

– o

ve

rridin

g th

e p

revio

us v

alu

e o

f 18

so

lutio

n A

-B-E

-I-J p

ath

len

gth

14

7

AO

1.2

(3)

AO

2.1

(2)

AO

2.2

(2)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

13

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

3

(c)

M

ark

Ba

nd

3 –

Hig

h le

ve

l (7

-9 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

thoro

ug

h k

now

led

ge a

nd

u

nd

ers

tand

ing

of D

ijkstra

’s a

nd

A*; th

e m

ate

rial is

ge

nera

lly

accura

te a

nd

deta

iled.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

u

nd

ers

tand

ing

dire

ctly

an

d c

onsis

tently

to th

e c

on

text

pro

vid

ed

. Evid

en

ce/e

xa

mp

les w

ill be e

xp

licitly

rele

va

nt to

th

e e

xp

lana

tion

. T

he

re is

a w

ell-d

eve

lope

d lin

e o

f reaso

nin

g w

hic

h is

cle

ar

and

log

ica

lly s

tructu

red. T

he

info

rma

tion p

rese

nte

d is

re

levan

t and s

ubsta

ntia

ted.

Ma

rk B

an

d 2

– M

id le

ve

l (4

-6 m

ark

s)

Th

e c

and

idate

dem

onstra

tes re

aso

na

ble

kn

ow

ledg

e a

nd

u

nd

ers

tand

ing

of D

ijkstra

’s a

nd

A*; th

e m

ate

rial is

ge

nera

lly

accura

te b

ut a

t time

s u

nd

erd

eve

lope

d.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

u

nd

ers

tand

ing

dire

ctly

to th

e c

onte

xt p

rovid

ed

alth

ou

gh o

ne

o

r two

op

portu

nitie

s a

re m

isse

d. E

vid

en

ce/e

xa

mp

les a

re fo

r th

e m

ost p

art im

plic

itly re

leva

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

reaso

na

ble

dis

cussio

n, th

e

ma

jority

of w

hic

h is

focuse

d. E

va

luativ

e c

om

me

nts

are

, for

the m

ost p

art a

pp

ropria

te, a

lthoug

h o

ne

or tw

o o

pp

ortu

nitie

s

for d

eve

lopm

ent a

re m

isse

d.

The

re is

a lin

e o

f reaso

nin

g p

rese

nte

d w

ith s

om

e s

tructu

re.

The

info

rma

tion p

rese

nte

d is

in th

e m

ost p

art re

leva

nt a

nd

su

pp

orte

d b

y s

om

e e

vid

ence

. M

ark

Ba

nd

1 –

Lo

w L

eve

l (1

-3 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

basic

kno

wle

dg

e o

f Dijk

stra

’s

and

A* w

ith lim

ited u

nd

ers

tand

ing s

how

n; th

e m

ate

rial is

b

asic

and

co

nta

ins s

om

e in

accu

racie

s. T

he c

and

idate

s

make

s a

limite

d a

ttem

pt to

ap

ply

acq

uire

d k

now

led

ge a

nd

9

AO

1.1

(2)

AO

1.2

(2)

AO

2.1

(2)

AO

3.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t

H

euris

tic h

elp

s p

rodu

ce a

so

lutio

n in

a fa

ste

r time

A

* uses e

stim

ate

d d

ista

nce

from

final n

od

e

D

ijkstra

uses a

we

igh

t/dis

tance

A

* ch

oo

ses w

hic

h p

ath

to ta

ke n

ext b

ase

d o

n lo

we

st

cu

rrent d

ista

nce

trave

lled

A

O2

: Ap

plic

atio

n

D

escrip

tion o

f how

A* w

ill diffe

r from

Dijk

stra

, e.g

. ta

kin

g th

e s

horte

r route

A-B

-E-I b

efo

re e

xp

lorin

g

nod

es fro

m D

and E

D

escrip

tion o

f the d

iffere

nt n

um

ber o

f com

paris

ons

that w

ould

be

nee

de

d in

this

pro

ble

m

A

* doe

sn’t n

ee

d to

find a

ll possib

le s

olu

tion

s (s

ave

s

time

) A

O3

: Eva

lua

tion

C

and

idate

s w

ill nee

d to

eva

luate

the b

en

efits

and

d

raw

backs o

f each

alg

orith

m

S

ma

ll-sca

le p

roble

m

Q

uic

k to

find a

so

lutio

n u

sin

g e

ither m

eth

od

D

iffere

nce in

pro

gra

mm

ing c

om

ple

xity

is m

inim

al

D

on’t k

now

if this

pro

ble

m n

ee

ds to

sca

le

M

ost e

fficie

nt ro

ute

ne

ede

d

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

14

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

und

ers

tand

ing

to th

e c

onte

xt p

rovid

ed

. T

he c

and

idate

pro

vid

es a

limite

d d

iscu

ssio

n w

hic

h is

na

rrow

in

focus. J

udg

em

ents

if ma

de

are

we

ak a

nd

u

nsu

bsta

ntia

ted.

The

info

rma

tion is

basic

and

co

mu

nic

ate

d in

an

unstru

ctu

red w

ay. T

he

info

rma

tion

is s

upp

orte

d b

y lim

ited

evid

en

ce a

nd

the re

latio

nship

to th

e e

vid

en

ce m

ay n

ot b

e

cle

ar.

0 m

ark

s

No

atte

mpt to

an

sw

er th

e q

uestio

n o

r respo

nse is

not w

orth

y

of c

redit.

3

(d)

1

mark

per b

ulle

t to m

ax 4

e

.g.

U

nde

rlines s

yn

tax e

rrors

dyn

am

ica

lly

C

an b

e c

orre

cte

d b

efo

re ru

nn

ing // s

ave

s tim

es

W

atc

h w

indo

w

V

iew

how

va

riab

les c

ha

ng

e d

urin

g ru

nn

ing o

f the

pro

gra

m

B

reak p

oin

ts

S

top th

e p

rog

ram

at s

et p

oin

ts to

ch

eck th

e v

alu

es o

f va

riab

les

E

rror m

essag

e lis

t

T

ells

yo

u w

here

erro

rs a

re a

nd

sug

gests

co

rrectio

ns

S

tep-m

ode

E

xe

cute

s p

rog

ram

one

sta

tem

ent a

t a tim

e to

wa

tch

va

riab

le v

alu

es a

nd

pro

gra

m p

ath

wa

ys

T

race

s

P

rint-o

uts

of v

aria

ble

va

lues fo

r each s

tate

me

nt

6

AO

1.1

(3)

AO

1.2

(3)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

15

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

exe

cutio

n w

ithin

a p

rog

ram

Cra

sh-d

um

p/p

ost-m

orte

m ro

utin

e

S

how

s th

e s

tate

of v

aria

ble

s w

here

an

erro

r occurs

S

tack c

onte

nts

S

how

s s

eq

uen

cin

g th

roug

h p

roce

dure

s/m

odu

les

C

ross-re

fere

nce

rs

Id

en

tifies w

here

va

riab

les/c

onsta

nts

are

used in

a

pro

gra

m to

avo

id d

up

lica

tion

s

4

(a)

1

mark

per b

ulle

t for w

ork

ing

to m

ax 6

g

enera

te(7

) re

turn

7 +

(ge

ne

rate

(8) D

IV 2

)

g

enera

te(8

) re

turn

8 +

(ge

nera

te(9

) DIV

2)

ge

nera

te(9

) re

turn

9 +

(ge

nera

te(1

0) D

IV 2

) g

enera

te(1

0)

retu

rn 1

0 +

(ge

nera

te(1

1) D

IV 2

)

g

enera

te(1

1)

retu

rn 1

0

R

ew

indin

g: re

turn

10 +

(10 D

IV 2

) = 1

0 +

5 =

15

re

turn

9 +

(15 D

IV 2

) = 9

+ 7

= 1

6

retu

rn 8

+ (1

6 D

IV 2

) = 8

+ 8

= 1

6

re

turn

7 +

(16 D

IV 2

) = 7

+ 8

= 1

5

6

AO

1.2

(1)

AO

2.2

(5)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

16

Qu

es

tion

A

nsw

er

Ma

rks

Gu

idan

ce

4

(b)

If the v

alu

e is

se

nt b

y v

alu

e, n

um

1 w

ill not b

e o

ve

rridde

n

/ it is a

co

py o

f the p

ara

me

ter th

at is

used (1

) and

this

w

ill pro

du

ce th

e c

orre

ct o

utp

ut (1

)

if th

e p

ara

me

ter h

ad

be

en

pa

sse

d b

y re

fere

nce

it wo

uld

n

ot p

rodu

ce th

e c

orre

ct re

sult (1

) as n

um

1 w

ould

be

o

ve

rridde

n / b

eca

use

it is a

po

inte

r to th

e a

dd

ress o

f the

va

riab

le (1

)

2

AO

2.1

(1)

AO

2.2

(1)

4

(c)

M

ark

Ba

nd

3 –

Hig

h le

ve

l (7

-9 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

thoro

ug

h k

now

led

ge a

nd

u

nd

ers

tand

ing

of p

ara

mete

rs a

nd

glo

ba

l va

riable

s; th

e

ma

teria

l is g

ene

rally

accu

rate

and

deta

iled.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

u

nd

ers

tand

ing

dire

ctly

an

d c

onsis

tently

to th

e c

on

text

pro

vid

ed

. Evid

en

ce/e

xa

mp

les w

ill be e

xp

licitly

rele

va

nt to

th

e e

xp

lana

tion

. T

he

re is

a w

ell-d

evelo

pe

d lin

e o

f reaso

nin

g w

hic

h is

cle

ar

and

log

ica

lly s

tructu

red. T

he

info

rma

tion p

rese

nte

d is

re

levan

t and s

ubsta

ntia

ted.

Ma

rk B

an

d 2

– M

id le

ve

l (4

-6 m

ark

s)

Th

e c

and

idate

dem

onstra

tes re

aso

na

ble

kn

ow

ledg

e a

nd

u

nd

ers

tand

ing

of p

ara

mete

rs a

nd

glo

ba

l va

riable

s; th

e

ma

teria

l is g

ene

rally

accu

rate

but a

t time

s u

nd

erd

eve

lope

d.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

u

nd

ers

tand

ing

dire

ctly

to th

e c

onte

xt p

rovid

ed

alth

ou

gh o

ne

o

r two

op

portu

nitie

s a

re m

isse

d. E

vid

en

ce/e

xa

mp

les a

re fo

r th

e m

ost p

art im

plic

itly re

leva

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

reaso

na

ble

dis

cussio

n, th

e

ma

jority

of w

hic

h is

focuse

d. E

va

luativ

e c

om

me

nts

are

, for

the m

ost p

art a

pp

ropria

te, a

lthoug

h o

ne

or tw

o o

pp

ortu

nitie

s

for d

eve

lopm

ent a

re m

isse

d.

The

re is

a lin

e o

f reaso

nin

g p

rese

nte

d w

ith s

om

e s

tructu

re.

The

info

rma

tion p

rese

nte

d is

in th

e m

ost p

art re

leva

nt a

nd

9

AO

1.1

(2)

AO

1.2

(2)

AO

2.1

(2)

AO

3.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t

P

ara

mete

r allo

ws a

va

lue

to b

e s

ent to

a s

ub-

pro

gra

m

G

loba

l va

riab

les c

an

be a

ccesse

d th

roug

hout th

e

sco

pe

of th

e p

rog

ram

L

oca

l va

riab

les c

an

only

be a

ccesse

d w

ithin

the

sco

pe

of th

e s

ub-p

rog

ram

it's d

efin

ed

with

in –

a

para

mete

r becom

es a

local v

aria

ble

in th

e fu

nctio

n

AO

2: A

pp

licatio

n

If g

loba

l, eq

uiv

ale

nt o

f by re

fere

nce -v

alu

e w

ould

be

o

ve

r-ridde

n

G

loba

l varia

ble

take

s m

ore

me

mory

than a

loca

l va

riab

le/p

ara

me

ter

In

recurs

ion, e

ach c

all p

rodu

ces a

ne

w lo

cal

va

riab

le fo

r num

1

AO

3: E

va

lua

tion

C

and

idate

s w

ill nee

d to

eva

luate

the b

en

efits

and

d

raw

backs o

f each

alg

orith

m

G

loba

l wo

uld

req

uire

alte

ring th

e a

lgorith

m a

s th

e

va

lue w

ould

be

ove

r-ridde

n o

n e

ach c

all

G

loba

l wo

uld

me

an

that m

em

ory

sp

ace

is k

ept

thro

ug

hout th

e ru

nn

ing o

f the p

rog

ram

, not ju

st th

e

su

b-p

rog

ram

P

ara

mete

r ena

ble

s m

em

ory

to b

e re

allo

cate

d

M

an

y m

ore

me

mory

sp

ace

s n

ee

de

d fo

r para

mete

r

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

17

Qu

es

tion

A

nsw

er

Ma

rks

Gu

idan

ce

su

pp

orte

d b

y s

om

e e

vid

ence

. M

ark

Ba

nd

1 –

Lo

w L

eve

l (1

-3 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

basic

kno

wle

dg

e o

f p

ara

mete

rs a

nd

glo

ba

l va

riab

les w

ith lim

ited u

nde

rsta

nd

ing

sh

ow

n; th

e m

ate

rial is

basic

and

co

nta

ins s

om

e

inaccu

racie

s. T

he c

and

idate

s m

ake

s a

limite

d a

ttem

pt to

a

pp

ly a

cq

uire

d k

now

ledg

e a

nd

un

ders

tand

ing

to th

e c

onte

xt

pro

vid

ed

. T

he c

and

idate

pro

vid

es a

limite

d d

iscu

ssio

n w

hic

h is

na

rrow

in

focus. J

udg

em

ents

if ma

de

are

we

ak a

nd

u

nsu

bsta

ntia

ted.

The

info

rma

tion is

basic

and

co

mu

nic

ate

d in

an

unstru

ctu

red w

ay. T

he

info

rma

tion

is s

upp

orte

d b

y lim

ited

evid

en

ce a

nd

the re

latio

nship

to th

e e

vid

en

ce m

ay n

ot b

e

cle

ar.

0 m

ark

s

No

atte

mpt to

an

sw

er th

e q

uestio

n o

r respo

nse is

not w

orth

y

of c

redit.

in re

curs

ion, 1

for e

ach

ca

ll

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

18

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

4

(d)

1

mark

per b

ulle

t

E

ach re

curs

ive

ca

ll sto

res th

e c

urre

nt s

tate

on th

e s

tack // c

reate

s n

ew

va

riable

s

Ite

ratio

n re

use

s th

e s

am

e v

aria

ble

s

2

AO

1.2

(1)

AO

2.1

(1)

5

(a)

1

mark

for e

ach c

orre

ct s

tack

20

13

10

10

6

6

6

6

15

15

15

15

100

100

100

100

23

23

23

23

4

AO

1.2

(2)

AO

2.2

(2)

5

(b)

(i) 1

mark

per b

ulle

t, ma

x 2

for in

sert, m

ax 2

for re

mo

ve

p

ush

C

heck if th

e s

tack is

full (p

oin

ter =

arra

y.le

ng

th/a

rray.le

ng

th+

1)

If it is

not –

insert th

e ite

m

If it is

– re

turn

/erro

r that th

e s

tack is

full

pop

C

heck if th

e s

tack is

em

pty

(poin

ter =

0/1

)

If it is

– re

turn

/erro

r that th

e s

tack is

em

pty

If it is

not –

retu

rn th

e ite

m

4

AO

1.2

(2)

AO

2.2

(2)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

19

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

5

(b)

(ii) 1

mark

per lin

e, 1

for c

han

ge

lin

e 0

2

In

clu

de

an

OR

with

va

riatio

ns (e

.g. userAnswer = "PUSH" OR userAnswer =

"Push"

etc

.)/Co

nve

rt inp

ut to

up

perc

ase/lo

we

rca

se

and

just c

om

pare

to e

qu

iva

lent

2

AO

2.2

(2)

5

(c)

1

mark

per b

ulle

t to m

ax 3

A

rray s

ize

defin

ed

A

sta

ck p

oin

ter is

used

to p

oin

t to th

e to

p o

f the s

tack

W

hen

an ite

m is

pushe

d th

e s

tack p

oin

ter is

incre

me

nte

d

W

hen

an ite

m is

pop

pe

d th

e s

tack p

oin

ter is

decre

me

nte

d

3

AO

1.2

(1)

AO

2.1

(1)

AO

2.2

(1)

5

(d)

(i) 1

mark

per ro

w (a

fter firs

t row

)

100

22

5

36

999

12

22

100

5

36

999

12

1 m

ark

5

22

100

36

999

12

1 m

ark

5

22

36

100

999

12

1 m

ark

5

22

36

100

999

12

1 m

ark

5

12

22

36

100

999

1 m

ark

5

AO

2.2

(5)

5

(d)

(ii) 1

mark

per b

ulle

t to m

ax 7

R

epe

at

C

alc

ula

ting

an a

rray m

idp

oin

t…

by a

dd

ing

the a

rray lo

we

r bou

nd

to th

e a

rray u

pp

er b

ou

nd, d

ivid

ing

by 2

an

d ro

un

din

g

C

om

pa

re a

rray m

idpo

int w

ith v

alu

e to

se

arc

h fo

r…

if eq

ual s

et fo

un

d fla

g to

true

if arra

y m

idpo

int <

va

lue to

se

arc

h fo

r, ch

ang

e lo

we

rbo

und

to e

qu

al m

idpo

int +

1

if arra

y m

idpo

int >

va

lue to

se

arc

h fo

r, ch

ang

e u

ppe

rbo

und

to e

qu

al m

idpo

int –

1

U

ntil lo

we

rbo

und

is g

reate

r than

or e

qu

al to

up

pe

rbou

nd

R

etu

rn/o

utp

ut fo

un

d fla

g

7

AO

1.1

(2)

AO

1.2

(3)

AO

2.1

(1)

AO

2.2

(1)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

20

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

5

(d)

(iii) 1

mark

per b

ulle

t

S

ettin

g v

aria

ble

to s

tart a

t 0

S

uita

ble

wh

ile s

tructu

re (e

nd

wh

ile o

r cle

ar in

de

nta

tion)

lo

op

ing

50 tim

es

In

cre

me

ntin

g th

e v

aria

ble

with

in th

e lo

op

e

.g. 1

function searchItem(dataItem)

count = 0

while count < 50

if dataArray(count) == dataItem then

return(count)

endif

count = count + 1

endwhile

return(-1)

endfunction

e.g

. 2

function searchItem(dataItem)

count = 0

while count < 50 and dataArray[count]!=dataItem

count = count + 1

endwhile

if count==50

count=-1

endif

return(count)

endfunction

4

AO

1.2

(1)

AO

3.1

(1)

AO

3.2

(2)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

21

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

6

(a)

(i) 1

mark

per b

ulle

t to m

ax 3

R

ecord

is a

data

stru

ctu

re…

A c

lass is

a te

mp

late

for m

akin

g d

ata

stru

ctu

res (o

bje

cts

)

C

lass a

lso

ha

s m

eth

od

s (w

hic

h d

escrib

es fu

nctio

nality

)

B

oth

sto

re d

ata

of d

iffere

nt ty

pes

W

hic

h c

an b

e a

ccesse

d b

y th

eir n

am

es

B

ut c

lasses c

an m

ake th

em

acce

ssib

le v

ia m

eth

od

s

B

oth

ca

n h

ave

mu

ltiple

‘insta

nce

s’

C

lass c

an

inclu

de

vis

ibility

of p

rop

ertie

s / p

riva

te

3

AO

1.2

(3)

6

(a)

(ii) 1

mark

per s

pace

recordStructure items

itemName : String

cost : Currency

dateArrival : Date

transferred : Boolean

endRecordStructure

5

AO

2.2

(2)

AO

3.2

(3)

6

(a)

(iii) 1

mark

per b

ulle

t to m

ax 3

D

ecla

ring

box1

as a

n ite

m

U

sin

g B

ox1

. (or e

qu

iva

len

t) for e

ach v

aria

ble

S

ettin

g e

ach v

aria

ble

(ma

tch

ing 6

aii) c

orre

ctly

e

.g.

Box1 : Items

Box1.itemName = “Box”

Box1.cost = 22.58

Box1.dateArrival = “1/5/2018”

Box1.transfered = True

3

AO

2.2

(2)

AO

3.2

(1)

En

sure

va

riab

le

nam

es fo

r co

st

and

da

teA

rriva

l are

co

nsis

tent

with

va

riab

le

nam

es g

ive

n in

a

(ii)

6

(b)

(i) 1

mark

per b

ulle

t to m

ax 2

A

data

stru

ctu

re

F

IFO

(first in

first o

ut)

2

AO

1.1

(2)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

22

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

6

(b)

(ii) 1

mark

per b

ulle

t to m

ax 2

P

rope

rties (a

re e

nca

psu

late

d) a

nd

ca

n o

nly

be a

cce

ssed

thro

ug

h th

eir m

eth

od

s

E

nfo

rce v

alid

atio

n th

roug

h th

e m

eth

od

// inap

pro

pria

te d

ata

ca

n b

e c

aug

ht b

efo

re e

nte

red

C

ann

ot b

e c

hang

ed/a

ccesse

d a

ccid

en

tally

2

AO

1.2

(2)

6

(b)

(iii) 1

mark

per b

ulle

t to m

ax

C

onstru

cto

r meth

od

/new

S

ettin

g head

and tail

to 0

with

in c

on

stru

cto

r meth

od

e.g

. public procedure new()

head = 0

tail = 0

numItems = 0

endprocedure

2

AO

2.2

(1)

AO

3.2

(1)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

23

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

6

(b)

(iv)

1 m

ark

per b

ulle

t to m

ax 6

F

un

ctio

n d

ecla

ratio

n, ta

kin

g ite

m a

s a

para

mete

r

C

heckin

g if th

e q

ueu

e is

full…

outp

uttin

g/re

po

rting e

rror a

nd re

turn

ing

false

A

ddin

g th

e ite

m to

the tail

positio

n

C

orre

ctly

upd

atin

g th

e tail

poin

ter (e

ither b

efo

re o

r afte

r add

ition)

In

cre

me

ntin

g numItems

and

retu

rnin

g true

if succe

ssfu

l

e.g

. public function enqueue(newItem : items) : boolean

if numItems = 10 then

print("Error: The queue is full")

return false

else

theItems[tail] = newItem

if tail = 9 then

tail = 0

else

tail += 1

endif

numItems += 1

return true

endif

endprocedure

6

AO

2.2

(3)

AO

3.1

(1

) A

O3

.2 (2

)

6

(b)

(v)

e.g

.

myItems =

(new

) itemQueue()

1

AO

2.1

(1)

Allo

w fo

llow

th

roug

h if th

ey

have

pa

ram

ete

rs

in 6

(b)(iii)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

24

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

6

(b)

(vi)

1 m

ark

per b

ulle

t to m

ax 5

P

roced

ure

decla

ratio

n fo

r insertItems

A

skin

g fo

r inpu

t of d

ata

item

s fo

r a n

ew

item

…..

usin

g re

cord

stru

ctu

re c

orre

ctly

U

se

of myItems.enqueue

L

oo

pin

g w

hile

the q

ueu

e is

not fu

ll e

.g.

procedure insertItems()

newItem : Items

itemCount = myItems.getnumItems()

while itemCount < 10

newItem.itemName = input("Enter the item name")

newItem.cost = input("Enter the item cost")

newItem.dateArrival = input("Enter the date of arrival")

newItem.transferred = input("Has it been transferred?")

myItems.enqueue(newItem)

itemCount = itemCount + 1

endwhile

myItems.setnumItems(itemCount)

endprocedure

5

AO

2.2

(2)

AO

3.1

(1

) A

O3

.2 (2

)

6

(b)

(vii)

1 m

ark

per b

ulle

t to m

ax 2

S

tore

the ite

ms a

nd q

ueu

e to

an e

xte

rna

l file (w

hen

the p

rog

ram

clo

ses)

L

oa

d th

e ite

ms a

nd q

ueue

from

the file

wh

en

it sta

rts

2

AO

2.1

(1)

AO

2.2

(1)

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

25

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

6

(c)

Mark

Ban

d 3

– H

igh

lev

el

(7-9

ma

rks)

Th

e c

and

idate

dem

onstra

tes a

thoro

ug

h k

now

led

ge a

nd

u

nd

ers

tand

ing

of c

achin

g a

nd

co

ncurre

nt p

roce

ssin

g; th

e

ma

teria

l is g

ene

rally

accu

rate

and

deta

iled.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

no

wle

dg

e a

nd

u

nd

ers

tand

ing

dire

ctly

an

d c

onsis

tently

to th

e c

on

text

pro

vid

ed

. Evid

en

ce/e

xa

mp

les w

ill be e

xp

licitly

rele

va

nt to

th

e e

xp

lana

tion

. T

he

re is

a w

ell-d

eve

lope

d lin

e o

f reaso

nin

g w

hic

h is

cle

ar

and

log

ica

lly s

tructu

red. T

he

info

rma

tion p

rese

nte

d is

re

levan

t and s

ubsta

ntia

ted.

Ma

rk B

an

d 2

– M

id le

ve

l (4

-6 m

ark

s)

Th

e c

and

idate

dem

onstra

tes re

aso

na

ble

kn

ow

ledg

e a

nd

u

nd

ers

tand

ing

of c

achin

g a

nd

co

ncurre

nt p

roce

ssin

g; th

e

ma

teria

l is g

ene

rally

accu

rate

but a

t time

s u

nd

erd

eve

lope

d.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

u

nd

ers

tand

ing

dire

ctly

to th

e c

onte

xt p

rovid

ed

alth

ou

gh

one

or tw

o o

pp

ortu

nitie

s a

re m

isse

d. E

vid

en

ce/e

xam

ple

s

are

for th

e m

ost p

art im

plic

itly re

leva

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

reaso

na

ble

dis

cussio

n, th

e

ma

jority

of w

hic

h is

focuse

d. E

va

luativ

e c

om

me

nts

are

, for

the m

ost p

art a

pp

ropria

te, a

lthoug

h o

ne

or tw

o

opp

ortu

nitie

s fo

r deve

lopm

ent a

re m

isse

d.

The

re is

a lin

e o

f reaso

nin

g p

rese

nte

d w

ith s

om

e s

tructu

re.

The

info

rma

tion p

rese

nte

d is

in th

e m

ost p

art re

leva

nt a

nd

su

pp

orte

d b

y s

om

e e

vid

ence

. M

ark

Ba

nd

1 –

Lo

w L

eve

l (1

-3 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

basic

kno

wle

dg

e o

f ca

chin

g

and

co

ncu

rrent p

roce

ssin

g w

ith lim

ited u

nd

ers

tand

ing

sh

ow

n; th

e m

ate

rial is

basic

and

co

nta

ins s

om

e

inaccu

racie

s. T

he c

an

did

ate

s m

ake

s a

limite

d a

ttem

pt to

9

AO

1.1

(2)

AO

1.2

(2)

AO

2.1

(2)

AO

3.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t C

achin

g

P

revio

usly

used

da

ta is

sto

red in

a lo

catio

n…

th

at c

an b

e q

uic

kly

accesse

d …

to

sp

ee

d u

p re

trieva

l if ne

ed

ed

in fu

ture

C

oncu

rrent P

roce

ssin

g

se

ve

ral p

roce

sse

s w

ork

sim

ulta

ne

ou

sly

to s

olv

e a

p

rob

lem

A

O2

: Ap

plic

atio

n

Ca

chin

g

se

arc

h fo

r pre

vio

usly

se

arc

hed

for d

ata

item

s in

a

faste

r seco

nd

ary

sto

rag

e d

evic

e/R

AM

S

pee

d u

p a

ccess fo

r that ite

m

…R

elie

s o

n s

am

e ite

m b

ein

g s

earc

hed fo

r mu

ltiple

tim

es

…K

am

ran n

ee

ds to

decid

e h

ow

feasib

le th

is is

b

ase

d o

n th

e n

um

ber o

f item

C

oncu

rrent

C

om

pu

ter w

ould

ha

ve

mu

ltiple

pro

cesso

rs…

E

ach s

earc

hin

g p

art o

f the

da

ta s

tructu

re a

t one

tim

e…

T

his

wo

uld

be

limite

d b

y b

ottle

ne

cks s

uch a

s

accessin

g th

e s

tora

ge d

evic

e

T

he n

pro

cessors

co

uld

pote

ntia

lly m

ean

an

incre

ase

of u

p to

1/n

of tim

e…

rea

listic

ally

sp

ee

d

incre

ase

is lik

ely

to b

e le

ss th

an th

at

O

nly

usefu

l if usin

g lin

ea

r se

arc

h // b

inary

se

arc

h

ca

nn

ot b

e p

erfo

rme

d c

oncu

rrently

A

O3

: Eva

lua

tion

C

and

idate

s w

ill nee

d to

eva

luate

the b

en

efits

and

d

raw

backs o

f ca

chin

g a

nd

co

ncu

rrent p

roce

ssin

g

Allo

w a

ny p

oin

t of v

iew

(ca

chin

g / c

oncu

rrent / b

oth

) as

long

as a

rgum

ent is

pre

se

nte

d s

uita

bly

.

H4

46

/02

M

ark

Sc

he

me

Ju

ne

20

18

26

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

app

ly a

cq

uire

d k

now

ledg

e a

nd

un

ders

tand

ing

to th

e

co

nte

xt p

rovid

ed

. T

he c

and

idate

pro

vid

es a

limite

d d

iscu

ssio

n w

hic

h is

n

arro

w in

focus. J

udg

em

ents

if ma

de a

re w

eak a

nd

u

nsu

bsta

ntia

ted.

The

info

rma

tion is

basic

and

co

mu

nic

ate

d in

an

unstru

ctu

red w

ay. T

he

info

rma

tion

is s

upp

orte

d b

y lim

ited

evid

en

ce a

nd

the re

latio

nship

to th

e e

vid

en

ce m

ay n

ot b

e

cle

ar.

0 m

ark

s

No

atte

mpt to

an

sw

er th

e q

uestio

n o

r respo

nse is

not

wo

rthy o

f cre

dit.

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 (Oxford Cambridge and RSA Examinations) Head office Telephone: 01223 552552 Facsimile: 01223 552553 © OCR 2018

OCR (Oxford Cambridge and RSA Examinations)

The Triangle Building

Shaftesbury Road

Cambridge

CB2 8EA OCR Customer Contact Centre

Education and Learning

Telephone: 01223 553998

Facsimile: 01223 552627

Email: [email protected] www.ocr.org.uk For staff training purposes and as part of our quality assurance programme your call may be recorded or monitored

INSTRUCTIONS• Use black ink.• Complete the boxes above with your name, centre number and candidate number.• Answer all the questions. • Write your answer to each question in the space provided. Additional paper may be

used if required but you must clearly show your candidate number, centre number and question number(s).

• Do not write in the barcodes.

INFORMATION• The total mark for this paper is 140.• The marks for each question are shown in brackets [ ].• Quality of extended responses will be assessed in questions marked with an

asterisk (*).• This document consists of 28 pages.

Turn over© OCR 2017 [601/4911/5]DC (SC/SW) 155854/7 R

Last name

First name

Candidatenumber

Centrenumber

Oxford Cambridge and RSA

A Level Computer ScienceH446/02 Algorithms and Programming

Thursday 22 June 2017 – MorningTime allowed: 2 hours 30 minutes

Do not use:• A calculator

*6827705853*

OCR is an exempt Charity

* H 4 4 6 0 2 *

2

© OCR 2017

Answer all the questions.

Section A

1 A programmer needs to sort an array of numeric data using an insertion sort.

(a) (i) The following, incomplete, algorithm performs an insertion sort.

Complete the algorithm.

procedure sortit(dataArray, lastIndex)

for x = 1 to lastIndex

currentData = dataArray[……………………]

position = x

while (position > 0 AND dataArray[position-1] > currentData)

dataArray[position] = dataArray[………………………]

position = position - 1

endwhile

dataArray[position] = …………………………

next x

endprocedure

[3]

3

Turn over© OCR 2017

(ii) Show how an insertion sort would sort the following data:

6 1 15 12 5 6 9

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

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

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

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

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

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

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

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

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

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

(b) (i) Using Big-O notation state the best case complexity of insertion sort.

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

(ii) Explain what your answer to part (b)(i) means.

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

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

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

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

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

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

4

© OCR 2017

(c*) The number of data items in the array is continually increasing.

Insertion sort has a worst case time complexity of O(n2) and space complexity of O(1).

An alternative sorting algorithm that could be used is bubble sort which also has a worst case time complexity of O(n2) and space complexity of O(1).

Briefly outline how the bubble sort algorithm works. Discuss the relationship between the complexities and the two sorting algorithms and justify which of the two algorithms is best suited to sorting the array. [9]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

5

Turn over© OCR 2017

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

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

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

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

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

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

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

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

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

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

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

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

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

6

© OCR 2017

BLANK PAGE

PLEASE DO NOT WRITE ON THIS PAGE

7

Turn over© OCR 2017

2 A programmer is developing an ordering system for a fast food restaurant. When a member of staff inputs an order, it is added to a linked list for completion by the chefs.

(a) Explain why a linked list is being used for the ordering system.

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

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

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

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

(b) Each element in a linked list has:

• a pointer, nodeNo, which gives the number of that node • the order number, orderNo • a pointer, next, that points to the next node in the list

Fig. 2.1 shows the current contents of the linked list, orders.

nodeNo orderNo next

0 154 1

1 157 2

2 155 3

3 156 ∅

Fig. 2.1

∅ represents a null pointer.

(i) Order 158 has been made, and needs adding to the end of the linked list.

Add the order, 158, to the linked list as shown in Fig. 2.1. Show the contents of the linked list in the following table.

nodeNo orderNo next

[2]

8

© OCR 2017

(ii) Order 159 has been made. This order has a high priority and needs to be the second order in the linked list.

Add the order, 159, to the original linked list as shown in Fig. 2.1. Show the contents of the linked list in the following table.

nodeNo orderNo next

[3]

(c) The linked list is implemented using a 2D array, theOrders:

• Row 0 stores orderNo • Row 1 stores next

The data now stored in theOrders is shown in Fig. 2.2.

184 186 185 187

1 2 3

Fig. 2.2

theOrders[1,0] would return 1

The following algorithm is written:

procedure x() finished = false count = 0 while NOT(finished) if theOrders[1,count] == null then finished = true else output = theOrders[0,count] print(output) count = theOrders[1,count] endif endwhile output = theOrders[0,count] print(output)

endprocedure

9

Turn over© OCR 2017

(i) Outline why nodeNo does not need to be stored in the array.

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

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

(ii) Complete the trace table for procedure x, for the data shown in Fig. 2.2.

finished count output

[3]

(iii) Describe the purpose of procedure x.

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

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

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

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

10

© OCR 2017

(iv) A new order, 190, is to be added to theOrders. It needs to be the third element in the list.

The current contents of the array are repeated here for reference:

184 186 185 187

1 2 3

Describe how the new order, 190, can be added to the array, so the linked list is read in the correct order, without rearranging the array elements.

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

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

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

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

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

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

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

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

(d) The user needs to be able to search for, and find, a specific order number.

State an appropriate search algorithm that could be used, and justify your choice against an alternative Search algorithm.

Appropriate Search Algorithm ....................................................................................................

Justification ................................................................................................................................

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

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

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

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

11

Turn over© OCR 2017

(e) The programmer is writing the program using an IDE.

Identify three features of an IDE that the programmer would use when writing the code and describe how the features benefit the programmer.

1 .................................................................................................................................................

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

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

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

2 .................................................................................................................................................

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

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

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

3 .................................................................................................................................................

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

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

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

(f*) The programmer is considering using concurrent programming.

Discuss how concurrent programming can be applied to the food ordering system and the benefits and limitations of doing so. [9]

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

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

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

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

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

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

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

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

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

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

12

© OCR 2017

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

13

Turn over© OCR 2017

3 An encryption routine reads a line of text from a file, reverses the order of the characters in the string and subtracts 10 from the ASCII value of each letter, then saves the new string into the same file.

The program is split into sub-procedures. Three sub-procedures are described as follows:

• Read string from file • Push each character of the string onto a stack • Read and encrypt each character message

(a) (i) Identify one further sub-procedure that could be used in the program.

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

(ii) Describe two advantages of splitting the problem into sub-procedures.

1 .........................................................................................................................................

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

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

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

2 .........................................................................................................................................

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

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

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

(b) A function, readMessage:

• takes the file name as a parameter • reads and returns the line of text

Complete the pseudocode algorithm for readMessage:

function …………………………………………………………(fileName)

messageFile = openRead(…………………………………………………………)

message = messageFile.readLine()

messageFile. …………………………………………………………

return …………………………………………………………

endfunction [4]

14

© OCR 2017

(c) A function, push, can be used to add a character to a stack. For example:

theStack.push("H")

places the character H onto the stack, theStack.

A procedure, pushToStack, takes a string as a parameter and pushes each character of the message onto the stack, messageStack.

Complete the procedure below.

Add comments to explain how your code works.

procedure pushToStack(message)

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

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

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

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

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

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

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

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

endprocedure [5]

(d) Describe the steps that the program would have to take in order to encrypt the characters stored in the stack, and save them in a single variable.

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

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

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

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

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

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

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

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

.............................................................................................................................................. [5]

15

Turn over© OCR 2017

BLANK PAGE

PLEASE DO NOT WRITE ON THIS PAGE

16

© OCR 2017

4 A data structure is shown below in Fig. 4.1.

D X

HG

I

M

J

NL

K

E F

B A C

Fig. 4.1

(a) Identify the data structure shown in Fig. 4.1.

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

(b) The programmer is considering using a depth-first (post-order) traversal, or a breadth-first traversal to find the path between node A and node X.

(i) Explain the difference between a depth-first (post-order) and breadth-first traversal.

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

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

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

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

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

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

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

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

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

17

Turn over© OCR 2017

(ii) Show how a depth-first (post-order) traversal would find the path between node A and node X for the structure shown in Fig. 4.1.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(iii) Explain how you used backtracking in your answer to part (b)(ii).

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

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

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

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

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

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

18

© OCR 2017

5 A recursive function, calculate, is shown below:

01 function calculate(num1, num2)02 if num1 == num2 then03 return num104 elseif num1 < num2 then05 return calculate(num1, (num2-num1))06 else07 return calculate(num2, (num1-num2))08 endif09 endfunction

(a) Identify the lines where recursion is used.

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

(b) Trace the algorithm, showing the steps and result when the following line is run:

print(calculate(4,10))

[5]

19

Turn over© OCR 2017

(c) Re-write the function so it uses iteration instead of recursion.

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

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

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

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

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

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

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

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

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

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

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

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

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

20

© OCR 2017

Section B

Answer all questions.

6 A software developer is creating a Virtual Pet game.

The user can choose the type of animal they would like as their pet, give it a name and then they are responsible for caring for that animal. The user will need to feed, play with, and educate their pet.

The aim is to keep the animal alive and happy, for example if the animal is not fed over a set period of time then the pet will die.

• The game tells the user how hungry or bored the animal is as a percentage (%) and the animal’s intelligence is ranked as a number between 0 and 150 (inclusive).

• Hunger and boredom increase by 1% with every tick of a timer. • When the feed option is selected, hunger is reduced to 0. • When the play option is selected, bored is reduced to 0. • When the read option is selected, the intelligence is increased by 0.6% of its current

value.

An example of the game is shown:

What type of pet would you like? Fox or Elephant?

Fox

What would you like to name your Fox?

Joanne

Joanne’s stats are

Hunger: 56%

Bored: 85%

Intelligence: 20

What would you like to do with your pet? Play, Read or Feed?

Fig. 1.1

(a) Identify three inputs that the user will have to enter to start, and/or play the game.

1 .................................................................................................................................................

2 .................................................................................................................................................

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

21

Turn over© OCR 2017

(b) The developer is using decomposition to design the game.

(i) Describe the process of decomposition.

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

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

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

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

(ii) The developer has produced the following structure diagram for the game:

Virtual Pet

Choose Pet

Start game Play game

ReadFeed

ReduceHunger to 0

Timer

Complete the structure diagram for the Virtual Pet game by filling in the empty boxes. [6]

22

© OCR 2017

(c) The developer needs to write procedures for the options play and read. Each of the options changes its corresponding value, and outputs the results to the screen.

(i) Write a procedure, using pseudocode, to reset bored and output the new value in an appropriate message.

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

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

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

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

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

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

(ii) Write a procedure, using pseudocode, to increase intelligence by 0.6% and output the new intelligence in an appropriate message.

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

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

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

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

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

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

23

Turn over© OCR 2017

(d) The developer is extending the game to allow users to have multiple pets of different types. The developer has written a class, Pet.

The attributes and methods in the class are described in the table:

Identifier Attribute/Method Description

petName Attribute Stores the pet’s name

bored Attribute Stores the % bored

hunger Attribute Stores the % hunger

intelligence Attribute Stores the intelligence

type Attribute Stores the type of animal

new Method Creates a new instance of pet

feed Method Reduces hunger to 0 and outputs hunger

play Method Reduces bored to 0 and outputs bored

read Method Increases intelligence by a set value

outputGreeting Method Outputs a message to the user

Part of the class declaration is given:

class Pet private petName private bored private hunger private intelligence private type … …

24

© OCR 2017

(i) After a user enters the pet name, and chooses a type, the constructor method of Pet is called to create a new instance. The method needs to set petName, as well as hunger, bored and intelligence to starting values of 0.

Write, using pseudocode, the constructor method for this class.

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

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

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

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

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

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

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

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

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

(ii) Write a line of code that creates a new instance of Pet for a Tiger called “Springy”.

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

25

Turn over© OCR 2017

(iii) The method outputGreeting for the superclass is written as follows:

public procedure outputGreeting() print("Hello, I'm " + petName + ", I'm a " + type) endprocedure

A class is needed for Tiger. The class needs to:

• inherit the methods and attributes from pet • in the constructor, set type to Tiger, intelligence to 10, hunger to 50 and

bored to 10 • extend the method outputGreeting, by outputting an additional line that says “I like to eat meat and roar”

Write, using pseudocode, the class Tiger.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

...................................................................................................................................... [5]

26

© OCR 2017

(e*) The developer made use of abstraction when creating the Virtual Pet game.

Discuss the need for and purpose of abstraction and how abstraction will be used in the development of the game. [9]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

27

© OCR 2017

(f) The developer is storing the user’s pets in a 1-dimensional array. At each timer interval, the array is searched, using a linear search, to check if any pets’ hunger or bored values are greater than 90%. If they are, an alert is displayed to the user.

(i) State the complexity of searching the pets in Big-O notation.

...................................................................................................................................... [1]

(ii) A given computer takes 4 milliseconds (ms) to search an array of 20 pets. Calculate an estimate of how long the computer will take to search an array of 100 pets.

Show your working.

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [2]

END OF QUESTION PAPER

28

© OCR 2017

PLEASE DO NOT WRITE ON THIS PAGE

Oxford Cambridge and RSA

Copyright Information

OCR is committed to seeking permission to reproduce all third-party content that it uses in its 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, First Floor, 9 Hills Road, Cambridge CB2 1GE.

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.

Oxford Cambridge and RSA Examinations

GCE

Computer Science

Unit H446A/02: Algorithms and programming

Advanced GCE

Mark Scheme for June 2017

OCR (Oxford Cambridge and RSA) is a leading UK awarding body, providing a wide range of qualifications to meet the needs of candidates of all ages and abilities. OCR qualifications include AS/A Levels, Diplomas, GCSEs, Cambridge Nationals, Cambridge Technicals, Functional Skills, Key Skills, Entry Level qualifications, NVQs and vocational qualifications in areas such as IT, business, languages, teaching/training, administration and secretarial skills. It is also responsible for developing new specifications to meet national requirements and the needs of students and teachers. OCR is a not-for-profit organisation; any surplus made is invested back into the establishment to help towards the development of qualifications and support, which keep pace with the changing needs of today’s society. This mark scheme is published as an aid to teachers and students, to indicate the requirements of the examination. It shows the basis on which marks were awarded by examiners. It does not indicate the details of the discussions which took place at an examiners’ meeting before marking commenced. All examiners are instructed that alternative correct answers and unexpected approaches in candidates’ scripts must be given marks that fairly reflect the relevant knowledge and skills demonstrated. Mark schemes should be read in conjunction with the published question papers and the report on the examination. OCR will not enter into any discussion or correspondence in connection with this mark scheme. © OCR 2017

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

3

An

no

tatio

ns

An

no

tatio

n

Mea

nin

g

Om

issio

n m

ark

Be

nefit o

f the d

oubt

Inco

rrect p

oin

t

Follo

w th

rou

gh

No

t answ

ere

d q

uestio

n

No b

en

efit o

f doubt g

ive

n

Re

pe

at

Co

rrect p

oin

t

To

o v

ag

ue

Bla

nk P

ag

e –

this

annota

tion m

ust b

e u

sed o

n a

ll bla

nk p

ag

es w

ithin

an a

nsw

er b

ookle

t (stru

ctu

red o

r unstru

ctu

red) a

nd o

n

each p

ag

e o

f an a

dd

itional o

bje

ct w

he

re th

ere

is n

o c

andid

ate

response.

Leve

l 1

Leve

l 2

Leve

l 3

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

4

Su

bje

ct-s

pe

cific

Ma

rkin

g In

stru

ctio

ns

IN

TR

OD

UC

TIO

N

Yo

ur firs

t task a

s a

n E

xa

min

er is

to b

ecom

e th

oro

ug

hly

fam

iliar w

ith th

e m

ate

rial o

n w

hic

h th

e e

xa

min

atio

n d

ep

en

ds. T

his

ma

teria

l inclu

de

s:

th

e s

pecific

atio

n, e

spe

cia

lly th

e a

ssessm

ent o

bje

ctiv

es

th

e q

uestio

n p

ap

er a

nd its

rubric

s

th

e m

ark

sch

em

e.

Yo

u s

hou

ld e

nsu

re th

at y

ou h

ave

co

pie

s o

f these

ma

teria

ls.

Yo

u s

hou

ld e

nsu

re a

lso

that y

ou a

re fa

milia

r with

the a

dm

inis

trativ

e p

rocedu

res re

late

d to

the m

ark

ing p

roce

ss. T

hese

are

se

t out in

the O

CR

b

oo

kle

t Instru

ctio

ns fo

r Ex

am

iners

. If yo

u a

re e

xa

min

ing

for th

e firs

t time

, ple

ase

read c

are

fully

Ap

pen

dix

5 In

trod

uc

tion

to S

crip

t Ma

rkin

g:

No

tes

for N

ew

Ex

am

iners

. P

lease

ask fo

r help

or g

uid

an

ce w

hen

eve

r yo

u n

ee

d it. Y

our firs

t poin

t of c

onta

ct is

yo

ur T

eam

Lead

er.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

5

US

ING

TH

E M

AR

K S

CH

EM

E

Ple

ase

stu

dy th

is M

ark

Sch

em

e c

are

fully

. Th

e M

ark

Sch

em

e is

an in

teg

ral p

art o

f the p

rocess th

at b

eg

ins w

ith th

e s

ettin

g o

f the q

uestio

n p

ap

er

and

en

ds w

ith th

e a

wa

rdin

g o

f gra

de

s. Q

uestio

n p

ape

rs a

nd M

ark

Sch

em

es a

re d

eve

lope

d in

asso

cia

tion

with

ea

ch

oth

er s

o th

at is

su

es o

f d

iffere

ntia

tion

an

d p

ositiv

e a

ch

ieve

me

nt c

an b

e a

ddre

ssed

from

the v

ery

sta

rt. T

his

Ma

rk S

ch

em

e is

a w

ork

ing d

ocu

men

t; it is n

ot e

xh

au

stiv

e; it d

oe

s n

ot p

rovid

e ‘c

orre

ct’ a

nsw

ers

. Th

e M

ark

Sch

em

e c

an o

nly

pro

vid

e ‘b

est

gu

esses’ a

bo

ut h

ow

the q

uestio

n w

ill wo

rk o

ut, a

nd it is

su

bje

ct to

revis

ion a

fter w

e h

ave

loo

ke

d a

t a w

ide ra

ng

e o

f scrip

ts.

Th

e E

xa

min

ers

’ Sta

nd

ard

isa

tion

Me

etin

g w

ill ensu

re th

at th

e M

ark

Sch

em

e c

ove

rs th

e ra

ng

e o

f can

did

ate

s’ re

spo

nses to

the

qu

estio

ns, a

nd th

at a

ll E

xa

min

ers

und

ers

tand

an

d a

pp

ly th

e M

ark

Sch

em

e in

the s

am

e w

ay. T

he

Ma

rk S

ch

em

e w

ill be d

iscu

ssed

an

d a

me

nd

ed

at th

e m

eetin

g, a

nd

adm

inis

trativ

e p

roced

ure

s w

ill be c

onfirm

ed. C

o-o

rdin

atio

n s

crip

ts w

ill be is

su

ed

at th

e m

eetin

g to

exe

mp

lify a

spe

cts

of c

andid

ate

s’ re

spo

nses a

nd

achie

ve

me

nts

; the c

o-o

rdin

atio

n s

crip

ts th

en

be

co

me

part o

f this

Ma

rk S

ch

em

e.

Be

fore

the S

tand

ard

isatio

n M

eetin

g, y

ou s

hou

ld re

ad

an

d m

ark

in p

en

cil a

num

ber o

f scrip

ts, in

ord

er to

ga

in a

n im

pre

ssio

n o

f the ra

ng

e o

f re

spo

nse

s a

nd

ach

ieve

me

nt th

at m

ay b

e e

xp

ecte

d.

In y

our m

ark

ing

, yo

u w

ill enco

un

ter v

alid

respo

nse

s w

hic

h a

re n

ot c

ove

red b

y th

e M

ark

Sch

em

e: th

ese re

spo

nse

s m

ust b

e c

redite

d. Y

ou w

ill e

nco

un

ter a

nsw

ers

wh

ich

fall o

uts

ide th

e ‘ta

rge

t rang

e’ o

f Ba

nd

s fo

r the p

ape

r wh

ich

yo

u a

re m

ark

ing

. Ple

ase

ma

rk th

ese

an

sw

ers

accord

ing

to th

e

ma

rkin

g c

riteria

. P

lease

read

care

fully

all th

e s

crip

ts in

yo

ur a

llocatio

n a

nd

make

eve

ry e

ffort to

look p

ositiv

ely

for a

ch

ieve

me

nt th

roug

hou

t the

ab

ility ra

ng

e. A

lwa

ys

be p

rep

are

d to

use th

e fu

ll rang

e o

f ma

rks.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

6

LE

VE

LS

OF

RE

SP

ON

SE

QU

ES

TIO

NS

: T

he in

dic

ativ

e c

on

tent in

dic

ate

s th

e e

xp

ecte

d p

ara

me

ters

for c

and

idate

s’ a

nsw

ers

, but b

e p

repa

red

to re

cog

nis

e a

nd

cre

dit u

ne

xp

ecte

d

app

roa

ch

es w

here

they s

how

rele

va

nce

. U

sin

g ‘b

est-fit’, d

ecid

e firs

t wh

ich

se

t of B

AN

D D

ES

CR

IPT

OR

S b

est d

escrib

es th

e o

ve

rall q

uality

of th

e a

nsw

er. O

nce

the b

an

d is

locate

d, a

dju

st

the m

ark

co

nce

ntra

ting

on

featu

res o

f the a

nsw

er w

hic

h m

ake it s

trong

er o

r we

ake

r follo

win

g th

e g

uid

elin

es fo

r refin

em

ent.

H

igh

est m

ark

: If cle

ar e

vid

en

ce o

f all th

e q

ualitie

s in

the b

an

d d

escrip

tors

is s

how

n, th

e H

IGH

ES

T M

ark

sh

ou

ld b

e a

wa

rde

d.

L

ow

est m

ark

: If the a

nsw

er s

how

s th

e c

and

idate

to b

e b

ord

erlin

e (i.e

. they h

ave

ach

ieve

d a

ll the q

ua

lities o

f the b

an

ds b

elo

w a

nd

sh

ow

limite

d e

vid

en

ce o

f me

etin

g th

e c

riteria

of th

e b

and

in q

uestio

n) th

e L

OW

ES

T m

ark

sh

ou

ld b

e a

wa

rde

d.

M

idd

le m

ark

: Th

is m

ark

sh

ou

ld b

e u

sed fo

r ca

nd

idate

s w

ho a

re s

ecure

in th

e b

an

d. T

hey a

re n

ot ‘b

ord

erlin

e’ b

ut th

ey h

ave

only

achie

ve

d

so

me

of th

e q

ualitie

s in

the b

an

d d

escrip

tors

.

Be

pre

pa

red to

use th

e fu

ll rang

e o

f ma

rks. D

o n

ot re

serv

e (e

.g.) h

igh B

an

d 3

ma

rks ‘in

ca

se

’ so

me

thin

g tu

rns u

p o

f a q

uality

yo

u h

ave

no

t ye

t se

en

. If an a

nsw

er g

ive

s c

lear e

vid

en

ce o

f the q

ua

lities d

escrib

ed

in th

e b

and

de

scrip

tors

, rew

ard

app

rop

riate

ly.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

7

A

O1

A

O2

A

O3

Hig

h (th

oro

ug

h)

Pre

cis

ion in

the u

se o

f que

stio

n

term

inolo

gy. K

now

ledg

e s

how

n is

co

nsis

tent a

nd

we

ll-deve

lope

d.

Cle

ar a

pp

recia

tion o

f the q

uestio

n

from

a ra

ng

e o

f diffe

rent

pers

pectiv

es m

akin

g e

xte

nsiv

e

use o

f acq

uire

d k

now

led

ge a

nd

u

nd

ers

tand

ing

.

Kn

ow

ledg

e a

nd

un

de

rsta

ndin

g

sh

ow

n is

co

nsis

tently

app

lied to

co

nte

xt e

na

blin

g a

log

ical a

nd

su

sta

ined

arg

um

ent to

de

ve

lop.

Exa

mp

les u

se

d e

nh

an

ce ra

ther

than

detra

ct fro

m re

spo

nse

.

Co

nce

rted e

ffort is

ma

de to

co

nsid

er a

ll aspe

cts

of a

syste

m /

pro

ble

m o

r we

igh

up b

oth

sid

es to

a

n a

rgum

ent b

efo

re fo

rmin

g a

n

ove

rall c

onclu

sio

n. J

udg

em

ents

m

ade

are

ba

se

d o

n a

pp

ropria

te

and

co

ncis

e a

rgu

me

nts

that h

ave

b

ee

n d

eve

lope

d in

respon

se

resultin

g in

them

bein

g b

oth

su

pp

orte

d a

nd

realis

tic.

Mid

dle

(rea

so

nab

le)

Aw

are

ne

ss o

f the m

ean

ing o

f the

term

s in

the q

uestio

n. K

no

wle

dg

e

is s

oun

d a

nd e

ffectiv

ely

d

em

onstra

ted. D

em

and

s o

f q

uestio

n u

nd

ers

tood a

ltho

ug

h a

t tim

es o

pp

ortu

nitie

s to

ma

ke u

se o

f a

cq

uire

d k

now

ledg

e a

nd

und

ers

tand

ing

not a

lwa

ys ta

ke

n.

Kn

ow

ledg

e a

nd

un

de

rsta

ndin

g

app

lied to

co

nte

xt. W

hils

t cle

ar

evid

en

ce th

at a

n a

rgum

en

t build

s

and

de

ve

lops th

roug

h re

sp

on

se

there

are

times w

hen

opp

ortu

nitie

s

are

mis

se

d to

use a

n e

xa

mp

le o

r re

late

an a

spe

ct o

f kn

ow

ledg

e o

r u

nd

ers

tand

ing

to th

e c

onte

xt

pro

vid

ed

.

Th

ere

is a

reaso

na

ble

atte

mp

t to

reach

a c

onclu

sio

n c

onsid

erin

g

aspe

cts

of a

syste

m / p

rob

lem

or

we

igh

ing u

p b

oth

sid

es o

f an

arg

um

ent. H

ow

eve

r the im

pact o

f th

e c

onclu

sio

n is

ofte

n le

sse

ne

d

by a

lack o

f su

pp

orte

d ju

dg

em

ents

w

hic

h a

cco

mp

an

y it. T

his

inab

ility

to b

uild

on

an

d d

eve

lop lin

es o

f a

rgu

me

nt a

s d

eve

lope

d in

the

respo

nse

ca

n d

etra

ct fro

m th

e

ove

rall q

uality

of th

e re

spo

nse

.

Lo

w (b

as

ic)

Co

nfu

sio

n a

nd

ina

bility

to

deco

nstru

ct te

rmin

olo

gy a

s u

se

d in

th

e q

uestio

n. K

now

ledg

e p

artia

l a

nd

su

pe

rficia

l. Focu

s o

n q

uestio

n

narro

w a

nd

ofte

n o

ne

-dim

ensio

na

l.

Inab

ility to

ap

ply

kn

ow

ledg

e a

nd

u

nd

ers

tand

ing

in a

ny s

usta

ined

wa

y to

co

nte

xt re

sultin

g in

tenu

ou

s

and

un

su

pp

orte

d s

tate

me

nts

bein

g

ma

de

. Exa

mp

les if u

se

d a

re fo

r th

e m

ost p

art irre

leva

nt a

nd

unsu

bsta

ntia

ted.

Little

or n

o a

ttem

pt to

prio

ritise o

r w

eig

h u

p fa

cto

rs d

urin

g c

ours

e o

f a

nsw

er. C

onclu

sio

n is

ofte

n

dis

loca

ted

from

resp

on

se

an

d a

ny

judg

em

ents

lack s

ubsta

nce

du

e in

p

art to

the b

asic

leve

l of a

rgu

me

nt

that h

as b

ee

n d

em

onstra

ted

thro

ug

hout re

spo

nse.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

8

A

ssessme

nt O

bje

ctive

AO

1

Dem

on

strate kno

wled

ge and

un

derstan

din

g of th

e prin

ciples an

d co

ncep

ts of co

mp

ute

r science, in

clud

ing ab

straction

, logic, algo

rithm

s and

data

represe

ntatio

n.

AO

1.1

D

emo

nstrate kn

ow

led

ge o

f the p

rincip

les and

con

cepts o

f abstractio

n, lo

gic, algorith

ms, d

ata represe

ntatio

n o

r oth

er as app

rop

riate.

AO

1.2

D

emo

nstrate u

nd

erstand

ing o

f the p

rincip

les and

con

cepts o

f abstractio

n, lo

gic, algorith

ms, d

ata represen

tation

or o

ther as ap

pro

priate.

AO

2

Ap

ply kn

ow

ledge an

d u

nd

erstand

ing o

f the p

rincip

les and

con

cepts o

f com

pu

ter scien

ce inclu

din

g to an

alyse pro

blem

s in co

mp

utatio

nal te

rms.

AO

2.1

A

pp

ly kno

wled

ge and

un

derstan

din

g of th

e prin

ciples an

d co

ncep

ts of co

mp

ute

r science.

AO

2.2

A

nalyse p

rob

lems in

com

pu

tation

al term

s.

AO

3

Design

, pro

gram an

d evalu

ate com

pu

ter system

s that so

lve pro

blem

s, makin

g reason

ed ju

dgem

ents ab

ou

t these

and

prese

ntin

g con

clusio

ns.

AO

3.1

D

esign co

mp

ute

r systems th

at solve p

rob

lems.

AO

3.2

P

rogram

com

pu

ter system

s that so

lve pro

blem

s.

AO

3.3

Evalu

ate com

pu

ter systems th

at solve p

rob

lems, m

aking re

ason

ed ju

dgem

ents ab

ou

t these an

d p

resen

ting co

nclu

sion

s.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

9

Qu

es

tion

A

nsw

er

Ma

rks

Gu

ida

nc

e

1

a

i 1

mark

for e

ach c

orre

ct ite

m in

bo

ld

procedure sortit(dataArray, lastIndex)

for x = 1 to lastIndex

currentData = dataArray[x]

position = x

while (position > 0 AND dataArray[x – 1] > currentData)

dataArray[position] = dataArray[position-1]

position = position – 1

endwhile

dataArray[position] = currentData

next x

endprocedure

3

AO

1.1

(3

)

answ

ers

mu

st b

e in

the c

orre

ct c

ase a

s

giv

en

e.g

. currentData

1

a

ii 1

mark

for c

onte

nts

of e

ach

row

in ta

ble

6

1

15

12

5

6

9

1

6

15

12

5

6

9

6 is

the s

orte

d lis

t 1

is th

e c

om

pare

d to

sorte

d lis

t 1

is p

ut in

pla

ce in

so

rted lis

t

1

1

6

15

12

5

6

9

15 is

com

pare

d

15 is

in p

lace in

so

rted lis

t 1

1

6

12

15

5

6

9

12 is

com

pare

d

12 is

in p

lace in

so

rted lis

t 1

1

5

6

12

15

6

9

5 is

com

pare

d

5 is

in p

lace in

so

rted lis

t 1

1

5

6

6

12

15

9

6 is

com

pare

d

6 is

in p

lace in

so

rted lis

t 1

1

5

6

6

9

12

15

9 is

com

pare

d a

nd

put in

pla

ce

1

6

AO

2.1

(6

)

… e

ach ro

w is

dep

en

de

nt u

po

n th

e

pre

ce

din

g ro

w b

ein

g c

orre

ct

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

10

1

b

i O

(n)

1

AO

1.1

(1

)

1

b

ii 1

mark

per b

ulle

t to m

ax 3

T

he b

est c

ase is

for a

sorte

d lis

t (O(n

))

A

s th

e n

um

ber o

f ele

men

ts in

cre

ase

s

the n

um

ber o

f ste

ps in

cre

ase

s in

a lin

ea

r fashio

n

3

AO

1.2

(3

)

B(ii) d

ep

en

de

nt u

po

n b

(i) bein

g c

orre

ct

i.e. a

nsw

ers

for O

(n) o

nly

A

cce

pt a

ppro

pria

te g

raph

for b

ulle

t p

oin

ts 2

an

d 3

1

c

M

ark

Ba

nd

3 –

Hig

h le

ve

l (7

-9 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

tho

rou

gh

kn

ow

ledg

e a

nd

un

ders

tand

ing

of h

ow

b

ub

ble

so

rt wo

rks a

nd B

ig O

com

ple

xity

; the m

ate

rial is

ge

ne

rally

accura

te a

nd

d

eta

iled.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

un

ders

tand

ing d

irectly

and

co

nsis

tently

to th

e c

onte

xt p

rovid

ed

. Evid

en

ce/e

xa

mp

les w

ill be e

xp

licitly

re

leva

nt to

the e

xp

lana

tion

. T

he

re is

a w

ell-d

eve

lope

d lin

e o

f reaso

nin

g w

hic

h is

cle

ar a

nd

log

ica

lly

stru

ctu

red. T

he in

form

atio

n p

rese

nte

d is

rele

vant a

nd

su

bsta

ntia

ted.

Ma

rk B

an

d 2

– M

id le

ve

l (4

-6 m

ark

s)

Th

e c

and

idate

dem

onstra

tes re

as

on

ab

le k

now

led

ge a

nd

un

ders

tand

ing

of o

f h

ow

bub

ble

so

rt wo

rks a

nd B

ig O

com

ple

xity

; the m

ate

rial is

ge

ne

rally

accu

rate

b

ut a

t time

s u

nd

erd

eve

lope

d.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

un

ders

tand

ing d

irectly

to

the c

onte

xt p

rovid

ed

alth

ou

gh o

ne

or tw

o o

pp

ortu

nitie

s a

re m

isse

d.

Evid

en

ce/e

xa

mp

les a

re fo

r the m

ost p

art im

plic

itly re

leva

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

reaso

na

ble

dis

cussio

n, th

e m

ajo

rity o

f wh

ich

is

focuse

d. E

va

luativ

e c

om

me

nts

are

, for th

e m

ost p

art a

pp

ropria

te, a

lthoug

h

one

or tw

o o

pp

ortu

nitie

s fo

r deve

lopm

ent a

re m

isse

d.

The

re is

a lin

e o

f reaso

nin

g p

rese

nte

d w

ith s

om

e s

tructu

re. T

he in

form

atio

n

pre

se

nte

d is

in th

e m

ost p

art re

levan

t and s

upp

orte

d b

y s

om

e e

vid

en

ce.

Ma

rk B

an

d 1

– L

ow

Leve

l

9

AO

1.1

(2

) A

O1

.2

(2)

AO

2.1

(2

) A

O3

.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t

D

escrip

tion o

f bub

ble

sort:

S

tartin

g a

t the b

eg

innin

g o

f the

list Ite

ms a

re s

wa

pp

ed

with

their n

eig

hbo

ur if th

ey a

re o

ut o

f

ord

er.

E

ach p

air o

f neig

hbo

urs

is

ch

ecke

d in

ord

er.

W

hen

a s

wa

p is

ma

de a

flag

is

se

t.

If a

t the e

nd

of th

e lis

t the

flag

has b

ee

n s

et th

e fla

g is

un

set

and

the a

lgorith

m s

tarts

from

the b

eg

innin

g o

f the lis

t ag

ain

.

W

hen

the a

lgo

rithm

ge

ts to

the

end

of th

e lis

t and th

e fla

g is

unse

t the lis

t is s

orte

d a

nd

the

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

11

(1-3

ma

rks)

Th

e c

and

idate

dem

onstra

tes a

bas

ic k

now

ledg

e o

f of h

ow

bub

ble

so

rt wo

rks

and

Big

O c

om

ple

xity

with

limite

d u

nd

ers

tand

ing

sh

ow

n; th

e m

ate

rial is

basic

a

nd

co

nta

ins s

om

e in

accu

racie

s. T

he c

and

idate

s m

akes a

limite

d a

ttem

pt to

a

pp

ly a

cq

uire

d k

now

ledg

e a

nd

un

ders

tand

ing

to th

e c

onte

xt p

rovid

ed

. T

he c

and

idate

pro

vid

es a

limite

d d

iscu

ssio

n w

hic

h is

na

rrow

in fo

cus.

Ju

dg

em

ents

if ma

de a

re w

eak a

nd

un

su

bsta

ntia

ted

. T

he

info

rma

tion is

basic

and

co

mu

nic

ate

d in

an u

nstru

ctu

red w

ay. T

he

in

form

atio

n is

su

pp

orte

d b

y lim

ited e

vid

en

ce a

nd

the re

latio

nship

to th

e

evid

en

ce m

ay n

ot b

e c

lear.

0 m

ark

s

No

atte

mpt to

an

sw

er th

e q

uestio

n o

r respo

nse is

not w

orth

y o

f cre

dit.

alg

orith

m fin

ish

es.

O

(n2) d

en

ote

s a

s th

e d

ata

siz

e

incre

ase

s th

e tim

e th

e lis

t take

s

to s

ort in

cre

ase

s in

a q

ua

dra

tic

ma

nn

er.

O

(1) d

en

ote

s th

e s

pace

used

is

co

nsta

nt

AO

2: A

pp

licatio

n

A

s d

ata

se

t ge

ts b

igg

er, b

ub

ble

so

rt’s tim

e g

ets

larg

er a

t an

incre

asin

g ra

te..

C

om

ple

xity

doe

sn’t d

en

ote

the a

ctu

al

time

but th

e o

rder w

ith w

hic

h th

e

time

/sp

ace

gro

ws.

O

(1) sp

ace com

plexity m

eans n

o m

atter

ho

w b

ig the d

ata set b

ecom

es the

amo

un

t of sp

ace (extra to th

e data

itself) remain

s the sam

e.

O

(n2) tim

e c

om

ple

xity

me

an

s a

s n

incre

ase

s tim

e in

cre

ase

s b

y n

2 / if n

dou

ble

s th

e tim

e ta

ke

n is

sq

uare

d.

B

ubb

le s

ort c

an b

e tw

ea

ke

d w

ith

imp

rove

me

nts

(e.g

. ch

eckin

g o

ne

less ite

m p

er ite

ratio

n a

nd

alte

rnatin

g

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

12

so

rting

dire

ctio

ns).

T

hese o

ptim

isa

tion

s d

on

’t ch

ang

e

the c

om

ple

xity

. IT w

ill run a

little

qu

icke

r on s

ma

ller s

ets

bu

t time

take

n in

cre

ase

s ra

pid

ly w

ith d

ata

siz

e.

W

hen

ch

oo

sin

g a

n a

lgo

rithm

we

ma

y

als

o w

ant to

take in

to a

cco

unt th

e

ave

rag

e a

nd b

est c

ase s

ce

na

rios.

(in th

is c

ase th

ey a

re a

lso

the s

am

e

for b

oth

alg

orith

ms.)

A

O3

: Eva

lua

tion

T

he a

lgorith

ms m

ay h

ave

the

sa

me

time c

om

ple

xity

bu

t this

doe

s n

ot m

ean

they ta

ke th

e

sa

me

time to

exe

cute

on th

e

sa

me

data

se

t.

In

sertio

n s

ort g

ene

rally

perfo

rms

qu

icke

r than

bu

bble

so

rt and

is

there

fore

pre

fera

ble

. (Neith

er

sca

le w

ell h

ow

eve

r.)

B

oth

alg

orith

ms h

ave

a s

pace

co

mp

lexity

of O

(1). T

his

is

beca

use

bo

th a

lgo

rithm

s a

re in

-

pla

ce (i.e

. all s

ortin

g ta

kes p

lace

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

13

with

in th

e a

ctu

al d

ata

).

B

oth

have

a tim

e c

om

ple

xity

of

O(n

2) as a

co

nseq

uence

of th

eir

neste

d lo

op

s.

(NB

last tw

o p

oin

ts a

re o

nly

like

ly

to a

pp

ear in

the v

ery

hig

he

st

ma

rk a

nsw

ers

.)

2

a

1

mark

per b

ulle

t, to m

ax 2

, e.g

.

O

rders

ca

n b

e p

roce

ssed

in th

e o

rder th

ey a

re in

the q

ueu

e

O

rders

ca

n b

e in

serte

d a

t any p

lace in

the lis

t e.g

. hig

h p

riority

item

inserte

d e

arlie

r in th

e lis

t

O

rders

ca

n b

e d

ele

ted

from

any p

ositio

n in

the lis

t once th

ey a

re

co

mp

lete

L

ist is

dyn

am

ic…

to a

llow

ord

ers

to b

e a

dde

d / d

ele

ted

2

AO

1.2

(1

) A

O2

.1

(1)

2

b

i 1

mark

per b

ulle

t

nodeNo

and next

co

lum

ns a

re b

oth

co

rrect

orderNo

co

lum

n is

co

rrect

nodeNo

orderNo

next

2

AO

1.2

(2

)

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

14

154

1

1

157

2

2

155

3

3

156

4

4

158

2

b

ii 1

mark

per c

orre

ct c

olu

mn

nodeNo

orderNo

next

154

4

1

157

2

2

155

3

3

156

4

159

1

3

AO

1.2

(3

)

2

c

i

Th

e in

de

x/s

ubscrip

t of th

e a

rray a

cts

as th

e n

od

eN

o

1

AO

1.2

(1

)

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

15

2

c

ii 1

mark

for e

ach c

orre

ctly

co

mp

lete

d c

olu

mn

Finished

Count

output

Fals

e

0

184

(Fals

e)

1

186

(Fals

e)

2

185

Tru

e

3

187

3

AO

1.2

(1

) A

O2

.2

(2)

2

c

iii 1

mark

per b

ulle

t to m

ax 2

O

utp

ut th

e o

rder n

um

bers

...

...in

the o

rder th

ey a

re in

the lin

ke

d lis

t

2

AO

2.2

(2

)

2

c

iv

1 m

ark

per b

ulle

t to m

ax

O

rder 1

90 is

add

ed to

the

en

d

P

oin

ters

are

up

date

d

1

86

will p

oin

t to 4

1

90

will p

oin

t to 2

OR

Inde

x

0

1

2

3

4

Da

ta

184

186

185

187

190

Po

inte

r 1

4

3

2

4

AO

1.2

(2

) A

O2

.1

(2)

If a d

iag

ram

is g

ive

n th

en

the m

ark

for

upd

atin

g th

e p

oin

ters

is im

plic

it

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

16

2

d

A

lgo

rithm

, ma

x 1

lin

ea

r

Ju

stific

atio

n, 1

mark

per b

ulle

t to m

ax 2

Ite

ms d

o n

ot h

ave

to b

e in

a s

pecific

ord

er

B

inary

nee

ds ite

ms in

ord

er

3

AO

1.1

(1

) A

O2

.1

(2)

No

ma

rks fo

r justific

atio

n if lin

ea

r has n

ot

bee

n id

en

tified

2

e

1

mark

for fe

atu

re, 1

for b

en

efit. M

ax 2

pe

r featu

re.

e.g

. A

uto

-com

ple

te

C

an v

iew

iden

tifiers

/avo

id s

pe

lling

mis

takes

C

olo

ur c

odin

g te

xt/s

yn

tax h

igh

ligh

ting

C

an id

en

tify fe

atu

res q

uic

kly

/use to

ch

eck c

ode

is c

orre

ct

S

tepp

ing

R

un o

ne

line a

t a tim

e a

nd

ch

eck re

sult

B

reakp

oin

ts

S

top th

e c

od

e a

t a s

et p

oin

t to c

heck v

alu

e o

f va

riable

(s)

V

aria

ble

wa

tch

/wa

tch

win

do

w

6

AO

1.1

(3

) A

O1

.2

(3)

Qu

estio

n s

tate

s w

hen

writin

g th

e c

ode

, th

ere

fore

use o

f co

mp

iler/p

rod

ucin

g .e

xe

etc

. are

not a

wa

rde

d m

ark

s

Acce

pt a

ny s

uita

ble

featu

res e

.g. tra

ces,

cra

sh d

um

p, s

tack c

onte

nts

, cro

ss-

refe

rence

s, lin

e n

um

bers

, auto

-inde

nt

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

17

C

heck v

alu

es o

f va

riab

les a

nd

ho

w th

ey c

hang

e d

urin

g th

e e

xe

cutio

n

E

rror d

iagn

ostic

s

L

oca

te a

nd re

port e

rrors

/giv

e d

eta

il on e

rrors

2

f

Ma

rk B

an

d 3

– H

igh

leve

l (7

-9 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

tho

rou

gh

kn

ow

ledg

e a

nd

un

ders

tand

ing

of

co

ncu

rrent p

rog

ram

min

g; th

e m

ate

rial is

ge

ne

rally

accura

te a

nd d

eta

iled.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

un

ders

tand

ing d

irectly

and

co

nsis

tently

to th

e c

onte

xt p

rovid

ed

. Evid

en

ce/e

xa

mp

les w

ill be e

xp

licitly

re

leva

nt to

the e

xp

lana

tion

. T

he

re is

a w

ell-d

eve

lope

d lin

e o

f reaso

nin

g w

hic

h is

cle

ar a

nd

log

ica

lly

stru

ctu

red. T

he in

form

atio

n p

rese

nte

d is

rele

vant a

nd

su

bsta

ntia

ted.

Ma

rk B

an

d 2

– M

id le

ve

l (4

-6 m

ark

s)

Th

e c

and

idate

dem

onstra

tes re

as

on

ab

le k

now

led

ge a

nd

un

ders

tand

ing

of

co

ncu

rrent p

rog

ram

min

g; th

e m

ate

rial is

ge

ne

rally

accura

te b

ut a

t times

und

erd

eve

lope

d.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

un

ders

tand

ing d

irectly

to

the c

onte

xt p

rovid

ed

alth

ou

gh o

ne

or tw

o o

pp

ortu

nitie

s a

re m

isse

d.

Evid

en

ce/e

xa

mp

les a

re fo

r the m

ost p

art im

plic

itly re

leva

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

reaso

na

ble

dis

cussio

n, th

e m

ajo

rity o

f wh

ich

is

focuse

d. E

va

luativ

e c

om

me

nts

are

, for th

e m

ost p

art a

pp

ropria

te, a

lthoug

h

one

or tw

o o

pp

ortu

nitie

s fo

r deve

lopm

ent a

re m

isse

d.

There

is a

line o

f reaso

nin

g p

rese

nte

d w

ith s

om

e s

tructu

re. T

he in

form

atio

n

pre

se

nte

d is

in th

e m

ost p

art re

levan

t and s

upp

orte

d b

y s

om

e e

vid

en

ce.

Ma

rk B

an

d 1

– L

ow

Leve

l (1

-3 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

bas

ic k

now

ledg

e o

f co

ncurre

nt p

rog

ram

min

g

with

limite

d u

nd

ers

tand

ing

sh

ow

n; th

e m

ate

rial is

basic

and

co

nta

ins s

om

e

9

AO

1.1

(2

) A

O1

.2

(2)

AO

2.1

(2

) A

O3

.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t

P

rocesse

s a

re h

ap

pe

nin

g a

t the

sa

me

time/a

t ove

rlap

pin

g tim

es

O

nly

1 p

rocess c

an a

ctu

ally

hap

pe

n

at a

time o

n a

sin

gle

core

pro

cesso

r,

co

ncu

rrent trie

s to

sim

ula

te m

ultip

le

pro

ce

sse

s

O

ne p

rocess m

ay n

ee

d to

sta

rt

befo

re a

se

con

d h

as fin

ish

ed

In

div

idua

l pro

ce

sse

s a

re th

rea

ds,

each

thre

ad

has a

life lin

e

AO

2: A

pp

licatio

n

M

ultip

le o

rders

ca

n b

e m

ade

an

d

add

ed

to th

e lis

t at th

e s

am

e tim

e

P

rogra

mm

ing

will n

ee

d to

allo

w

mu

ltiple

thre

ad

s to

ma

nip

ula

te a

sin

gle

list

W

ill allo

w th

ose

read

ing

and

writin

g

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

18

inaccu

racie

s. T

he c

and

idate

s m

ake

s a

limite

d a

ttem

pt to

app

ly a

cq

uire

d

kn

ow

ledg

e a

nd u

nd

ers

tan

din

g to

the c

onte

xt p

rovid

ed

. T

he c

and

idate

pro

vid

es a

limite

d d

iscu

ssio

n w

hic

h is

na

rrow

in fo

cus.

Ju

dg

em

ents

if ma

de a

re w

eak a

nd

un

su

bsta

ntia

ted

. T

he

info

rma

tion is

basic

and

co

mu

nic

ate

d in

an u

nstru

ctu

red w

ay. T

he

in

form

atio

n is

su

pp

orte

d b

y lim

ited e

vid

en

ce a

nd

the re

latio

nship

to th

e

evid

en

ce m

ay n

ot b

e c

lear.

0 m

ark

s

No

atte

mpt to

an

sw

er th

e q

uestio

n o

r respo

nse is

not w

orth

y o

f cre

dit.

to m

anip

ula

te a

t the s

am

e tim

e

L

ockin

g w

ill nee

d im

ple

me

ntin

g –

mo

re c

om

ple

x p

rog

ram

min

g

AO

3: E

va

lua

tion

W

ill allo

w fo

r mu

ltiple

ord

ers

at th

e

sa

me

time –

as it w

ould

ha

ppe

n in

real life

A

cce

ss to

the lin

ke

d lis

t will n

ee

d to

be lim

ited s

o it c

ann

ot b

e

accesse

d/o

ve

rwritte

n b

y tw

o th

rea

ds

tryin

g to

do d

iffere

nt o

pera

tion

s

N

ot a

ll of th

e p

roce

ss w

ill be

para

llelis

eab

le. X

pro

cesso

rs d

oe

s

not m

ean

it will ru

n in

1/x

th o

f the

time

of o

ne p

roce

ssor.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

19

3

a

i S

ave

strin

g in

file

1

AO

2.2

(1

)

3

a

ii 1

mark

per b

ulle

t, ma

x 2

per a

dva

nta

ge

to m

ax 4

e

.g.

Pro

ced

ure

s c

an b

e re

-use

d

N

o n

ee

d to

rep

rog

ram

/save

s tim

e

P

rogra

m c

an b

e s

plit b

etw

een

pro

gra

mm

ers

C

an s

pecia

lise

in th

eir a

rea

S

pee

d u

p c

om

ple

tion

time

A

s m

ultip

le p

roced

ure

s w

ork

ed o

n c

oncu

rrently

E

asy to

test/d

eb

ug

A

s e

ach

mo

du

le c

an b

e te

ste

d o

n its

ow

n th

en

com

bin

ed

.

4

AO

1.2

(4

)

Allo

w a

ny a

pp

rop

riate

adva

nta

ge

s

3

b

1

mark

each

function readMessage(fileName)

messageFile = openRead(fileName)

message = messageFile.readLine()

messageFile.close()

return message

endfunction

4

AO

2.1

(4

)

We a

re n

ot te

stin

g p

se

udo

cod

e

kn

ow

ledg

e –

answ

ers

tha

t wo

rk b

ut d

o

not m

atc

h th

e p

seu

do c

od

e g

ive

n s

hou

ld

still b

e c

redite

d fu

ll mark

s.

readMessage

and fileName

and message

are

ca

se s

ensitiv

e

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

20

3

c

1

mark

per b

ulle

t to m

ax 5

U

se

of a

pp

ropria

te lo

op

C

orre

ct e

nd c

ond

ition (le

ng

th o

f message

)

C

orre

ct u

se o

f .push

with

messageStack

A

cce

ssin

g substring

(or e

qu

iva

lent) c

orre

ctly

A

ppro

pria

te c

om

me

nt(s

)

procedure pushToStack(message)

for x = 0 to message.length() //loop through each

//letter

messageStack.push(message.substring(x,1)) //take

//each character and push onto stack

next x //move to next letter

endprocedure

5

AO

2.1

(2

) A

O3

.2

(3)

3

d

1

mark

per b

ulle

t to m

ax 5

P

op e

lem

en

t from

sta

ck

C

onve

rt to A

SC

II va

lue

S

ubtra

ct 1

0 fro

m A

SC

II va

lue

C

onve

rt back to

ch

ara

cte

r

A

ppe

nd

/co

nca

ten

ate

with

va

riab

le

5

AO

1.2

(2

) A

O2

.2

(3)

Acce

pt p

seu

do

cod

e e

qu

iva

lent.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

21

4

a

T

ree

// Gra

ph

(und

irecte

d)

1

AO

1.2

(1

)

Do

no

t acce

pt b

inary

tree

4

b

i 1

mark

per b

ulle

t to m

ax 4

D

epth

-first g

oes to

left c

hild

no

de w

hen

it ca

n...

If th

ere

is n

o le

ft ch

ild it g

oe

s to

the rig

ht c

hild

w

hen

there

are

no c

hild

nod

es th

e a

lgo

rithm

‘vis

its’ it’ a

nd

ba

cktra

cks to

the p

are

nt n

od

e.

B

read

th-firs

t vis

its a

ll nod

es c

onn

ecte

d d

irectly

to s

tart n

od

e...

T

hen v

isits

all n

od

es d

irectly

co

nn

ecte

d to

each

of th

ose n

od

es (a

nd th

en

all n

od

es d

irectly

co

nn

ecte

d to

those

no

des a

nd s

o o

n…

)

D

epth

-first u

ses a

sta

ck

B

read

th-firs

t uses a

qu

eu

e

4

AO

1.2

(4

)

4

b

ii 1

mark

per n

od

e in

corre

ct o

rder

D

K

L

H

B

G

(X)

6

AO

2.1

(6

)

4

b

iii M

ax 3

e.g

.

W

hen

a n

od

e d

oe

s n

ot h

ave

any n

od

e to

vis

it e.g

. D

T

he a

lgorith

m g

oes b

ack to

the p

revio

us v

isite

d n

od

e e

.g. B

T

o c

heck fo

r furth

er n

ode

s to

vis

it e.g

. H

3

AO

1.2

(2

) A

O2

.1

(1)

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

22

T

his

repe

ats

until a

ne

w n

od

e c

an b

e v

isite

d, o

r all n

od

es h

ave

be

en

vis

ited

5

a

05 and 07

1

AO

2.1

(1

)

5

b

1

mark

for e

ach h

igh

ligh

ted e

lem

en

t

calculate(4,10)

if 4 == 10 FALSE

elseif 4 < 10 TRUE

return calculate(4, (10-4))

return calculate(4, 6)

if 4 == 6 FALSE

elseif 4 < 6 TRUE

return calculate(4, 6-4)

return calculate(4, 2)

if 4 == 2 FALSE

elseif 4 < 2 FALSE

else

return calculate(2, 4-2)

return calculate(2,2)

if 2 == 2 TRUE

return 2

return 2

return 2

return 2

5

AO

2.1

(5

)

Allo

w tra

ce ta

ble

or a

ny s

ensib

le

eq

uiv

ale

nt.

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

23

output(2)

5

c

1

mark

per b

ulle

t to m

ax 4

S

uita

ble

loo

p w

ith c

orre

ct c

ond

ition

In

IF: O

ve

rwritin

g n

um

2 w

ith n

um

2 –

num

1

In

EL

SE

: Ove

rwritin

g n

um

1 w

ith n

um

2...

... O

ve

rwritin

g n

um

2 w

ith n

um

1-n

um

2 c

orre

ctly

(usin

g a

tem

p v

aria

ble

)

e.g

. while num1 != num2

if num1 < num2 then

num2 = num2 – num1

else

temp = num1 – num2

num1 = num2

num2 = temp

endif

endwhile

4

AO

2.1

(1

) A

O2

.2

(1)

AO

3.2

(2

)

Alte

rna

tive

ly s

wa

pp

ing

va

lues b

y:

temp = num1

num1 = num2

num2 = temp – num2

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

24

6

a

1

mark

per in

put to

ma

x 3

C

hoic

e o

f pet

P

et n

am

e

F

eed

P

lay

R

ead

3

AO

2.1

(3

)

Allo

w a

ny re

aso

na

ble

inp

ut to

this

syste

m

6

b

i 1

mark

per b

ulle

t to m

ax 2

S

plittin

g a

pro

ble

m d

ow

n

In

to its

co

mp

on

ent p

arts

/su

b-p

roce

dure

s/m

odu

les

2

AO

1.1

(2

)

6

b

ii 1

mark

per b

ox

6

AO

2.2

(6

)

Ca

lcu

latio

ns m

ust b

e c

orre

ct

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

25

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

26

6

c

i 1

mark

per b

ulle

t to m

ax 3

D

efin

ing

pro

ced

ure

pla

y

o

Re

settin

g b

ore

d to

0

o

Ou

tputtin

g re

sult

e.g

. procedure play()

bored = 0

print("bored: " + bored + “%”)

endprocedure

3

AO

3.2

(3

)

6

c

ii 1

mark

per b

ulle

t to m

ax 3

De

finin

g p

roced

ure

read

o

Co

rrect c

alc

ula

tion

o

Ou

tputtin

g re

sult

e.g

. procedure read()

intelligence = intelligence * 1.006

print("intelligence: " + intelligence)

endprocedure

3

AO

2.2

(1

) A

O3

.2

(2)

6

d

i 1

mark

per b

ulle

t to m

ax 4

C

orre

ct d

ecla

ratio

n, a

pp

ropria

te n

am

e (e

.g. new

)

T

akin

g name

and theType

as a

para

me

ter

S

ettin

g petName

to p

ara

me

ter

4

AO

2.2

(1

) A

O3

.2

(3)

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

27

S

ettin

g bored

, hunger

and intelligence

to 0

e.g

. public procedure new(name, theType)

petName = name

bored = 0

hunger = 0

intelligence = 0

type = theType

endprocedure

6

d

ii 1

mark

per b

ulle

t to m

ax 2

myPet

/app

rop

riate

= new pet

Springy

and Tiger

, in ""

, in s

am

e o

rder a

s c

onstru

cto

r decla

ratio

n

e.g

. myPet = new pet("Springy", "Tiger")

2

AO

2.1

(2

)

6

d

iii 1

mark

per b

ulle

t to m

ax

C

lass d

ecla

ratio

n in

clu

din

g in

he

rit (or e

qu

iva

lent e

.g. T

ige

r exte

nd

s P

et,

Tig

er::P

et, T

iger(P

et))

C

onstru

cto

r pro

ce

dure

(ne

w) w

ith a

ll attrib

ute

s p

rese

nt

b

ore

d =

10, h

ung

er =

50, in

tellig

ence

= 1

0, ty

pe =

“Tig

er”

o

utp

utG

reetin

g p

roced

ure

O

utp

uttin

g o

rigin

al a

nd

ne

w m

essag

es c

orre

ctly

e.g

. class Tiger inherits Pet

5

AO

2.2

(2

) A

O3

.2

(3)

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

28

public procedure new(name)

petName = name

bored = 10

hunger = 50

intelligence = 10

type = "Tiger"

endprocedure

public procedure outputGreeting()

print("Hello, I'm " + petName + ", I'm a " + type)

print("I like to eat meat and roar")

endprocedure

endclass

Acce

pt

super.outputGreeting()

In p

lace o

f first print

sta

tem

ent

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

29

6

e

M

ark

Ba

nd

3 –

Hig

h le

ve

l (7

-9 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

tho

rou

gh

kn

ow

ledg

e a

nd

un

ders

tand

ing

of

abstra

ctio

n; th

e m

ate

rial is

ge

nera

lly a

ccura

te a

nd d

eta

iled.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

un

ders

tand

ing d

irectly

and

co

nsis

tently

to th

e c

on

text p

rovid

ed

. Evid

en

ce/e

xa

mp

les w

ill be e

xp

licitly

re

leva

nt to

the e

xp

lana

tion

. T

he

re is

a w

ell-d

eve

lope

d lin

e o

f reaso

nin

g w

hic

h is

cle

ar a

nd

log

ica

lly

stru

ctu

red. T

he in

form

atio

n p

rese

nte

d is

rele

vant a

nd

su

bsta

ntia

ted.

Ma

rk B

an

d 2

– M

id le

ve

l (4

-6 m

ark

s)

Th

e c

and

idate

dem

onstra

tes re

as

on

ab

le k

now

led

ge a

nd

un

ders

tand

ing

of

abstra

ctio

n; th

e m

ate

rial is

ge

nera

lly a

ccura

te b

ut a

t time

s u

nd

erd

eve

lope

d.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir k

now

ledg

e a

nd

un

ders

tand

ing d

irectly

to

the c

onte

xt p

rovid

ed

alth

ou

gh o

ne

or tw

o o

pp

ortu

nitie

s a

re m

isse

d.

Evid

en

ce/e

xa

mp

les a

re fo

r the m

ost p

art im

plic

itly re

leva

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

reaso

na

ble

dis

cussio

n, th

e m

ajo

rity o

f wh

ich

is

focuse

d. E

va

luativ

e c

om

me

nts

are

, for th

e m

ost p

art a

pp

ropria

te, a

lthoug

h

one

or tw

o o

pp

ortu

nitie

s fo

r deve

lopm

ent a

re m

isse

d.

The

re is

a lin

e o

f reaso

nin

g p

rese

nte

d w

ith s

om

e s

tructu

re. T

he in

form

atio

n

pre

se

nte

d is

in th

e m

ost p

art re

levan

t and s

upp

orte

d b

y s

om

e e

vid

en

ce.

Ma

rk B

an

d 1

– L

ow

Leve

l (1

-3 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

bas

ic k

now

ledg

e o

f abstra

ctio

n w

ith lim

ited

u

nd

ers

tand

ing

sh

ow

n; th

e m

ate

rial is

basic

and

co

nta

ins s

om

e in

accura

cie

s.

Th

e c

and

idate

s m

ake

s a

limite

d a

ttem

pt to

ap

ply

acq

uire

d k

now

ledg

e a

nd

und

ers

tand

ing

to th

e c

onte

xt p

rovid

ed

. T

he c

and

idate

pro

vid

es a

limite

d d

iscu

ssio

n w

hic

h is

na

rrow

in fo

cus.

Ju

dg

em

ents

if ma

de a

re w

eak a

nd

un

su

bsta

ntia

ted

. T

he

info

rma

tion is

basic

and

co

mu

nic

ate

d in

an u

nstru

ctu

red w

ay. T

he

in

form

atio

n is

su

pp

orte

d b

y lim

ited e

vid

en

ce a

nd

the re

latio

nship

to th

e

evid

en

ce m

ay n

ot b

e c

lear.

9

AO

1.1

(2

) A

O1

.2

(2)

AO

2.1

(2

) A

O3

.3

(3)

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

In

dic

ativ

e c

on

ten

t

R

em

ova

l of u

nn

ece

ssary

ele

me

nts

U

se

s s

ym

bols

to re

pre

sen

t ele

me

nts

of

the p

roble

m

In

cre

ase c

han

ce o

f cre

atin

g th

e p

rog

ram

su

ccessfu

lly

R

edu

ces p

rog

ram

min

g tim

e a

nd fa

cto

rs

that c

an d

etra

ct fro

m th

e p

rog

ram

AO

2: A

pp

licatio

n

E

xa

mp

les o

f use in

this

syste

m e

.g.

o

En

viro

nm

ent is

not s

ho

wn

o

Mo

ve

me

nts

redu

ced/re

mo

ve

d

o

Oth

er fa

cto

rs th

at c

an b

e

don

e/a

ffect th

e 'p

et' a

re re

mo

ve

d

o

Tim

e m

ay n

ot re

pre

sente

d a

s

min

ute

s, s

econ

ds

AO

3: E

va

lua

tion

R

edu

ces c

om

ple

xity

of p

rog

ram

min

g

R

eq

uire

s le

ss c

om

puta

tiona

l pow

er, s

o

the g

am

e c

an b

e p

laye

d o

n lo

we

r sp

ec

H446/0

2

Ma

rk S

ch

em

e

Ju

ne 2

017

30

0 m

ark

s

No

atte

mpt to

an

sw

er th

e q

uestio

n o

r respo

nse is

not w

orth

y o

f cre

dit.

devic

es e

.g. p

ho

nes

F

ocu

s is

on th

e c

ore

aspe

cts

of th

e

pro

gra

m ra

ther th

an

the e

xtra

s

T

oo m

uch a

bstra

ctio

n c

an

de

tract fro

m

the a

pp

ea

l of th

e g

am

e, m

ay b

e to

o

sim

plis

tic/n

ot re

alis

tic e

no

ug

h, m

ay n

ot

have

en

oug

h s

co

pe

to e

ng

ag

e u

sers

6

f i

O(n

) 1

AO

1.1

(1

)

6

f ii

1 m

ark

per b

ulle

t to m

ax 2

2

0(m

s)

sh

ow

ing

wo

rkin

g

2

AO

1.2

(1

) A

O2

.1

(1)

Oxford Cambridge and RSA Examinations is a Company Limited by Guarantee Registered in England Registered Office; 1 Hills Road, Cambridge, CB1 2EU Registered Company Number: 3484466 OCR is an exempt Charity OCR (Oxford Cambridge and RSA Examinations) Head office Telephone: 01223 552552 Facsimile: 01223 552553 © OCR 2017

OCR (Oxford Cambridge and RSA Examinations)

1 Hills Road

Cambridge

CB1 2EU OCR Customer Contact Centre

Education and Learning

Telephone: 01223 553998

Facsimile: 01223 552627

Email: [email protected] www.ocr.org.uk For staff training purposes and as part of our quality assurance programme your call may be recorded or monitored