186
A Level Computer Science Revision Pack Sample Papers The mark scheme for each paper follows the questions Included (in order of appearance) 01 – Computer Systems – Sample Paper 1 01 – Computer Systems – Sample Paper 2 02 – Algorithms and Programming – Sample Paper 1 02 – Algorithms and Programming – Sample Paper 2 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!

A Level Computer Science Revision Pack Sample Papers

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Level Computer Science Revision Pack Sample Papers

A Level Computer Science Revision Pack

Sample Papers

The mark scheme for each paper follows the questions

Included (in order of appearance) 01 – Computer Systems – Sample Paper 1 01 – Computer Systems – Sample Paper 2

02 – Algorithms and Programming – Sample Paper 1 02 – Algorithms and Programming – Sample Paper 2

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!

Page 2: A Level Computer Science Revision Pack Sample Papers

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

Page 3: A Level Computer Science Revision Pack Sample Papers

A Level Computer Science H446/01 Computer systems

Practice paper - Set 1 Time allowed: 2 hours 30 minutes

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.• If additional space is required, use the lined page(s) at the end of this booklet. The

question number(s) must be clearly shown.• 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 24 pages.

© OCR 2016 PRACTICE PAPER OCR is an exempt Charity H44601/7 Turn over

Do not use: • a calculator

First name

Last name

Centre number

Candidate number

Page 4: A Level Computer Science Revision Pack Sample Papers

2

© OCR 2016 PRACTICE PAPER H446/01

Answer all the questions.

1 A company releases a utility called RAMStore. The utility creates a virtual storage drive from an area of the computer’s RAM.

(a) Describe what is meant by the term utility software.

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

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

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

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

(b) Give one advantage of using RAM as storage in this way.

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

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

(c) The utility periodically copies what is in the RAM drive to secondary storage, such as ahard disk. Explain why this is necessary.

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

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

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

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

(d) It is important that enough RAM is left for the operating system to use. Describe atechnique that allows operating systems to overcome a lack of available RAM.

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

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

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

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

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

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

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

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

Page 5: A Level Computer Science Revision Pack Sample Papers

3

© OCR 2016 PRACTICE PAPER H446/01 Turn over

2 * Modern computers tend to have magnetic or solid state (flash) hard drives. Discuss which hard drive you would recommend for a keen video games player to use on their desktop PC.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 6: A Level Computer Science Revision Pack Sample Papers

4

© OCR 2016 PRACTICE PAPER H446/01

3 (a) Convert the unsigned binary number 11110000 to:

(i) Denary:

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

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

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

(ii) Hexadecimal:

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

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

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

(b) An AND operation with the mask 10101010 is applied to the binary number 01010101.Show the result.

01010101

10101010 AND

[1]

(c) An OR operation with the mask 10101010 is applied to the binary number 01010101.Show the result.

01010101

10101010 OR

[1]

Page 7: A Level Computer Science Revision Pack Sample Papers

5

© OCR 2016 PRACTICE PAPER H446/01 Turn over

(d) 00001100 is shifted two places to the left.

(i) Show the result.

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

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

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

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

(ii) Identify what arithmetic operation this shift is equivalent to.

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

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

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

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

(e) Convert the denary number -8 to:

(i) An 8-bit sign and magnitude binary number.

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

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

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

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

(ii) An 8-bit two’s complement binary number.

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

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

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

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

Page 8: A Level Computer Science Revision Pack Sample Papers

6

© OCR 2016 PRACTICE PAPER H446/01

(f) A computer represents floating point binary numbers using a 6-bit mantissa and 4-bitexponent, both using two’s complement.

Add the following three numbers together and give the answer in the format described.

You must show your working.

010100 0010

011000 0001

100010 0010

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

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

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

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

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

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

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

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

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

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

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

Page 9: A Level Computer Science Revision Pack Sample Papers

7

© OCR 2016 PRACTICE PAPER H446/01 Turn over

4 Below are extracts from the ASCII and EBCDIC character sets.

ASCII

EBCDIC

(a) Explain, referring to ASCII and EBCDIC, what would happen if computers were to usedifferent character sets when communicating.

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

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

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

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

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

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

Page 10: A Level Computer Science Revision Pack Sample Papers

8

© OCR 2016 PRACTICE PAPER H446/01

(b) Write a function that given the denary value of an EBCDIC uppercase letter, returns thedenary value of an ASCII uppercase letter. If a value is entered that doesn’t correspondto an uppercase EBCDIC letter the function should return -1

e.g.

convert(201) returns 73

convert(209) returns 74

convert(78) returns -1

function convert(ebValue)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

endfunction

[5]

Page 11: A Level Computer Science Revision Pack Sample Papers

9

© OCR 2016 PRACTICE PAPER H446/01 Turn over

5 The following is a program written using the Little Man Computer instruction set.

start LDA one

OUT

LDA zero

OUT

LDA count

SUB one

STA count

BRP start

HLT

one DAT 1

zero DAT 0

count DAT 3

(a) Describe the difference between the STA and LDA instructions.

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

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

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

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

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

(b) Identify the type of memory addressing the program uses.

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

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

(c) State the output this program generates.

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

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

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

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

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

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

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

Page 12: A Level Computer Science Revision Pack Sample Papers

10

© OCR 2016 PRACTICE PAPER H446/01

(d) Explain the buses and registers used when the line SUB one is executed.

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

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

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

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

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

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

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

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

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

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

(e) Explain, giving an example, how pipelining in a CPU could speed up the execution of thisprogram.

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

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

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

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

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

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

(f) Describe one issue the line BRP start may cause for a CPU using pipelining.

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

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

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

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

(g) Pipelining is one factor that affects the performance of a CPU. Identify one other factor.

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

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

Page 13: A Level Computer Science Revision Pack Sample Papers

11

© OCR 2016 PRACTICE PAPER H446/01 Turn over

6 A company is writing a syntax checker to be used when writing HTML.

(a) The first thing the program does is add every tag in a piece of text to the data structuredataStructureA.

The string X is added to dataStructureA with the code

dataStructureA.add(“X”)

The string type variable htmlCode holds the code that is to have its tags added.

If htmlCode were to contain:<html><head><title>My Page</title></head><body>Hello</body></html>

dataStructureA would have the following contents:

<html> <head> <title> </title> </head> <body> </body> </html>

Write the code to fill dataStructureA with the tags in htmlCode.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 14: A Level Computer Science Revision Pack Sample Papers

12

© OCR 2016 PRACTICE PAPER H446/01

(b) Part of the program checks that the HTML tags are well formed.Well formed HTML has tags that are nested but never overlapping.

e.g.

<p>The cat <strong>sat</strong> on the mat.</p> is well formed.

Whereas <p>The cat <strong>sat</p> on the mat.</strong> is not well formed as p closes before the strong inside it has been closed.

All comments and single tags (e.g. img, br etc) are removed from dataStructureA.

All attributes are removed from the within the tags.

(i) The contents of dataStructureA may look similar to below:

<html> <head> <title> </title> </head> <body> <h1> </h1> </body> </html>

Tags are removed from dataStructureA in the same order they were added.

Identify what type of data structure dataStructureA is.

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

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

dataStructureB is given a closing tag and gives the corresponding opening tag.

e.g.openingTag=dataStructureB.get(“</head>”)

openingTag is "<head>" (courier font)

(ii) Identify what type of data structure dataStructureB is.

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

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

Page 15: A Level Computer Science Revision Pack Sample Papers

13

© OCR 2016 PRACTICE PAPER H446/01 Turn over

The following code is used to check if the tags are well formed.

function checkTags(dataStructureA)

{

valid=true

//loops while code is still valid

//and dataStructureA has tags

while valid==true and dataStructureA.isEmpty()==false

tag=DataStructureA.remove()

//Next, check if closing tag

if tag.substring(1,1)==”/” then

if dataStructureC.remove()!=dataStructureB.get(tag)then

valid=false

endif

else

dataStructureC.add(tag)

endif

endwhile

return valid

}

(iii) Identify what type of data structure dataStructureC is.

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

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

(iv) Explain why dataStructureC is suited to checking if HTML is well formed.

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

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

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

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

Page 16: A Level Computer Science Revision Pack Sample Papers

14

© OCR 2016 PRACTICE PAPER H446/01

7 (a) An XOR gate is shown below. Complete the truth table for XOR.

A B Q

1 1

1 0

0 1

0 0

[2]

(b) A set of logic gates are connected as below.

Page 17: A Level Computer Science Revision Pack Sample Papers

15

© OCR 2016 PRACTICE PAPER H446/01 Turn over

(i) Complete the Truth Table below:

A B Cin S Cout

1 1 1

1 1 0

1 0 1

1 0 0

0 1 1

0 1 0

0 0 1

0 0 0

[4]

(ii) Explain what the circuit does. You should refer to A,B, Cin, S and Cout in youranswer.

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

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

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

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

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

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

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

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

(c) (i) Write a Boolean expression equivalent to S. [1]

S ≡

(ii) Write a Boolean expression equivalent to Cout. [2]

Cout ≡

Page 18: A Level Computer Science Revision Pack Sample Papers

16

© OCR 2016 PRACTICE PAPER H446/01

8 A database stores information about songs on a music streaming service.

One of the tables called Song has the fields.

Title, Artist, Genre, Length

(a) Explain why none of these fields would be suitable as a primary key.

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

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

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

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

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

(b) Give one advantage and one disadvantage of indexing the field Artist.

Advantage ..........................................................................................................................

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

Disadvantage .....................................................................................................................

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

(c) Users can build up playlists of their songs. Another table is created called Playlist.

Explain why a third table which we shall call PlaylistEntry is needed. You shoulduse an ER diagram to illustrate your answer.

[4]

Page 19: A Level Computer Science Revision Pack Sample Papers

17

© OCR 2016 PRACTICE PAPER H446/01 Turn over

(d) A band called RandomBits removes their permission for their songs to be streamed.

The company removes all the songs belonging to RandomBits from their service.

(i) Identify the law with which the company are complying.

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

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

(ii) Write an SQL statement that will remove all songs by RandomBits from the tableSong.

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

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

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

(iii) When the songs have been removed, explain what must happen to the tablePlayListEntry if the database is to retain its referential integrity. (You are notexpected to write the SQL to do this).

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

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

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

Page 20: A Level Computer Science Revision Pack Sample Papers

18

© OCR 2016 PRACTICE PAPER H446/01

9* ‘Modern technology and UK laws mean privacy is dead.’

Discuss the extent to which you agree with this statement.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

............................................................................................................................................ [12]

Page 21: A Level Computer Science Revision Pack Sample Papers

19

© OCR 2016 PRACTICE PAPER H446/01 Turn over

10 A software development company is building an operating system for a mobile phone that is in the process of being designed.

(a) Give one reason the phone needs an operating system.

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

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

(b) Explain how the developers could use virtual machines.

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

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

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

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

(c) One of the developers is responsible for writing the code for what happens when theCPU receives an interrupt. Outline what the code must do.

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 22: A Level Computer Science Revision Pack Sample Papers

20

© OCR 2016 PRACTICE PAPER H446/01

(d) The developers follow the waterfall lifecycle.

(i) List three stages of the waterfall lifecycle.

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

2 ..................................................................................................................................

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

(ii) Justify why the waterfall lifecycle is suited to the development of the operatingsystem.

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

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

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

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

(iii) Give one disadvantage of using the waterfall lifecycle to develop the operatingsystem.

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

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

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

Page 23: A Level Computer Science Revision Pack Sample Papers

21

© OCR 2016 PRACTICE PAPER H446/01 Turn over

(e) * The code is written using an object-oriented programming (OOP) language. Discussthe advantages and disadvantages to the team of developers of using OOP overprocedural programming. You should refer to inheritance, encapsulation andpolymorphism in your answer.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 24: A Level Computer Science Revision Pack Sample Papers

22

© OCR 2016 PRACTICE PAPER H446/01

11 A website has the following HTML code.

<html>

<head>

<title>My Stamp Collection - European Stamps</title>

</head>

<body>

<h1 style="font-family:Arial; color:darkGreen">United

Kingdom</h1>

<p>These are my stamps from the uk.</p>

<!-- Code A -->

<!-- Code B -->

</body>

</html>

the site’s owner wants to add the photo UKstamps.jpg in place of the comment <!-- Code A -->

(a) Write the code that should go in place of the comment <!-- Code A -->:

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

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

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

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

(b) Where the comment <!-- Code B --> is, the site’s owner wants to add the text:

Find out more about UK stamps

as a link to the UK Stamp Collectors Guild website which has the URL:

http://ukstampcollectorsguild.co.uk

Write the code that should go in place of the comment <!-- Code B -->

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

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

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

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

Page 25: A Level Computer Science Revision Pack Sample Papers

23

© OCR 2016 PRACTICE PAPER H446/01 Turn over

(c) The site uses styling set out as attributes in tags rather than a linked CSS file.

(i) Give one disadvantage of this to the site’s owner.

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

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

(ii) Give one disadvantage of this to the site’s visitors.

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

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

(d) The site needs a light green (web colour lightGreen) background.Explain what change needs to be made to the current page in order to do this.

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

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

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

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

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

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

(e) The site’s owner notices that his site doesn’t come up high in the results from a searchengine that uses the PageRank algorithm. State what would affect his site’s ranking.

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

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

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

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

END OF QUESTION PAPER

Page 26: A Level Computer Science Revision Pack Sample Papers

24

© OCR 2016 PRACTICE PAPER H446/01

ADDITIONAL ANSWER SPACE

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

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.

Page 27: A Level Computer Science Revision Pack Sample Papers

H446/01

Practice Paper 1 G

CE C

OM

PUTER

SCIEN

CE

H446/01

Com

puter Systems

Duration: 2 hours 30 m

inutes

M

AXIMU

M M

ARK

140

This docum

ent consists of 30 pages

Page 28: A Level Computer Science Revision Pack Sample Papers

9

Question

Answ

er M

arks G

uidance

1 a

-

A piece of software…

-

…w

ith one purpose…

- usually to do w

ith the upkeep/maintenance of a

computer.

(1 per -, max 2)

2

AO1.1

b

Faster read/w

rite speed than secondary storage media.

1

AO1.2

c

-

RAM

is volatile meaning it loses contents w

hen pow

er is off …

- …

so must be copied to secondary storage in case

of unexpected power failure

(1 per -,)

2

AO1.2

d

-

Mem

ory contents are divided into pages -

Pages not needed get moved to virtual m

emory

- W

hich is an area on a secondary storage device -

When required the pages are m

oved from virtual

mem

ory back into RAM

. (1 per -)

4

AO1.1

2

M

ark Band 3–H

igh Level (7-9 marks)

The candidate demonstrates a thorough

knowledge and understanding of M

agnetic and Flash storage. The m

aterial is generally accurate and detailed. The candidate is able to apply their know

ledge and understanding directly and consistently to the context provided. E

vidence/examples w

ill be explicitly relevant to the explanation. The candidate provides a thorough discussion w

hich is well balanced. E

valuative comm

ents are consistently relevant and w

ell-considered.

9

AO1.1

(2)

AO1.2

(2)

AO2.1

AO

1: Know

ledge and Understanding

The following is indicative of possible factors/evidence that

candidates may refer to but is not prescriptive or exhaustive:

- M

agnetic hard drives work by m

agnetic patterns being read off platters that m

echanically spin at high speeds. -

Flash hard drives use mem

ory chips. These can have their contents erased and subsequently overw

ritten when an electrical

charge is applied. -

Magnetic hard drives are cheaper per G

B and tend to be sold in m

uch higher capacities than flash hard drives. -

Flash hard drives tend to have much higher read/w

rite speeds than

Page 29: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

10

There is a well-developed line of reasoning w

hich is clear and logically structured. The inform

ation presented is relevant and substantiated. M

ark Band 2-M

id Level (4-6 marks)

The candidate demonstrates reasonable

knowledge and understanding of a M

agnetic and Flash based storage; the m

aterial is generally accurate but at tim

es underdeveloped. The candidate is able to apply their know

ledge and understanding directly to the context provided although one or tw

o opportunities are m

issed. Evidence/exam

ples are for the most part

implicitly relevant to the explanation.

The candidate provides a sound discussion, the m

ajority of which is focused. E

valuative com

ments are for the m

ost part appropriate, although one or tw

o opportunities for developm

ent are missed.

There is a line of reasoning presented with som

e structure. The inform

ation presented is in the m

ost part relevant and supported by some

evidence. M

ark Band 1-Low

Level (1-3 marks)

The candidate demonstrates a basic know

ledge of M

agnetic and Flash based storage with lim

ited understanding show

n; the material is basic and

contains some inaccuracies. The candidate

makes a lim

ited attempt to apply acquired

knowledge and understanding to the context

provided. The candidate provides a lim

ited discussion w

hich is narrow in focus. Judgm

ents if made are

weak and unsubstantiated.

(2)

AO3.3

(3)

magnetic hard disks.

- Flash hard disks have no m

oving parts and therefore tend to have low

er power consum

ption and are not affected by their device m

oving. A

O2.1: A

pplication

The selected knowledge/exam

ples should be directly related to

the specific question. The following is indicative of possible

factors/evidence that candidates may refer to but is not

prescriptive or exhaustive:

- Many gam

es tend to incorporate a lot of media and as such a keen gam

er is likely to need a lot of storage space.

- Gam

es are fast paced and often competitive. H

igh loading speeds can be beneficial.

- High perform

ance is often important to gam

ers and as such will pick

highest performing com

ponents.

- Hybrid approaches exist w

hich offer ’the best of both worlds’

- Magnetic hard drives can be noisy (due to parts m

oving at high speed), this can be undesirable and distracting w

hilst gaming. C

onversely flash drives operate silently.

AO

3.3: Evaluation

Page 30: A Level Computer Science Revision Pack Sample Papers

11

The information is basic and com

municated in an

unstructured way. The inform

ation is supported by lim

ited evidence and the relationship to the evidence m

ay not be clear. 0 m

arks N

o attempt to answ

er the question or response is not w

orthy of credit.

Candidates w

ill need to consider a variety of issues in relation

to the question and will m

ake some evaluative com

ments about the issues

and solutions they are discussing. The following is indicative of possible

factors/evidence that candidates may refer to but is not prescriptive or

exhaustive:

- D

ue to their high storage capacity magnetic hard disks are the best

choice. A gamer could have m

any games installed at one tim

e. W

hilst performance is not quite that of flash drives , to have a

similarly sized flash drive w

ould be prohibitively expensive. A high quality m

agnetic drive will provide good enough perform

ance leaving m

oney to be spent elsewhere. As it is being installed on a

desktop there is no need to worry about pow

er consumption or

issues with the com

puter moving.

- G

amers need high perform

ance and that includes large amounts of

data being loaded quickly. The read/write speed of a solid state

drive means this is the natural choice for the gam

er’s desktop.

3 a

i 240

AO1.2

1

ii F0

AO1.2

1

b

00000000

AO1.2

1

c

11111111

AO1.2

Page 31: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

12 1

d

i 00110000

AO1.2

1

ii M

ultiplying by 4 AO

2. 1

1

e

i 10001000

AO1. 1

1

ii 11111000

AO1. 1

1

f

-

Calculate the first number as: 0

10.100

- Calculate the second num

ber as: 01.1000

- Calculate the third num

ber as: 100.010

- Add the three together to get (1

)000.010

- Show

carry bits. Discarding of leading one m

ay be shown or im

plicit. -

Norm

alised result is: 010000 1111

(1 per -)

AO1.2

6

If candidate fails to discard the overflowing 1 they can still get m

arks 1-4.

4 a

-

Characters from

a computer using A

SCII w

ill be interpreted as different characters by a com

puter using E

BCD

IC.

- Text w

ill be incomprehensible.

(1 per -)

AO1.2

2

Page 32: A Level Computer Science Revision Pack Sample Papers

13

b

-

Value between 193 and 201 returns respective

ASCII value betw

een 65 and 73 -

Value between 209 and 217 returns respective

ASCII value betw

een 74 and 82 -

Value between 226 and 233 returns respective

ASCII value betw

een 83 and 88 -

Values less than 193 and greater than 233 return -1

- Values betw

een 202 and 208, and 218 and 225 return -1.

(1 per -)

AO3.2

5

function convert(ebValue)

if ebValue >= 193 and ebValue <= 201 then

return ebValue - 128

elseif ebValue >= 209 and ebValue <= 217 then

return ebValue - 135

elseif ebValue >= 226 and ebValue <= 233 then

return ebValue - 143

else

return -1

endif

endfunction

A program that returns a value 128 less for values betw

een 193 and 208 w

ould receive the first mark but not the last one. (The sam

e principle applies for points 2 and 3)

5 a

-

STA store the value in the accumulator into a given

mem

ory location -

LDA loads the value in a m

emory location into the

accumulator.

(1 per -)

AO1.2

2

b

D

irect addressing AO

1.2 Accept Sym

bolic Addressing

Page 33: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

14 1

c

-

Answer contains at least 1 follow

ed by 0 -

Answer contains at least three 10s

- Answ

er contains exactly four 10s (1 per -)

AO3.3

3

1 0 1 0 1 0 1 0 NB

allow answ

ers that are vertical or horizontal.

d

-

The address of one is stored in the M

AR

- This value is sent along the address bus AN

D the

fetch signal is sent on the control bus. -

The contents of one are sent from

mem

ory to the processer on the data bus and stored in the M

DR

-

The contents of the MD

R and A

CC

are sent to the ALU

-

The result is stored back in the ACC

(1 per -)

AO2.2

5

Accept MBR

instead of MD

R

e

-

An instruction can be fetched as the previous one is being decoded…

-

…and the one before that is being executed.

- E.g. L

DA Zero can be fetched, w

hile OUT is being

AO1.2

(2)

Page 34: A Level Computer Science Revision Pack Sample Papers

15

decoded and start L

DA one is being executed.

(1 per -)

AO2.2

(1) 3

f

-

BRP

could be followed by one of tw

o possible instructions, w

hich one will only be determ

ined at execution

- M

eaning the wrong one m

ay be fetched/decoded (1 per -)

AO2.2

2

g

-

Clock speed

- C

ache Size -

Num

ber of cores (1 per m

ax 1)

AO1.1

1

6 a

-

Adds the tag name…

-

Includes the opening < -

Includes the closing > and nothing further -

Tags are added to data structure. -

Adds all tags in the string. -

Sensible variable names used

- C

orrect use of indentation (1 per -)

AO3.2

7

tagStartPos = 0

insideTag = false

i = 0

while i < htmlCode.length

if htmlCode.substring(i,1) == ”<” and

insideTag == false then

tagStartPos = i

insideTag = true

elseif insideTag == true and

htmlCode.substring(i,1) == ”>” then

dataStructureA.add(htmlCode.substring(ta

Page 35: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

16

gStartPos, i-tagStartPos+1))

insideTag = false

endif

i = i + 1

endwhile

b

i Q

ueue AO

2.1

1

ii H

ashtable

AO2.2

1

Accept Hashm

ap/Associative Array/Dictionary

iii Stack

AO2.2

1

iv Stack uses a last in first out approach…

and the last HTM

L tag to be opened should be the first to be closed.

AO2.2

2

7 a

AO1.2

2

Page 36: A Level Computer Science Revision Pack Sample Papers

17

1 mark for the first tw

o rows

1 mark for the last tw

o rows

b

i

1 Mark for row

s 1 and 2

1 Mark for row

s 3 and 4

1 Mark for row

s 5 and 6

1 Mark for row

s 7 and 8

AO1.2

4

ii -

Circuit adds tw

o bits (and a carry bit) together/is an adder.

- A B and C

in are added together -

The result is given in S -

And a carry bit in Cout

(1 per -)

AO2.2

4

Page 37: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

18

c

i S≡

A∨

B∨

Cin

AO2.2

1

Accept XOR

instead of ∨

Accept instead of ∨

Ii C

out ≡ ((A

∨B) ∧

Cin ) ∨

(A ∧ B)

One m

ark for ((A∨

B) ∧ C

in )

One m

ark for ∨ (A ∧

B)

AO2.2

2

Accept XOR

instead of ∨

Accept instead of ∨

Accept AND

instead of ∧

Accept OR

instead of ∨

Accept + instead of ∨

8 a

-

A primary key m

ust have a unique value for every record

- The values for all these fields could repeat.

(1 per -)

AO1.1

(1)

AO1.2

(1) 2

b

-

Advantage: Searches of Artist can be performed

more quickly.

- D

isadvantage: The index takes up extra space in the database.

(1 per -)

AO1.2

2

Page 38: A Level Computer Science Revision Pack Sample Papers

19

c

-

Song and P

laylist w

ould have a many to

many relationship

- This is not allow

ed -

Adding a table between them

resolves this -

Diagram

to illustrate this.

(1 per -)

AO3.1

4

d

i C

opyright, Design and Patents Act

AO1.1

1

Accept Copyright Act/Law

ii -

DELETE FROM Song

- WHERE Artist=’RandomBits’

(1 mark per -, m

ax 2)

AO3.1

2

iii All entries in P

layListEntry w

hich contain songs by R

andomBits m

ust be removed.

AO2.1

1

9

M

ark Band 3–H

igh Level (9-12 marks)

The candidate demonstrates a thorough know

ledge and understanding of the technical and legal aspects of privacy. The m

aterial is generally accurate and detailed.

AO1.1

(2)

AO1.2

(2)

AO1 K

nowledge and U

nderstanding

The following is indicative of possible factors/evidence that

candidates may refer to but is not prescriptive or exhaustive:

- M

odern encryption is easy to access. -

The strongest encryption is (as far as is known). unbreakable

Page 39: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

20

The candidate is able to apply their knowledge and

understanding directly and consistently to the context provided. Evidence/exam

ples will be

explicitly relevant to the explanation.

The candidate is able to weigh up both sides of the

argument w

hich results in a supported and realistic judgm

ent as to how achievable privacy is.

There is a well-developed line of reasoning w

hich is clear and logically structured. The inform

ation presented is relevant and substantiated.

Mark B

and 2-Mid Level (5-8 m

arks)

The candidate demonstrates reasonable know

ledge and understanding of technical and legal aspects of privacy; the m

aterial is generally accurate but at tim

es underdeveloped.

The candidate is able to apply their knowledge and

understanding directly to the context provided although one or tw

o opportunities are missed.

Evidence/examples are for the m

ost part implicitly

relevant to the explanation.

AO2.1

(3)

AO3.3

(5)

12

even by government agencies.

- People leave a digital footprint w

herever they go (mobile

phones can track our location, store cards record our shopping habits).

- O

ur online activities can be tracked by IP address and 3rd

party cookies. -

CC

TV is ubiquitous. Most people carry round phones

capable of taking video/photos. -

Facial recognition AI techniques mean w

e may be film

ed w

hilst unaware and subsequently identified.

- The D

ata Protection Act aims to protect people’s data.

- C

omputer M

isuse Act Prosecutes those gaining unauthorised access to com

puter systems w

hich may deter attem

pts to gain unauthorised access to data.

- The R

egulation of Investigatory Powers Act regulates how

the authorities can m

onitor our actions.

AO2.1: Application

The selected knowledge/exam

ples should be directly related to the specific question. Exam

ples may include but are not lim

ited to:

People can secure their data using encryption but the Regulation of

Investigatory Powers Act can force them

to share their key with the

authorities.

The government is becom

ing increasingly worried about encryption

and there is the possibility of laws to lim

it its use in the future.

Page 40: A Level Computer Science Revision Pack Sample Papers

21

The candidate makes a reasonable attem

pt to come

to a conclusion showing som

e recognition of influencing factors that w

ould determine how

achievable privacy is.

There is a line of reasoning presented with som

e structure. The inform

ation presented is in the most

part relevant and supported by some evidence.

Mark B

and 1-Low Level (1-4 m

arks)

The candidate demonstrates a basic know

ledge of the technical and legal aspects of privacy w

ith lim

ited understanding shown; the m

aterial is basic and contains som

e inaccuracies. The candidate m

akes a limited attem

pt to apply acquired know

ledge and understanding to the context provided.

The candidate provides nothing more than an

unsupported assertion.

The information is basic and com

municated in an

unstructured way. The inform

ation is supported by lim

ited evidence and the relationship to the evidence

Laws such as the C

omputer M

isuse Act can act as a deterrent but the Internet is global and it is hard to pursue and prosecute offenders from

other countries.

Trying to be in a location anonymously is very difficult as m

ovements

are tracked in many different w

ays and this is becoming increasingly

automated.

AO3.3: Evaluation

Having considered the different sides to the argum

ent candidates will

need to reach a supported judgment based on the evidence included

in their response.

There should be no bias in marks as to w

hich viewpoint is chosen

but especially in the top mark band there m

ust be a clear link betw

een the points candidates have made and justification.

Page 41: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

22

may not be clear.

0 marks

No attem

pt to answer the question or response is

not worthy of credit.

10 a

To control the hardw

are AO

1.1

1

b

-

Developers can run their operating system

on a softw

are implem

entation of the phone…

- …

Until the physical m

achine is ready. (1 per -)

AO1.2

2

c

-

Com

plete the current FDE C

ycle -

Check the priority of the incom

ing interrupt. -

If its of a higher priority than the current task. -

Contents of registers stored in m

emory..

- …

in a stack. -

The relevant interrupt service routine is loaded…

-

..by loading the relevant value into the program

counter. -

When the ISR

is complete the previous state is

popped from the stack

- And are loaded back into the registers.

(1 per -, max 6)

AO1.1

6

Page 42: A Level Computer Science Revision Pack Sample Papers

23

d

i -

Feasibility Study -

Investigation/Requirem

ents Elicitation -

Analysis -

Design

- Im

plementation/C

oding -

Testing -

Installation -

Docum

entation -

Evaluation -

Maintenance

(1 per -, max 3)

AO1.1

3

d

ii -

Tends to suit large scale projects…

- ..An O

S is an example of such a big project.

- Tends to suit projects w

ith stable requirem

ents…

- …

And the base requirements of an O

S are unlikely to change.

(1 per -, max 2)

AO1.2

2

iii If a change does occur in the requirem

ents the lifecycle cannot respond easily, often at the cost of tim

e and money.

AO1.1

1

e

Mark B

and 3–High Level (7-9 m

arks) The candidate dem

onstrates a thorough know

ledge and understanding of Object

Oriented Program

ming and has discussed

inheritance, polymorphism

and encapsulation; the m

aterial is generally accurate and detailed.

AO1.1

(2)

AO1.2

(2)

AO2.1

AO1 K

nowledge and U

nderstanding

The following is indicative of possible factors/evidence that

candidates may refer to but is not prescriptive or exhaustive:

OO

P involve solutions being constructed by means of objects that

interact with each other. O

OP uses classes as tem

plates to

Page 43: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

24

The candidate is able to apply their know

ledge and understanding directly and consistently to the context provided. Evidence/exam

ples will be explicitly relevant

to the explanation. The candidate provides a thorough discussion w

hich is well balanced. Evaluative

comm

ents are consistently relevant and well-

considered. There is a w

ell-developed line of reasoning w

hich is clear and logically structured. The inform

ation presented is relevant and substantiated. M

ark Band 2-M

id Level (4-6 marks)

The candidate demonstrates reasonable

knowledge and understanding of a range of

Object O

riented Programm

ing and has discussed at least tw

o of: inheritance, polym

orphism and encapsulation; the

material is generally accurate but at tim

es underdeveloped. The candidate is able to apply their know

ledge and understanding directly to the context provided although one or tw

o opportunities are m

issed. Evidence/exam

ples are for the most part

implicitly relevant to the explanation.

(2)

AO3.3

(3)

9

construct objects. An object has attributes (variables associated with

it) and methods (subroutines that form

the actions an object can carry out).

Inheritance is where a class retains the m

ethods and attributes of its parent class as w

ell as having its own.

Encapsulation is the process of keeping an object’s attributes private so they can only be accessed and changed via public m

ethods.

Polymorphism

means that objects of different types can be treated in

the same w

ay.

Procedural programm

ing breaks a solution down into subroutines.

These subroutines are re built and combined to form

a program.

AO2.1: Application

The selected knowledge/exam

ples should be directly related to the specific question. Exam

ples may include but are not lim

ited to:

Breaking a problem dow

n into objects naturally lends itself to teams

as different team m

embers can w

ork on different objects.

Inheritance means that one class can be coded and that code used

as the base for similar objects. This w

ill save the team tim

e as they are able to build on w

ork already done.

Encapsulation means that objects only interact in the w

ay intended and prevents unexpected changed to attributes having unforeseen consequences. This m

eans there are likely to be fewer issues as

the team com

bines their code.

Page 44: A Level Computer Science Revision Pack Sample Papers

25

The candidate provides a sound discussion, the m

ajority of which is focused. Evaluative

comm

ents are for the most part appropriate,

although one or two opportunities for

development are m

issed. There is a line of reasoning presented w

ith som

e structure. The information presented is

in the most part relevant and supported by

some evidence.

Mark B

and 1-Low Level (1-3 m

arks) The candidate dem

onstrates a basic know

ledge of Object O

riented Programm

ing w

ith limited understanding show

n; the m

aterial is basic and contains some

inaccuracies. For 3 marks they have

described at least one of inheritance, polym

orphism or encapsulation. The

candidate makes a lim

ited attempt to apply

acquired knowledge and understanding to

the context provided. The candidate provides a lim

ited discussion w

hich is narrow in focus. Judgm

ents if made

are weak and unsubstantiated. The

information is basic and com

municated in an

unstructured way. The inform

ation is supported by lim

ited evidence and the relationship to the evidence m

ay not be

Polymorphism

means that code can be w

ritten that is able to handle different objects in the sam

e way. This reduces the volum

e of code the team

need to produce.

Procedural programm

ing can be divided between a team

with

different team m

embers tackling different subroutines.

There are a number of sim

ilarities between the tw

o paradigms.

Certain problem

s lend themselves m

ore to one than the other.

AO3.3: Evaluation

Having considered the different sides to the argum

ent candidates will

need to reach a supported judgment based on the evidence included

in their response.

Page 45: A Level Computer Science Revision Pack Sample Papers

H446/01

Mark Schem

e Practice Paper 1

26

clear. 0 m

arks N

o attempt to answ

er the question or response is not w

orthy of credit.

11 a

<img src=”UKstamps.jpg”>

- O

ne mark for im

g tag -

One m

ark for correct src attribute

(1 per -)

AO3.1

2

Accept self closing tag:

<img src=”U

Kstamps.jpg”/>

b

-

<a> </a> tags plus

Find out more

about UK stamps text betw

een them.

- href attribute w

ith value http://ukstampcollectorsguild.co.

uk

(1 per -)

AO3.1

2

<a href=”http://ukstampcollectorsguild.co.uk”>Find

out More about UK stamps</a>

ci

- Form

atting code has to be rewritten for every

page -

Changes have to be m

ade to every page -

It is a lot of work to keep the look of the site

consistent. (1 per -, max 1)

AO1.2

1

Page 46: A Level Computer Science Revision Pack Sample Papers

27

ii

The site is slower to access (as the form

atting inform

ation is reloaded for every page)

Unlikely to have form

atting specific to their device/needs.

AO1.2

1

d

- C

hange the tag body…

- So it includes the attribute style

- W

hich should have the value background-

color:lightGreen

(1 per -)

AO2.2

3

Accept: <body bgcolor="lightGreen"> for full m

arks

e

- The num

ber of sites that link to their site -

The PageRank of the linking sites

- The num

ber of outward links from

the site (1 per -, m

ax 2)

AO1.2

2

Page 47: A Level Computer Science Revision Pack Sample Papers

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

Turn over© OCR 2016 Practice paperDC (SC/CGW) 144210/2

Last name

First name

Candidatenumber

Centrenumber

Oxford Cambridge and RSA

A Level Computer ScienceH446/01 Computer Systems

Practice paper – Set 2Time allowed: 2 hours 30 minutes

Do not use:• a calculator

*0000000000*

OCR is an exempt Charity

Page 48: A Level Computer Science Revision Pack Sample Papers

2

H446/01© OCR 2016 Practice paper

Answer all questions.

1 An operating system has to manage a system’s resources.

(a) One aspect of this is memory management.

(i) Describe one difference between paging and segmentation.

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

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

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

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

(ii) Explain how an operating system may overcome the problem of physical memory being full.

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

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

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

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

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

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

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

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

(b) Another job of an operating system is to deal with interrupts.

(i) State what is meant by the term ‘interrupt’.

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

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

Page 49: A Level Computer Science Revision Pack Sample Papers

3

H446/01 Turn over© OCR 2016 Practice paper

(ii) Describe what happens in the CPU when it receives an interrupt.

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

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

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

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

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

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

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

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

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

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

Page 50: A Level Computer Science Revision Pack Sample Papers

4

H446/01© OCR 2016 Practice paper

2 Mobile Treasure Hunt is a game played on a mobile phone. The game shows the user’s position on a map of their local area. Treasure randomly appears on the map and users must move to the appropriate area to collect the treasure before it disappears.

(a) State the name of a sensor or input device the phone might use when playing Mobile Treasure Hunt and explain why it might be used.

Sensor / Input Device: ...............................................................................................................

Use: ...........................................................................................................................................

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

Below is part of the code from Mobile Treasure Hunt.

class Treasure

private value private weight private name

public procedure new(givenName) name=givenName weight=20 value=randomInteger(1,20) endprocedure

public procedure changeName(givenName) name=givenName endprocedure

endclass

class TreasureChest inherits Treasure

private locked

public procedure new(givenName) super.new(givenName) locked=false value=randomInteger(1,100) weight=randomInteger(80,120) endprocedure

public procedure pickLock() if getRandomNumber()>0.5 then locked=false endif endprocedure

endclass

Fig. 2.1

Page 51: A Level Computer Science Revision Pack Sample Papers

5

H446/01 Turn over© OCR 2016 Practice paper

(b) Explain what is meant by the term ‘encapsulation’ with reference to the attribute called name.

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

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

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

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

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

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

(c) Describe what is meant by the term ‘inheritance’, referring to the code in Fig. 2.1.

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

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

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

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

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

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

(d) Identify all attributes and methods in the TreasureChest class.

Methods: ....................................................................................................................................

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

Attributes: ..................................................................................................................................

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

Page 52: A Level Computer Science Revision Pack Sample Papers

6

H446/01© OCR 2016 Practice paper

3 A Little Man Computer (LMC) assembly language program is stored in memory as shown in Fig. 3.1.

0123456789

LDA &7ADD #4OUTHLT6210151617

Fig. 3.1

In this variant of LMC the symbols & and # are used to denote different modes of addressing.

(a) Given that the output is 17, state the addressing mode represented by each symbol.

(i) & .................................................................................................................................... [1]

(ii) # .................................................................................................................................... [1]

An assembler is used on the code.

(b) Describe what is meant by the term ‘assembler’.

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

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

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

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

(c) Explain how pipelining would help a CPU execute the code in Fig. 3.1 more quickly.

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

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

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

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

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

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

Page 53: A Level Computer Science Revision Pack Sample Papers

7

H446/01 Turn over© OCR 2016 Practice paper

4 A bus runs between two cities. There are a number of stops on the bus route labelled StopA, StopB and so on. The timetable for the route is represented as a hash table. For each entry in the hash table the key is the bus stop code and the data attached to it is a (zero indexed) array of the times a bus arrives at the stop. The times are stored as strings.

An extract of the hash table is shown below:

times= { "StopA":["06:55", "07:25", "07:55", "08:55", "09:55", "11:55", "14:00",

"15:00", "15:30", "16:00"] "StopB":["06:40", "07:40", "08:40", "09:20", "09:40", "14:00", "15:00",

"16:00", "16:30"] … … }

print(times["StopA"][1]) displays 07:25

(a) State what the code print(times["StopB"][4]) displays.

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

(b) Write a function called timeValue that given a time stored in a string, returns the equivalent integer (using thousands and hundreds for the hours and tens and units for the minutes). The given string should be assumed to represent the time in the 24-hour clock in the format HH:MM

timeValue("07:55") should return 755 timeValue("15:30") should return 1530

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

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

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

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

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

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

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

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

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

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

Page 54: A Level Computer Science Revision Pack Sample Papers

8

H446/01© OCR 2016 Practice paper

(c) Write code for a function that takes in the name of a stop (stopName) and the current time as an integer (currentTime) in the format described in part (b) (using thousands and hundreds for the hours and tens and units for the minutes). It should return the time of the next available bus in the string format. If there are no more buses available that day it should return the string “No buses”.

Example nextBus("StopA", 1013) should return "11:55"

function nextBus(stopName, currentTime)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 55: A Level Computer Science Revision Pack Sample Papers

9

H446/01 Turn over© OCR 2016 Practice paper

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

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

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

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

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

endfunction [5]

Page 56: A Level Computer Science Revision Pack Sample Papers

10

H446/01© OCR 2016 Practice paper

5 Every bank account has an account number and sort code. The sort code identifies the bank branch (location of the bank) with which the account is held and the account number uniquely identifies the bank account. An extract from a bank’s database table is shown in Fig. 5.1.

CustomerID

145204

Forename Surname Acc No SortCode

BranchName

657875735951744078

ElaineJordanMonimTom

MurrayRogersKhanBanner

HullTruroCambridgeCambridge

14725200627034419638554745623929

67-34-5667-45-6767-00-1167-00-11

Fig. 5.1

(a) State why the table in Fig. 5.1 is not in Third Normal Form.

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

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

(b) Explain how the database could be put into Third Normal Form.

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

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

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

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

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

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

Page 57: A Level Computer Science Revision Pack Sample Papers

11

H446/01 Turn over© OCR 2016 Practice paper

(c)* The bank needs to ensure the data stored in its database is accurate at all times including when customers deposit or withdraw funds.

Discuss how the bank can ensure the accuracy of its data and the importance of doing so.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 58: A Level Computer Science Revision Pack Sample Papers

12

H446/01© OCR 2016 Practice paper

6 The XOR operator can be used to encrypt data.

(a) Show the effect of applying XOR on Text and Key, by completing the last row of the table below.

Text O C R

Value 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0

Key A B C

Value 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1

XOR

[2]

(b) Show the effect of applying XOR on your answer to part (a) and Key, by completing the first and last rows of the table below.

(a)

Key A B C

Value 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1

XOR

[2]

(c) Explain whether the type of encryption described above is symmetric or asymmetric.

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

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

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

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

Page 59: A Level Computer Science Revision Pack Sample Papers

13

H446/01 Turn over© OCR 2016 Practice paper

(d) Explain why asymmetric encryption is more suited to transactions over the internet than symmetric encryption.

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

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

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

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

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

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

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

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

Page 60: A Level Computer Science Revision Pack Sample Papers

14

H446/01© OCR 2016 Practice paper

7 A binary search tree is used to store the names of dog breeds.

Pug Whippet

Rottweiler

Chihuahua

Greyhound

Harrier

Fig. 7.1

(a) The breeds Doberman and Dalmatian are added to the tree in that order. Add them to Fig. 7.1. [2]

(b) Explain how you would determine if the breed Pug is in the binary search tree.

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

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

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

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

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

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

Page 61: A Level Computer Science Revision Pack Sample Papers

15

H446/01 Turn over© OCR 2016 Practice paper

(c) Explain how you would determine if the breed Spaniel is in the binary search tree.

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

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

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

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

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

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

Page 62: A Level Computer Science Revision Pack Sample Papers

16

H446/01© OCR 2016 Practice paper

(d) The tree is coded using object oriented programming.

Each dog breed is represented by an object of class Node.

The Node class has the methods: getLeftNode() – returns the left hand child node or null if there is no left hand child. getRightNode() – returns the right hand child node or null if there is no right hand child. getBreed() – returns the name of the breed stored in that node.

The program allows for a breed name to be entered, and depending on whether the breed is in the tree or not, displays either:

<breed name> is not in the tree.

or

<breed name> is in the tree.

Complete the program below. Credit will be given for readability of code.

name=input("Enter the name of a breed") breedNode=tree.root() //breedNode is an object of type Node

//representing the root of the tree

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 63: A Level Computer Science Revision Pack Sample Papers

17

H446/01 Turn over© OCR 2016 Practice paper

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

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

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

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

Page 64: A Level Computer Science Revision Pack Sample Papers

18

H446/01© OCR 2016 Practice paper

8 A website has the following code.

<p> <form action="checkUser.php"> Username:<br> <input type="text" name="username"> <br> Password:<br> <input type="password" name="password"> <br><br> <input type="submit" value="Submit"> </form>

<p id="warning">Unauthorised access to this system will be prosecuted</p>

The page is linked to a style sheet. The message Unauthorised access to this system will be prosecuted is red with a monospace font. (Note this is the only text on the page that has this formatting)

(a) Write the segment of CSS code that would appear on the style sheet to make the message appear in the way described.

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

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

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

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

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

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

(b) Explain the meaning of the HTML line <input type="text" name="username">

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

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

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

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

Page 65: A Level Computer Science Revision Pack Sample Papers

19

H446/01 Turn over© OCR 2016 Practice paper

(c)* The line <form action="checkUser.php"> sends the contents of the form to be processed by the server. This is done by code written in a language called PHP which is designed for server side processing. Conversely JavaScript is traditionally used for client side processing.

Discuss the difference between server and client side processing with respect to webpages. You should refer to the advantages, drawbacks and best uses of both approaches.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 66: A Level Computer Science Revision Pack Sample Papers

20

H446/01© OCR 2016 Practice paper

Part of the code on the server can be represented in pseudocode below. In the pseudocode: RunSQL(A,B) runs SQL statement A on database B. In this case it will always return a

single value. valueFromForm(controlName) gets the value entered into the input control with the

name controlName

01 username = valueFromForm("username") 02 password = valueFromForm("password") 03 statement = "SELECT passwordHash FROM users WHERE name = '"

+ username + "'" 04 hashInDB = RunSQL(statement, siteDatabase) 05 if hashInDB == hash(password) then 06 //TO ADD: Generate success webpage 07 else 08 //TO ADD: Store IP address of user in database. 09 endif

Fig. 8.1

(d) Explain what the code in Fig. 8.1 does.

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

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

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

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

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

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

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

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

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

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

(e) In certain scenarios the user’s IP address is logged in a database.

(i) Describe what is meant by an IP Address.

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

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

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

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

Page 67: A Level Computer Science Revision Pack Sample Papers

21

H446/01 Turn over© OCR 2016 Practice paper

(ii) Explain why the programmers have chosen to store the user’s IP address.

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

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

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

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

(f) An extract from the database is shown below:

userID name passwordHash

1 admin 0e5a511

2 DenverJ34 f60ccdc

3 TaylorJ22 3a050bc

(i) The username admin is entered into the form.

State what the value of statement would be after line 03 of the code in Fig. 8 .1 is run.

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

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

(ii) State what the value of hashInDB would be after line 04 of the code in Fig. 8.1 is run.

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

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

(g) In SQL the character ; denotes the next statement and the characters -- denote a comment.

The username DenverJ34’; DROP TABLE users; -- is entered into the form.

(i) State what the value of statement would be after line 03 is run.

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

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

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

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

Page 68: A Level Computer Science Revision Pack Sample Papers

22

H446/01© OCR 2016 Practice paper

(ii) Describe what happens when line 04 is run.

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

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

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

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

(iii) State the name of a law the user has broken by entering the username DenverJ34’; DROP TABLE users; --

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

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

Page 69: A Level Computer Science Revision Pack Sample Papers

23

H446/01 Turn over© OCR 2016 Practice paper

9

1 1 0 1

00 01 11 10

0 0 0 0

0 0 1 0

1

00

01CD

AB

11

10 1 1 0

Fig. 9.1

(a) State the Boolean expression represented by the Karnaugh map in Fig. 9.1, in its smallest form.

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

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

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

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

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

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

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

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

(b) State the simplified versions of the following Boolean expressions:

(i) ¬ ¬A

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

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

(ii) (¬A Λ ¬B)

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

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

(iii) ¬ (¬A Λ ¬B)

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

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

Page 70: A Level Computer Science Revision Pack Sample Papers

24

H446/01© OCR 2016 Practice paper

10 A NAND gate and its truth table are shown in Fig. 10.1.

1110

0101

0QBA

AQ

B

011

Fig. 10.1

(a) Draw a set of gates equivalent to a NAND gate, but built only of AND, OR and NOT gates.

[2]

The component below is a D-Type, positive edge triggered, flip-flop.

Clock

D Q

Q

Fig. 10.2

(b) State the purpose of a flip-flop.

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

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

Page 71: A Level Computer Science Revision Pack Sample Papers

25

H446/01 Turn over© OCR 2016 Practice paper

(c) Draw the output of the flip-flop from Fig. 10.2 on the diagram below.

clock

D

Q

[3]

Page 72: A Level Computer Science Revision Pack Sample Papers

26

H446/01© OCR 2016 Practice paper

11 (a) Show a representation of the hexadecimal number AB in:

(i) Binary

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

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

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

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

(ii) Denary

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

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

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

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

(b) Show a representation of denary -119 in 8-bits using:

(i) Sign and Magnitude

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

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

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

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

(ii) Two’s Complement

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

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

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

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

Page 73: A Level Computer Science Revision Pack Sample Papers

27

H446/01 Turn over© OCR 2016 Practice paper

(c) A floating point number is represented with a mantissa of 8-bits followed by an exponent of 4-bits, both in two’s complement.

00011010 0010

(i) Identify whether or not the number is normalised.

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

(ii) State how you arrived at your answer to part (i).

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

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

(d) Two floating point numbers are shown below in the same format as used for part (a). Calculate the answer of the second number subtracted from the first. You must show your working and ensure your answer is normalised.

01001100 0011 - 01001010 0010

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

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

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

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

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

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

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

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

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

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

Page 74: A Level Computer Science Revision Pack Sample Papers

28

H446/01© OCR 2016 Practice paper

12* Some problems require a large amount of computing power that goes well beyond a single CPU.

Discuss the different approaches that can be taken to provide increasingly larger amounts of computing power and the types of problem they are suited to.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

................................................................................................................................................... [12]

END OF QUESTION PAPER

Page 75: A Level Computer Science Revision Pack Sample Papers

29

H446/01© OCR 2016 Practice paper

BLANK PAGE

Page 76: A Level Computer Science Revision Pack Sample Papers

30

H446/01© OCR 2016 Practice paper

BLANK PAGE

Page 77: A Level Computer Science Revision Pack Sample Papers

31

H446/01© OCR 2016 Practice paper

BLANK PAGE

Page 78: A Level Computer Science Revision Pack Sample Papers

32

H446/01© OCR 2016 Practice paper

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.

Page 79: A Level Computer Science Revision Pack Sample Papers

H446/0

1

Pra

ctic

e P

ap

er 2

GC

E C

om

pu

ter S

cie

nc

e

H44

6/0

1

Com

pu

ter S

yste

ms

D

ura

tion

: 2 h

ou

rs 3

0 m

inu

tes

MA

XIM

UM

MA

RK

140

Th

is d

oc

um

en

t co

ns

ists

of 3

0 p

ag

es

Fin

al

Page 80: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

12

Qu

estio

n

An

sw

er

Mark

s

Gu

idan

ce

1

a

i P

ag

ing

is fix

ed s

ize / p

hysic

al d

ivis

ions (1

) S

egm

enta

tion is

div

idin

g m

em

ory

log

ica

lly (i.e

. will

be v

aria

ble

siz

e). (1

)

2

(AO

1.1

)

ii U

se

s v

irtual m

em

ory

(1) w

hic

h is

an a

llocate

d a

rea

of a

hard

driv

e/s

eco

nda

ry s

tora

ge d

evic

e.(1

) Pag

es

that a

ren

’t needed a

re m

ove

d to

VM

(1) a

nd m

ove

d

back to

physic

al m

em

ory

wh

en re

qu

ired (1

)

4

(AO

1.2

)

b

i A

sig

nal to

the p

roce

sso

r indic

atin

g a

devic

e/p

roce

ss

needs a

ttentio

n (1

) 1

(AO

1.1

)

ii A

ny fiv

e fro

m:

If the in

terru

pt is

of a

low

er/e

qu

al p

riority

to th

e

cu

rrent p

rocess th

en th

e c

urre

nt p

rocess c

ontin

ues

(1)

If it is o

f a h

igh

er p

riority

the C

PU

finis

hes its

cu

rrent

Fetc

h-D

ecod

e-E

xe

cute

cycle

(1). T

he c

onte

nts

of

the C

PU

’s re

gis

ters

are

co

pie

d to

a s

tack (1

) in

me

mory

(1). T

he lo

catio

n o

f the a

pp

ropria

te

inte

rrupt s

erv

ice

routin

e is

load

ed in

to th

e p

rog

ram

co

un

ter (1

) Whe

n th

e IS

R is

co

mp

lete

, the p

revio

us

co

nte

nts

are

popped fro

m th

e s

tack a

nd lo

ad

ed b

ack

into

the re

gis

ters

(1).

5

(AO

1.2

)

2

a

A

ny tw

o fro

m:

GP

S…

(1) …

To d

ete

rmin

e th

e u

ser’s

ge

og

rap

hic

al

locatio

n (1

) C

om

pa

ss/m

ag

neto

mete

r (1)…

…T

o d

ete

rmin

e

dire

ctio

n in

wh

ich u

se is

facin

g.

Acce

lero

mete

r…(1

) …to

recog

nis

e u

ser’s

m

ove

me

nt. (1

) T

ouch

scre

en

…. (1

) …. T

o s

ele

ct o

ptio

ns/p

lay th

e

2

(AO

1.2

)

Page 81: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

13

gam

e (1

)

b

W

hen

an a

ttribute

is m

ade

priv

ate

(so it c

an’t b

e

dire

ctly

accesse

d o

r ch

an

ge

d fro

m o

uts

ide th

e c

lass)

(1)

Pu

blic

me

tho

ds a

re u

sed to

read / a

me

nd th

e

attrib

ute

’s v

alu

e (1

) T

he a

ttribute

nam

e’s

va

lue c

an o

nly

be a

me

nd

ed

thro

ug

h th

e m

eth

od

changeName

. (1)

3

(AO

1.2

)

c

W

hen

a c

lass h

as th

e a

ttribute

s a

nd m

eth

od

s o

f its

pare

nt c

lass. (1

) It ma

y a

lso h

ave m

eth

od

s a

nd

attrib

ute

s o

f its o

wn (1

)

TreasureChest

inhe

rits fro

m th

e c

lass Treasure

(1)

3

(AO

1.2

)

d

Me

tho

ds: (c

onstru

cto

r/new

), changeName

,

pickLock

(1)

Attrib

ute

s: value

, weight

, name

, locked

(1)

2

(AO

1.2

)

Do

no

t pen

alis

e fo

r not in

clu

din

g c

onstru

cto

r. O

nly

giv

e m

eth

od

ma

rk if b

oth

oth

er m

eth

ods a

re lis

ted

O

nly

giv

e a

ttribute

s m

ark

if all fo

ur a

ttribute

s a

re lis

ted.

3

a

i &

imm

edia

te a

dd

ressin

g

1

(AO

2.2

)

ii # in

dire

ct a

dd

ressin

g

1

(AO

2.2

)

b

A

pro

gra

m th

at tra

nsla

tes a

ssem

bly

co

de (1

) into

m

achin

e c

ode/o

bje

ct c

ode

(1)

2

(AO

1.1

)

c

P

ipelin

ing

wo

uld

allo

w o

ne in

stru

ctio

n to

be fe

tche

d

as th

e p

revio

us o

ne is

bein

g d

eco

de

d a

nd

the o

ne b

efo

re th

at is

bein

g e

xe

cute

d.(1

)

For e

xa

mp

le OUT

co

uld

be fe

tch

ed

(1) . A

s th

ere

are

no ju

mp

/bra

nch in

stru

ctio

ns it p

ipelin

es

we

ll (as th

ere

is n

o n

eed to

flush th

e

pip

elin

e). (1

)

3

(2 A

O2

.2,

1 A

O3

.2)

Acce

pt a

ny v

alid

exa

mp

le fro

m th

e g

ive

n c

ode

.

4

a

0

9:4

0

1

Page 82: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

14

(AO

1.2

)

b

C

orre

ctly

nam

ed fu

nctio

n th

at ta

ke

s in

time a

s a

p

ara

mete

r and re

turn

s a

va

lue. (1

) M

inute

s e

lem

en

t is c

orre

ct (1

) H

ours

ele

me

nt is

co

rrect (1

)

3

(AO

3.2

)

Re

turn

ed

va

lue n

ee

dn

’t be c

orre

ct fo

r first m

ark

E

xa

mp

le s

olu

tion

: function timeValue(givenTime)

intTime=int(givenTime.substring(3,2))

intTime=intTime+int(givenTime.substring(0,2))*100

return intTime

endfunction

c

C

orre

ct s

top a

rray e

xtra

cte

d/re

fere

nce

d in

co

de (1

) S

ensib

le a

ttem

pt to

itera

te th

roug

h th

e a

rray (1

) P

rogra

m re

turn

s tim

e o

f next b

us (1

) P

rogra

m re

turn

s N

o B

use

s w

hen n

o m

ore

buse

s le

ft. (1

) P

rogra

m ru

ns w

ithou

t an in

de

x o

ut o

f bounds e

rror

(Yo

u m

ay a

ssum

e s

hort c

ircu

it eva

luatio

n i.e

. if the

arra

y is

in th

e s

eco

nd p

art o

f an a

nd c

ond

ition it

wo

n’t b

e c

he

cke

d if th

e firs

t half e

va

luate

s to

fals

e.)

(1)

5

(A0

3.2

)

Ma

rks 1

-2 c

an b

e a

wa

rde

d e

ve

n if th

e p

rog

ram

do

esn

’t exh

ibit

beh

avio

ur n

eeded fo

r mark

s 3

-5

Ma

rks 1

-4 c

an b

e a

wa

rde

d e

ve

n if m

ark

5 c

an’t b

e a

wa

rde

d a

s

pro

gra

m w

ould

in re

ality

cra

sh.

count = 0

timesLeft = true

timesList = times[stopName]

while timesLeft == true and

timeValue(timesList[count]) < currentTime

count = count + 1

if count == timesList.length then

timesLeft = false

endif

endwhile

if timesLeft == true then

return timesList[count]

else

return "No Buses"

endif

5

a

B

ranch n

am

e d

ep

en

ds o

n S

ort C

ode (i.e

. there

is a

tra

nsitiv

e re

latio

nship

). 1

(AO

2.1

)

b

C

reate

an

oth

er ta

ble

for B

ranch

es w

hic

h s

ho

uld

3

Page 83: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

15

inclu

de

so

rt-co

de

an

d b

ranch

na

me. (1

) M

ake

so

rt co

de th

e p

rima

ry k

ey o

f the B

RA

NC

H

table

/ Ad

d a

prim

ary

ke

y to

BR

AN

CH

. (1)

Re

mo

ve

Bra

nch

nam

e fro

m C

usto

mers

, leave

so

rtco

de a

s p

rimary

ke

y/ R

em

ove

so

rt-co

de

an

d

bra

nch

nam

e fro

m c

usto

me

rs a

nd

ad

d th

e p

rima

ry

ke

y v

alu

es fro

m B

RA

NC

S a

s th

e fo

reig

n k

ey (1

) A

LT

ER

NA

TIV

E A

NS

WE

R (E

R-D

IAG

RA

M)

Tw

o ta

ble

s C

US

TO

ME

R a

nd

BR

AN

CH

(or s

imila

r n

am

es) (1

) L

ink fro

m C

US

TO

ME

R to

BR

AN

CH

ES

is M

an

y (1

) to

On

e (1

)

(A

O3

.1)

c

M

ark

Ba

nd

3–H

igh

Leve

l (7-9

ma

rks)

Th

e c

and

idate

dem

onstra

tes a

thoro

ug

h

kn

ow

ledg

e a

nd u

nd

ers

tan

din

g o

f transa

ctio

n

pro

ce

ssin

g. T

he

ma

teria

l is g

ene

rally

a

ccura

te a

nd d

eta

iled.

Th

e c

and

idate

is a

ble

to a

pp

ly th

eir

kn

ow

ledg

e a

nd u

nd

ers

tan

din

g 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

rele

va

nt

to th

e e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

thoro

ug

h

dis

cu

ssio

n w

hic

h is

we

ll bala

nce

d. E

va

luativ

e

co

mm

ents

are

co

nsis

tently

rele

va

nt a

nd w

ell-

co

nsid

ere

d.

The

re is

a w

ell-d

eve

lope

d lin

e o

f reaso

nin

g

wh

ich is

cle

ar a

nd lo

gic

ally

stru

ctu

red. T

he

info

rmatio

n p

resen

ted is

rele

van

t and

2

(AO

1.1

) 2

(AO

1.2

) 2

(AO

2.1

) 3

( AO

3.3

)

An

sw

ers

ma

y in

clu

de

, but a

re n

ot lim

ited to

, so

me o

f the p

oin

ts

belo

w.

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

T

ran

sactio

ns s

hou

ld b

e:

Ato

mic

; Th

ey s

hou

ld e

ithe

r su

cce

ed

or fa

il but n

eve

r partia

lly

su

ccee

d.

Co

nsis

tent: T

he tra

nsa

ctio

n s

hou

ld o

nly

ch

ang

e th

e d

ata

ba

se

accord

ing

to th

e ru

les o

f the d

ata

ba

se.

Iso

late

d: E

ach tra

nsa

ctio

n s

ho

uld

n’t a

ffect/o

ve

rwrite

oth

er

transa

ctio

ns c

oncu

rrently

bein

g p

rocesse

d.

Du

rab

le: O

nce a

transa

ctio

n h

as b

ee

n s

tarte

d it is

rem

ain

s n

o m

atte

r w

hat h

ap

pe

ns.

Re

cord

s s

ho

uld

be lo

cked

wh

en

in u

se. If o

ne tra

nsactio

n is

a

me

nd

ing a

record

, no o

ther tra

nsa

ctio

n s

hou

ld b

e a

ble

to u

ntil th

e

first tra

nsa

ctio

n is

com

ple

te.

Tra

nsactio

ns s

hou

ld m

ain

tain

refe

rentia

l inte

grity

. Ch

ang

es to

data

in

on

e ta

ble

mu

st ta

ke in

to a

cco

unt d

ata

in lin

ke

d ta

ble

s.

Da

ta s

hou

ld h

ave

redu

nd

an

cy –

if part o

f a d

ata

ba

se is

lost it s

hou

ld

be re

cove

rab

le fro

m e

lsew

here

.

Page 84: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

16

su

bsta

ntia

ted.

Ma

rk B

an

d 2

-Mid

Leve

l (4-6

ma

rks)

Th

e c

and

idate

dem

onstra

tes re

aso

na

ble

kn

ow

ledg

e a

nd u

nd

ers

tan

din

g o

f transa

ctio

n

pro

ce

ssin

g; th

e m

ate

rial is

ge

ne

rally

accura

te

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

kn

ow

ledg

e a

nd u

nd

ers

tan

din

g d

irectly

to th

e

co

nte

xt p

rovid

ed

alth

oug

h o

ne o

r two

opp

ortu

nitie

s a

re m

isse

d.

Evid

en

ce/e

xa

mp

les a

re fo

r the m

ost p

art

imp

licitly

rele

va

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

so

un

d d

iscu

ssio

n,

the m

ajo

rity o

f wh

ich

is fo

cuse

d. E

va

luativ

e

co

mm

ents

are

for th

e m

ost p

art a

pp

ropria

te,

alth

ou

gh o

ne o

r two o

pp

ortu

nitie

s fo

r 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

so

me

stru

ctu

re. T

he in

form

atio

n p

resente

d is

in

the m

ost p

art re

levant a

nd s

upp

orte

d b

y

so

me

evid

en

ce.

Ma

rk B

an

d 1

-Lo

w L

eve

l (1-3

ma

rks

) T

he c

and

idate

dem

onstra

tes a

basic

kn

ow

ledg

e o

f transa

ctio

n p

roce

ssin

g; th

e

ma

teria

l is b

asic

and c

onta

ins s

om

e

inaccu

racie

s. T

he c

and

ida

te m

ake

s a

limite

d

atte

mp

t to a

pp

ly a

cq

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

wh

ich is

narro

w in

focus. J

udg

me

nts

if ma

de

Da

ta e

nte

red m

ust b

e a

ccu

rate

in th

e firs

t pla

ce.

Se

curity

me

asure

s n

ee

d to

be in

pla

ce to

pre

ve

nt m

alic

ious

tam

perin

g o

f data

. D

ata

ente

red s

hou

ld b

e v

alid

ate

d (a

uto

matic

ally

ch

ecke

d it is

se

nsib

le) a

nd

ve

rified (c

he

cke

d th

at th

e d

ata

ente

red m

atc

hes th

e

orig

inal).

AO

2.1

: Ap

plic

atio

n

En

surin

g th

e a

ccura

cy o

f transa

ctio

ns w

ill be p

artly

dow

n to

the

DB

MS

and

pa

rtly d

ow

n to

the c

ode

acce

ssin

g th

e D

BM

S.

Re

fere

ntia

l Inte

grity

is o

ften e

nfo

rce

d b

y th

e d

ata

ba

se m

anag

em

ent

syste

m.

Re

du

nd

an

cy c

an b

e p

rovid

ed

in a

num

ber o

f wa

ys. T

his

co

uld

be a

R

AID

se

tup o

r mirro

ring

se

rve

rs.

Ba

nk m

ay u

se v

alid

atio

n a

nd

ve

rificatio

n w

hen

da

ta is

inp

ut.

Se

curity

pro

ce

dure

s m

ay in

clu

de

firew

all, e

nfo

rcem

ent o

f se

nsib

le

passw

ord

s a

nd

enfo

rce

d u

ser a

ccess rig

hts

. V

alid

atio

n m

ay in

clu

de

rang

e c

hecks, lis

t ch

ecks, p

rese

nce c

hecks

etc

. V

erific

atio

n m

ay in

clu

de

do

uble

en

try a

nd p

roof re

ad

ing

, A

O3

.3: E

va

lua

tion

It is

essentia

l the b

ank fo

llow

s th

e p

reca

utio

ns d

iscu

ssed

. V

erific

atio

n a

nd v

alid

atio

n h

elp

en

su

re th

e d

ata

is in

itial d

ata

is

so

un

d (g

arb

ag

e in

= g

arb

ag

e o

ut)

If they m

ake

mis

takes w

ith th

eir fin

ancia

l data

they m

ay lo

se m

one

y

or o

ve

rch

arg

e c

usto

mers

and

lose

busin

ess/fin

d th

em

se

lve

s in

leg

al

troub

le.

With

ou

t redu

nd

an

cy d

ata

co

uld

be

lost.

With

ou

t ca

refu

l transa

ctio

n p

roce

ssin

g, o

ne tra

nsa

ctio

n c

ou

ld

accid

en

tally

ove

rwrite

an

oth

er o

r half c

om

ple

te le

adin

g to

ina

ccu

rate

d

ata

. U

nde

r the D

ata

Pro

tectio

n A

ct th

ey h

ave

an

oblig

atio

n to

ke

ep

pers

ona

l data

accura

te.

Page 85: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

17

are

we

ak a

nd u

nsu

bsta

ntia

ted

. T

he in

form

atio

n is

basic

and c

om

mu

nic

ate

d

in a

n

unstru

ctu

red w

ay. T

he in

form

atio

n is

su

pp

orte

d b

y lim

ited

evid

ence a

nd th

e

rela

tion

ship

to th

e e

vid

ence 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

n

ot w

orth

y o

f cre

dit.

Ve

rifica

tion

an

d V

alid

atio

n.

6

a

On

e b

yte

co

rrect (1

) all th

ree

byte

s c

orre

ct.(1

)

2

(AO

1.2

)

b

O

ne b

yte

co

rrect (1

) all th

ree

byte

s c

orre

ct.(1

)

2

(AO

1.2

) A

llow

FT

if (a) is

incorre

ct b

ut b

otto

m ro

w m

ust m

atc

h X

OR

with

top

row

and

ke

y.

c

S

ym

me

tric (1

) …. a

s th

e s

am

e k

ey is

used

to

decry

pt it a

s e

ncry

pt it (1

) 2

(1 -

AO

1.2

, 1

- AO

2.2

)

Allo

w F

T fo

r asym

me

tric if (b

) ind

icate

s a

sym

me

tric e

ncry

ptio

n

use

d

d

A

ny fo

ur fro

m:

Sym

me

tric e

ncry

ptio

n w

ould

req

uire

both

pa

rties to

h

ave

co

py o

f the k

ey (1

) this

co

uld

n’t b

e tra

nsm

itted

o

ve

r the in

tern

et o

r an e

ave

sdro

pp

er m

onito

ring

the

me

ssag

e m

ay s

ee it (1

) Asym

me

tric g

ets

roun

d th

is

req

uire

me

nt a

s th

ere

are

two

diffe

rent k

eys (1

) On

e

ke

y e

ncry

pts

the d

ata

(1) w

hic

h c

an

be p

ub

lica

lly

dis

tribute

d (1

) and a

diffe

rent k

ey to

decry

pt it (1

) w

hic

h is

ke

pt p

riva

te (1

)

4

(AO

1.2

)

Page 86: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

18

7

a

D

obe

rma

n in

co

rrect p

ositio

n (1

) D

alm

atia

n in

corre

ct p

ositio

n (1

) (A

llow

FT

if first m

ark

is in

corre

ct)

2

(AO

2.2

)

Allo

w o

ne

ma

rk if a

dd

ed

in w

rong

ord

er.

b

P

ug

> H

arrie

r (go rig

ht) (1

) P

ug

< R

ottw

eile

r (go

left) (1

) F

ou

nd

Pu

g (1

)

3

(AO

2.2

)

c

S

pan

iel >

Ha

rriet (g

o rig

ht) (1

) S

pan

iel>

Ro

ttwe

iler (g

o rig

ht) (1

)Spa

nie

l < W

hip

pe

t, n

o c

hild

no

de s

o S

pan

iel is

not in

tree (1

)

3

(AO

2.2

)

Page 87: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

19

d

C

alls

getLeftNode()

wh

en

na

me

is le

ss th

an th

e

va

lue o

f the c

urre

nt n

od

e (1

)

and

ca

lls getRightNode()

wh

en

na

me

is le

ss

than

the v

alu

e o

f the c

urre

nt n

od

e. (1

) D

ecla

res a

bre

ed

to b

e in

the tre

e if a

nd

on

ly if it

exis

ts.(1

) D

ecla

res a

bre

ed

not to

be in

the tre

e if a

nd o

nly

if it d

oe

sn’t e

xis

t (1)

Pre

sen

ts o

utp

ut s

tring

s in

co

rrect fo

rma

t (1)

Se

nsib

le u

se o

f va

riab

le n

am

es a

nd c

orre

ctly

in

de

nte

d (1

)

6

(5 A

O

3.2

, 1 A

O

1.2

)

Po

ints

4 a

nd 5

ca

n b

e a

wa

rde

d e

ve

n if 1

-3 a

ren’t.

notThere = false

while breedNode.getName() != name and notThere == false

if name < breedNode.getName() then

if breedNode.getLeftNode() != null then

breedNode = getLeftNode()

else

notThere = true

endif

else // must be greater

if breedNode.getRightNode() != null then

breedNode = getRightNode()

else

notThere = true

endif

endif

endwhile

if notThere == true then

print(name+ " is not in the tree.")

else

print(name+" is in the tree")

endif

8

a

C

ode

en

clo

sed

with

in #warning{…}

(1)

color: red;

(1)

font-family: monospace;

(1)

3

(AO

3.1

) #warning{

color: red;

font-family: monospace;

}

Als

o a

cce

pt h

ex c

olo

r and

RG

B c

olo

r nota

tion

s.

Do

n’t p

en

alis

e fo

r mis

sin

g s

em

icolo

ns.

Acce

pt a

nam

ed s

uita

ble

font lik

e Courier New.

b

C

reate

s a

textb

ox (1

) T

o h

old

the u

sern

am

e/w

hic

h is

refe

rred to

as

2

(AO

2.2

)

Page 88: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

20

usern

am

e (1

)

c

M

ark

Ba

nd

3–H

igh

Leve

l (7-9

ma

rks)

Th

e c

and

idate

dem

onstra

tes a

thoro

ug

h k

now

led

ge

and u

nd

ers

tand

ing

of c

lient a

nd s

erv

er s

ide

pro

ce

ssin

g. T

he m

ate

rial is

ge

ne

rally

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

und

ers

tand

ing

dire

ctly

an

d c

onsis

tently

to th

e

co

nte

xt p

rovid

ed

. Evid

en

ce/e

xa

mp

les w

ill be

exp

licitly

rele

va

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

thoro

ug

h d

iscu

ssio

n w

hic

h

is w

ell b

ala

nce

d. E

va

luativ

e c

om

me

nts

are

co

nsis

tently

rele

va

nt a

nd w

ell-c

onsid

ere

d.

The

re is

a w

ell-d

eve

lope

d lin

e o

f reaso

nin

g w

hic

h is

cle

ar a

nd lo

gic

ally

stru

ctu

red

. The in

form

atio

n

pre

se

nte

d is

rele

van

t and

su

bsta

ntia

ted.

Ma

rk B

an

d 2

-Mid

Leve

l (4-6

ma

rks)

Th

e c

and

idate

dem

onstra

tes re

aso

na

ble

kn

ow

ledg

e

and u

nd

ers

tand

ing

of c

lient a

nd s

erv

er s

ide

pro

ce

ssin

g; th

e m

ate

rial is

ge

ne

rally

accura

te b

ut a

t tim

es 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

und

ers

tand

ing

dire

ctly

to th

e c

onte

xt p

rovid

ed

alth

ou

gh o

ne o

r two 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

rele

va

nt to

the e

xp

lana

tion

. T

he c

and

idate

pro

vid

es a

so

un

d d

iscu

ssio

n, th

e

ma

jority

of w

hic

h is

focuse

d. E

va

luativ

e c

om

me

nts

a

re fo

r the m

ost p

art a

ppro

pria

te, a

lthoug

h o

ne o

r

2

(AO

1.1

) 2

(AO

1.2

) 2

(AO

2.1

) 3

( AO

3.3

)

An

sw

ers

ma

y in

clu

de

, but a

re n

ot lim

ited to

, so

me o

f the p

oin

ts

belo

w.

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

S

erv

er s

ide p

roce

ssin

g ta

ke

s p

lace o

n th

e w

ebse

rve

r. Da

ta is

se

nt

from

the b

row

se

r to th

e s

erv

er, th

e s

erv

er p

rocesse

s it a

nd s

end

s

the o

utp

ut b

ack to

the b

row

se

r. C

lient s

ide p

roce

ssin

g ta

ke

s p

lace in

the w

eb b

row

se

r. A

O2

.1: A

pp

licatio

n

Clie

nt s

ide p

roce

ssin

g d

oesn

’t req

uire

data

to b

e s

ent b

ack a

nd fo

rth

me

an

ing c

ode is

mu

ch m

ore

respo

nsiv

e.

Co

de

is v

isib

le w

hic

h m

ean

s it c

an b

e c

opie

d. T

he

bro

wse

r ma

y n

ot

run th

e c

ode e

ither b

ecau

se it d

oesn

’t have

the c

apa

bility

or

beca

use

the u

ser h

as in

tentio

na

lly d

isa

ble

d c

lient s

ide c

ode

. S

erv

er s

ide p

roce

ssin

g ta

ke

s a

wa

y th

e re

liance

of th

e b

row

se

r h

avin

g th

e c

orre

ct in

terp

rete

r. It hid

es th

e c

ode

from

the u

ser,

pro

tectin

g c

opyrig

ht a

nd

avo

idin

g it b

ein

g a

me

nd

ed

/circ

um

ve

nte

d.

Se

rve

r sid

e p

roce

ssin

g p

uts

extra

load

on th

e s

erv

er. T

his

is a

t the

co

st o

f the c

om

pa

ny h

ostin

g th

e w

ebsite

. A

O3

.3: E

va

lua

tion

C

lient s

ide p

roce

ssin

g is

best u

sed w

hen

it’s n

ot c

ritica

l co

de

that

runs. If it is

critic

al th

en it s

hou

ld b

e c

arrie

d o

ut o

n th

e s

erv

er. C

lient

sid

e p

roce

ssin

g is

als

o b

est w

here

a q

uic

k re

spo

nse

is n

ee

de

d –

an

exa

mp

le b

ein

g g

am

es.

Se

rve

r sid

e p

roce

ssin

g is

best u

sed w

here

it is in

teg

ral th

at

pro

ce

ssin

g is

ca

rried o

ut. It is

ofte

n u

sed

for g

enera

ting

co

nte

nt. It

ca

n b

e u

sed to

access d

ata

inclu

din

g s

ecure

data

. For th

is re

aso

n

any d

ata

pa

sse

d to

it has to

be c

hecke

d c

are

fully

. W

ith s

om

e th

ing

s lik

e v

alid

atio

n g

ood p

ractic

e is

to d

o b

oth

: Firs

t on

the c

lient fo

r a q

uic

k re

spo

nse

if there

is a

n is

su

e, th

en

on th

e s

erv

er

Page 89: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

21

two o

pp

ortu

nitie

s fo

r 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

stru

ctu

re. T

he in

form

atio

n p

rese

nte

d is

in th

e m

ost

part re

levan

t and s

upp

orte

d b

y s

om

e e

vid

en

ce.

Ma

rk B

an

d 1

-Lo

w L

eve

l (1-3

ma

rks

) T

he c

and

idate

dem

onstra

tes a

basic

kno

wle

dg

e o

f clie

nt a

nd s

erv

er s

ide p

rocessin

g; th

e m

ate

rial is

b

asic

and c

onta

ins s

om

e in

accu

racie

s. T

he

ca

nd

idate

make

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

pro

vid

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

men

ts if m

ade a

re w

eak a

nd

unsu

bsta

ntia

ted. T

he in

form

atio

n is

basic

and

co

mm

unic

ate

d in

an u

nstru

ctu

red

wa

y. T

he

info

rmatio

n is

su

pp

orte

d b

y lim

ited e

vid

en

ce a

nd th

e

rela

tion

ship

to th

e e

vid

ence

may 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

n

ot w

orth

y o

f cre

dit.

in c

ase

the c

lient s

ide p

rocessin

g h

as b

ee

n c

ircum

ve

nte

d.

Page 90: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

22

d

A

ny fiv

e fro

m:

Take

s th

e username

and

password

from

the fo

rm

(1)

Use

s th

e u

sern

am

e to

cre

ate

an S

QL s

tate

me

nt (1

)

to g

et th

e passwordHash

belo

ng

ing

to th

e g

ive

n

username

(1) R

uns th

e S

QL

Sta

tem

ent(1

)

hash

es th

e g

ive

n password

and

com

pare

s it to

the

retrie

ve

d h

ash (1

) If th

ey m

atc

h it g

enera

tes a

succe

ss w

ebp

ag

e,

oth

erw

ise

it reco

rds th

e u

ser’s

IP a

dd

ress. (1

)

5

(3 A

O2.2

, 2

AO

3.3

)

e

i A

ny tw

o fro

m:

A n

um

eric

al a

dd

ress m

ad

e o

f 4 n

um

bers

each

betw

een

0 a

nd

25

5 / 3

2 h

exa

de

cim

al d

igits

(1)

Th

at u

niq

uely

iden

tifies a

devic

e o

n a

netw

ork

. (1)

It is a

log

ica

l iden

tifier (i.e

. ca

n c

hang

e o

n a

physic

al

devic

e) (1

)

2

(AO

2.1

)

Page 91: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

23

ii IP

add

ress c

an h

elp

ide

ntify

a u

ser…

(1)

…so

com

pan

y c

an p

ote

ntia

lly tra

ck u

sers

atte

mptin

g

to g

ain

un

auth

oris

ed a

cce

ss (1

)

2

(AO

2.2

)

f

i SELECT passwordHash FROM users WHERE

name = 'admin'

1

(AO

1.2

)

ii 0e5a511

1

(AO

1.2

)

g

i SELECT passwordHash FROM users WHERE

name = 'DenverJ34'; DROP TABLE users;

--'

1

(AO

1.2

)

ii G

ets

passwordHash

for u

sern

am

e D

en

ve

rJ3

4 (1

)

then

de

lete

s th

e ta

ble

ca

lled u

sers

. (1)

2

(AO

3.3

)

iii C

om

pu

ter M

isuse A

ct

1

(AO

1.1

)

9

a

A ∧

¬D

) ∨(A

∧B

∧C

) ∨(¬

B ∧

¬C

∧¬

D)

On

e m

ark

for e

ach

bra

cke

ted

se

ctio

n.

On

e m

ark

for th

em

bein

g jo

ined

with

OR

s

4

(AO

1.2

)

b

i A

1

(AO

1.1

)

ii ¬

(A∨

B)

1

(AO

1.1

)

iii A∨

B

1

(AO

1.1

)

Page 92: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

24

10

a

O

ne A

ND

one N

OT

ga

te u

sed

(1)

In c

orre

ct c

onfig

ura

tion (1

)

2

(AO

1.2

)

b

T

o s

tore

the s

tate

of a

bit

1

(AO

1.1

)

c

O

ne m

ark

for e

ach

two

co

rrect c

lock c

ycle

s.

3

(AO

2.2

.)

11

a

i 10101011

1

(AO

1.2

)

ii 171

1

(AO

1.2

)

b

i 11110111

1

(AO

1.2

)

Page 93: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

25

ii 10001001

1

(AO

1.2

)

c

i N

ot N

orm

alis

ed

1

(AO

1.2

)

ii (M

antis

sa

) Sta

rts w

ith 0

0 (n

orm

alis

ed n

um

bers

sta

rt 0

1 o

r 10)

1

(AO

1.2

)

d

E

xp

on

en

t of firs

t num

ber is

3 (1

) M

akin

g it 0

10

0.1

10

0 (1

) E

xp

on

en

t of s

eco

nd

num

ber is

2 (1

) M

akin

g it 0

10

.01

010 (1

)

S

ubtra

ct n

um

bers

(1)

No

rma

lise

d is

010

01

11

0 0

01

0 (1

)

5

(AO

1.2

) A

cce

pt a

ny s

ensib

le m

eth

od

(eg

co

nve

rting

one n

um

be

r to h

ave

sa

me

exp

on

en

t as o

ther a

nd

su

btra

ctin

g) w

ith c

orre

ct a

nsw

er fo

r full

ma

rks.

12

M

ark

Ba

nd

3–H

igh

Leve

l (9-1

2 m

ark

s)

Th

e c

and

idate

dem

onstra

tes a

thoro

ug

h k

now

led

ge

and

un

ders

tand

ing

of m

eth

od

s o

f utilis

ing

larg

e

am

ou

nts

of c

om

putin

g p

ow

er. T

he m

ate

rial is

g

enera

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

u

nd

ers

tand

ing

dire

ctly

an

d c

onsis

tently

to th

e

co

nte

xt p

rovid

ed

. Evid

en

ce/e

xa

mp

les w

ill be

exp

licitly

rele

va

nt to

the e

xp

lana

tion

. T

he c

and

idate

is a

ble

to w

eig

h u

p b

oth

sid

es o

f the

a

rgu

me

nt w

hic

h re

sults

in a

su

pp

orte

d a

nd

realis

tic

judg

me

nt a

s to

wh

ich

ap

pro

ache

s to

pro

vid

e

incre

asin

gly

larg

er a

mo

un

ts o

f com

putin

g p

ow

er a

re

2

(AO

1.1

) 2

(AO

1.2

) 3

(AO

2.1

) 5

(AO

3.3

)

An

sw

ers

ma

y in

clu

de

, but a

re n

ot lim

ited to

, so

me o

f the p

oin

ts

belo

w.

AO

1: K

no

wle

dg

e a

nd

Un

de

rsta

nd

ing

P

rocesso

rs h

ave

incre

asin

gly

larg

e c

lock s

pee

ds a

nd

ca

n b

e

ove

rclo

cke

d.

Pro

cesso

rs c

an h

ave

multip

le c

ore

s.

Su

pe

r com

pute

rs c

an h

ave

mu

ltiple

pro

cessors

(an

d G

PU

s).

GP

Us c

an b

e a

pp

lied to

pro

ble

ms o

ther th

an

gra

phic

s p

roce

ssin

g.

Pro

ble

ms c

an b

e d

istrib

ute

d a

cro

ss a

num

ber o

f co

mp

ute

rs w

ork

ing

to

ge

ther.

AO

2.1

: Ap

plic

atio

n

Ha

vin

g m

ultip

le c

ore

s c

an

sp

ee

d u

p s

ma

ller p

rob

lem

s b

ut th

is w

ill n

ot b

e e

no

ug

h fo

r larg

er p

rob

lem

s.

Su

pe

rco

mp

ute

rs a

re p

roh

ibitiv

ely

exce

ptio

na

lly e

xp

en

siv

e to

bu

y

Page 94: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

26

best.

The

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 s

tructu

red

. The

info

rmatio

n

pre

se

nte

d is

rele

van

t and

su

bsta

ntia

ted.

Ma

rk B

an

d 2

-Mid

Le

ve

l (5-8

ma

rks)

Th

e c

and

idate

dem

onstra

tes re

aso

na

ble

kn

ow

ledg

e

and

un

ders

tand

ing

of m

eth

od

s o

f utilis

ing

larg

e

am

ou

nts

of c

om

putin

g p

ow

er; th

e m

ate

rial is

g

enera

lly a

ccura

te b

ut a

t times 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

a

lthou

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

rele

va

nt to

the e

xp

lana

tion

. T

he c

and

idate

makes a

reaso

na

ble

atte

mpt to

com

e

to a

co

nclu

sio

n s

how

ing

so

me

recog

nitio

n o

f wh

ich

a

pp

roa

ch

es to

pro

vid

e in

cre

asin

gly

larg

er a

mo

un

ts

of c

om

putin

g p

ow

er a

re b

est.

T

he

re is

a lin

e o

f reaso

nin

g p

rese

nte

d w

ith s

om

e

stru

ctu

re. T

he in

form

atio

n p

rese

nte

d is

in th

e m

ost

part re

levan

t and s

upp

orte

d b

y s

om

e e

vid

en

ce.

Ma

rk B

an

d 1

-Lo

w L

eve

l (1-4

ma

rks

) T

he c

and

idate

dem

onstra

tes a

basic

kno

wle

dg

e o

f m

eth

od

s o

f utilis

ing

larg

e a

mo

unts

of c

om

putin

g

pow

er; th

e m

ate

rial is

basic

and

co

nta

ins s

om

e

inaccu

racie

s. T

he c

and

ida

te m

ake

s a

limite

d a

ttem

pt

to a

pp

ly a

cq

uire

d k

now

led

ge a

nd

un

ders

tand

ing

to

the c

onte

xt p

rovid

ed

. T

he c

and

idate

pro

vid

es n

oth

ing m

ore

than a

n

and

run fo

r all b

ut la

rge o

rgan

isa

tion

s.

GP

Us a

re b

ecom

ing

a c

ost e

fficie

nt w

ay o

f tacklin

g p

rob

lem

s.

GP

Us te

nd

to h

ave

larg

e n

um

ber o

f core

s s

o c

an ru

n o

n h

igh

ly

para

llelis

eab

le p

roble

ms... …

but o

nly

wh

ere

the s

am

e in

stru

ctio

n is

b

ein

g a

pp

lied to

mu

ltiple

pie

ces o

f data

(SIM

D)

AO

3.3

: Eva

lua

tion

In

cre

ase

d c

lock s

pee

d is

limite

d to

sm

alle

r pro

ble

ms. E

ve

n d

ou

blin

g

the c

lock s

pee

d w

ould

on

ly h

alv

e th

e tim

e ta

ke

n.

Pa

ralle

l pro

cessin

g is

n’t s

uite

d to

all p

rob

lem

s. M

ost p

roble

ms a

re

only

partia

lly p

ara

llelis

able

. Writin

g a

lgorith

ms fo

r para

llel p

roce

ssin

g

is m

ore

ch

alle

ng

ing

than

GP

Us s

uite

d to

a s

ubse

t of s

cie

nce/ e

ng

ineerin

g p

roble

ms w

here

th

e s

am

e c

alc

ula

tion

is re

pe

ate

d o

n m

ultip

le d

ata

se

ts.

Page 95: A Level Computer Science Revision Pack Sample Papers

H44

6/0

1

Ma

rk S

ch

em

e

Pra

ctic

e P

ap

er 2

27

unsu

pp

orte

d a

ssertio

n.

The

info

rma

tion is

basic

and

co

mm

un

ica

ted in

an

unstru

ctu

red w

ay. T

he in

form

atio

n is

su

pp

orte

d b

y

limite

d e

vid

en

ce a

nd th

e re

latio

nship

to th

e e

vid

ence

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

n

ot w

orth

y o

f cre

dit.

Page 96: A Level Computer Science Revision Pack Sample Papers

A Level Computer Science H446/02 Algorithms and programming

Practice paper - Set 1 Time allowed: 2 hours 30 minutes

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.• If additional space is required, use the lined page(s) at the end of this booklet. The

question number(s) must be clearly shown.• 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.

© OCR 2016 PRACTICE PAPER OCR is an exempt Charity H44602/6 Turn over

Do not use: • a calculator

First name

Last name

Centre number

Candidate number

Page 97: A Level Computer Science Revision Pack Sample Papers

2

© OCR 2016 PRACTICE PAPER H446/02

Answer all the questions.

Section A

1 A flight simulator allows a user to take control of a simulated aeroplane. The user can fly the plane in an environment that can simulate different weather conditions and additional planes in the sky.

(a) Identify three pieces of information that would need to be researched in order to designthis simulator.

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

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

2. ...........................................................................................................................................

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

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

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

(b) Explain what is meant by ‘concurrent processing’ and describe one example of how thesimulator could make use of it.

Concurrent processing ..........................................................................................................

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

Example ................................................................................................................................

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

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

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

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

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

Page 98: A Level Computer Science Revision Pack Sample Papers

3

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(c) Air traffic controllers are considering introducing a new flight path.

Explain two reasons why they might use the new flight path in the simulation beforeimplementing it in the real world.

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

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

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

2. ...........................................................................................................................................

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

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

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

(d) Abstraction has been used in the design and creation of the flight simulator.

Explain, using an example, the need for abstraction in the creation of the flight simulator.

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

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

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

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

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

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

Page 99: A Level Computer Science Revision Pack Sample Papers

4

© OCR 2016 PRACTICE PAPER H446/02

2 The layout for a 2-player board game is shown in Fig 2.1

Fig 2.1

The game is played by rolling two 6-sided dice and moving that number of spaces. Both players start on the START space. If a player lands on a space occupied by the other player, they move to the next available space.

The board is to be stored as a 2-dimensional array.

(a) The board shown in Fig 2.1 is a visualisation of the problem. Explain what visualisationmeans in this example.

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

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

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

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

START 1 2 3 4 5 6 7

15 14 13 12 11 10 9 8

16 17 18 19 20 21 22 23

31 30 29 28 27 26 25 24

32 33 34 35 36 37 38 39

47 46 45 44 43 42 41 40

48 49 50 51 52 53 54 55

END 62 61 60 59 58 57 56

Page 100: A Level Computer Science Revision Pack Sample Papers

5

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(b) Each time a player moves, a series of obstacles are to be added to the board.

On their turn, each player rolls two dice. The smaller number from the two dice is taken,and that many obstacles will appear on the board in random locations.

For example, if a 3 and 6 are rolled, then 3 obstacles will appear.

A recursive function is written in pseudocode to perform this task.

01 function generateObstacle(diceNumber)

02 if diceNumber == 0 then

03 return true

04 else

05 x = randomNumber(0, 7)

06 y = randomNumber(0, 7)

07 board(x, y) = new obstacle()

08 generateObstacle(diceNumber-1)

09 endif

10 endfunction

The code new obstacle() generates an instance of the object obstacle.

(i) Explain the purpose of the code in line 01 in the algorithm.

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

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

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

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

(ii) Identify the line of code where recursion occurs.

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

(iii) The recursive function could have been written using iteration.

Describe the benefits and drawbacks of using recursion instead of iteration.

Benefits .........................................................................................................................

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

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

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

Drawbacks ....................................................................................................................

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

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

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

Page 101: A Level Computer Science Revision Pack Sample Papers

6

© OCR 2016 PRACTICE PAPER H446/02

(iv) Rewrite the function in part (b) so it uses iteration instead of recursion.

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

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

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

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

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

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

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

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

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

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

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

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

(v) If a position on the board is not occupied, its value is set to a blank string ("").

The current algorithm does not check if the random space generated is currentlyoccupied.

Write a subroutine that takes the generated position of the board, checks if it is freeand returns true if free, or false if occupied.

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

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

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

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

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

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

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

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

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

Page 102: A Level Computer Science Revision Pack Sample Papers

7

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(c) The programmer is using a number of subroutines in the program. Explain, using anexample, the benefits to the programmer of using subroutines in the creation of thisgame.

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

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

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

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

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

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

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

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

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

(d) The programmer has been told the recursive function has the Big O notation of O(n).

(i) State the purpose of Big O notation.

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

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

(ii) Explain what the Big O notation O(n) means for this recursive function.

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

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

Page 103: A Level Computer Science Revision Pack Sample Papers

8

© OCR 2016 PRACTICE PAPER H446/02

3* A multi-national retailer has a very large database storing customers, stock and orders.

The retailer uses data mining to retrieve a variety of information.

Evaluate the use of data mining by the retailer.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 104: A Level Computer Science Revision Pack Sample Papers

9

© OCR 2016 PRACTICE PAPER H446/02 Turn over

4 A 1-dimensionsal array stores a set of numbered cards from 0 to 7. An example of this data is shown in Fig in 4.1

2 0 1 7 4 3 5 6

Fig 4.1

(a) The programmer wants to search for a specific card in the array.

State whether a binary search or a linear search would be the most appropriate methodto search for a specific card, and justify your answer.

Search method .....................................................

Justification ...........................................................................................................................

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

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

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

(b) A programmer is writing a computer program to sort the cards into the correct order(0 to 7).

(i) Show how an insertion sort would sort the array in Fig 4.1 into the correct order.Draw the array after each move.

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

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

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

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

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

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

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

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

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

Page 105: A Level Computer Science Revision Pack Sample Papers

10

© OCR 2016 PRACTICE PAPER H446/02

(ii) Describe how a quick sort algorithm works with the data in Fig 4.2.

2 0 1 7 4 3 5 6

Fig 4.2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 106: A Level Computer Science Revision Pack Sample Papers

11

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(c)* Two other sorting algorithms the programmer could have used are a merge sort and bubble sort.

The worst case scenario for Merge is O(n log(n)) and for Bubble is O(n^2).

Compare the use of a merge sort and a bubble sort on this array, evaluating the performance of each sort, making reference to the worse case Big O notation.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Page 107: A Level Computer Science Revision Pack Sample Papers

12

© OCR 2016 PRACTICE PAPER H446/02

5 A procedure is shown below.

01 procedure fun1(x)

02 y=""

03 if x < 0 then

04 flag = true

05 x = x * -1

06 endif

07 while (x > 0)

08 y = str(x MOD 2) + y

09 x = x DIV 2

10 endwhile

11 if flag == true then

12 y = "1" + y

13 else

14 y = "0" + y

15 endif

16 print(y)

17 endprocedure

flag is a local variable and has a default value of false.

(a) Explain why str is needed in line 08.

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

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

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

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

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

Page 108: A Level Computer Science Revision Pack Sample Papers

13

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(b) (i) Show the result of y when the procedure is called with: fun1(10). Show yourworking.

y: .............................................................................................................................. [4]

(ii) Show the result of y when the procedure is called with fun1(-13). Show yourworking.

y: .............................................................................................................................. [4]

Page 109: A Level Computer Science Revision Pack Sample Papers

14

© OCR 2016 PRACTICE PAPER H446/02

(b) (iii) Identify the purpose of this algorithm.

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

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

(c) In this procedure, flag is assumed to be a local variable.

(i) Explain the problem that would be caused in this algorithm if flag was a globalvariable.

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

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

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

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

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

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

(ii) The programmer has chosen to keep flag as a global variable.

Describe how the algorithm could be changed to prevent the error identified in part (i)

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

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

Page 110: A Level Computer Science Revision Pack Sample Papers

15

© OCR 2016 PRACTICE PAPER H446/02 Turn over

6 A salesman travels around the country, stopping at specific places, and then returning to the starting place.

Fig 6.1 shows an example map of places that the salesman visits.

Fig 6.1

The filled in circle represents the start and end point. The letters represent the places to visit. The lines are the routes available and the numbers are the length of time each route takes to travel.

(a) Explain how abstraction has been applied in the production of Fig 6.1

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

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

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

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

Page 111: A Level Computer Science Revision Pack Sample Papers

16

© OCR 2016 PRACTICE PAPER H446/02

(b) The travelling salesman aims to find the shortest route between these places to visit.

A programmer is writing an algorithm to solve the travelling salesman problem.

The programmer is using a tree to find the most efficient route. Fig 6.2 shows part of thetree with three levels completed.

Fig 6.2

(i) The ‘Start’ nodes on level three are not expanded again as this is a repeat, ‘Start’has already been expanded.

Write the place names in the boxes in Fig 6.2, to complete the fourth level of thetree structure for the map shown in Fig 6.1.

[3]

(ii) Explain why the tree in Fig 6.2 is not a binary tree.

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

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

Page 112: A Level Computer Science Revision Pack Sample Papers

17

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(c) The programmer has decided to use a graph instead of a tree structure.

(i) Describe what is meant by a graph structure.

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

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

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

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

(ii) The pseudocode below shows part of an algorithm which uses a queue to traversethe graph breadth-first. Complete the missing elements of the algorithm.

markAllVertices (notVisited)

createQueue()

start = ...............

markAsVisited(...............)

pushIntoQueue(start)

while QueueIsEmpty() == ..............

currentNode = removeFromQueue()

while allNodesVisited() == false

markAsVisited(...............)

//following sub-routine pushes all nodes connected to

//currentNode AND that are unvisited

pushUnvisitedAdjacents()

endwhile

endwhile

[4]

Page 113: A Level Computer Science Revision Pack Sample Papers

18

© OCR 2016 PRACTICE PAPER H446/02

(d) Fig 6.3 is a graph representation of the places that the travelling salesman visits. Usingthis graph, show how Dijkstra's algorithm would find the shortest path from place A toplace F.

Fig 6.3

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

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

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

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

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

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

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

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

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

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

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

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

Page 114: A Level Computer Science Revision Pack Sample Papers

19

© OCR 2016 PRACTICE PAPER H446/02 Turn over

Section B

Answer all questions

7 Four in a Row is a game where two players drop coloured discs into a grid, with the aim to get four of their own colour in a row. Each player is given a set of coloured discs, red (R) or yellow (Y). The players take it in turns to drop their disc into a column in the grid. The disc drops down to the lowest available space in that column.

The grids below (Fig 7.1 and 7.2) show what happens when the yellow player drops a disc into column 2:

Before

0 1 2 3 4 5 6 0

1

2

3 R Y Y 4 Y R R Y 5 R Y R R Y R

Fig 7.1

After

0 1 2 3 4 5 6 0

1

2 Y 3 R Y Y 4 Y R R Y 5 R Y R R Y R

Fig 7.2

The game continues until one player has got four discs of their colour in a straight row in any direction i.e. vertical, horizontal, or a diagonal.

Page 115: A Level Computer Science Revision Pack Sample Papers

20

© OCR 2016 PRACTICE PAPER H446/02

(a) A programmer is going to use decomposition to help produce the game.

(i) Explain how decomposition can be used in the design of the game Four in a Row.

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

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

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

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

(ii) The program will allow the players to take it in turns to make a move. Each movewill be checked to ensure it is valid (i.e. the column is not already full). After eachmove the program will check if that player has won by checking the horizontal,vertical and diagonal positions to confirm if that player has four discs in a row.

The programmer has developed a top-down design for the program as shown in thestructure diagram Fig 7.3.

Fig 7.3

Add one further level to the structure diagram, by dividing the sub-modules 'Player move', 'Check valid' and 'Check won' into further sub-modules.

[3]

Page 116: A Level Computer Science Revision Pack Sample Papers

21

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(a) (iii) The structured design for this program makes use of pipelining. Describe oneexample of where pipelining could be used in this program.

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

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

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

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

(b) A 2-dimensional array, grid, is used to hold the game grid.

Using pseudocode, write a function that takes as input the player whose turn it is, and thecolumn number they select as their turn. The function either: returns 999 (i.e. the column is already full), or stores the player's move in the array and returns the row the disc has been placed

in.

Annotate your pseudocode with comments to show how it solves the problem.

[6]

Page 117: A Level Computer Science Revision Pack Sample Papers

22

© OCR 2016 PRACTICE PAPER H446/02

(c) After a player makes their move, the program needs to check if that player has won (i.e.the player has four discs in a row).

Subroutines have already been written to check if the player has won vertically, ordiagonally.

Using pseudocode, write a procedure that reads appropriate parameters and checks ifthe player has won horizontally. If the player has won, display an appropriate messageidentifying which player has won.

[6]

Page 118: A Level Computer Science Revision Pack Sample Papers

23

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(d) (i)* The programmer is writing a new version of the game, where each player removesone disc from the bottom row of the grid before a new move is made.

In the example below, player R removes one disc from column 2 (Before) and places one in column 4 (After).

Before

0 1 2 3 4 5 6 0

1

2

3 R Y Y 4 Y R R Y 5 R Y R R Y R

Fig 7.4

After 0 1 2 3 4 5 6

0

1

2

3 R Y R 4 Y Y R Y 5 R Y R R Y R

Fig 7.5

The programmer has to decide whether to continue to use a 2D array, or produce an array of queues.

Evaluate the use of a 2D array versus an array of queues to perform this action.

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

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

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

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

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

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

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

Page 119: A Level Computer Science Revision Pack Sample Papers

24

© OCR 2016 PRACTICE PAPER H446/02

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(d) (ii) Explain why a stack would not be an appropriate data structure for this revisedgame.

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

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

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

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

Page 120: A Level Computer Science Revision Pack Sample Papers

25

© OCR 2016 PRACTICE PAPER H446/02 Turn over

(d) (iii) A procedure needs to be written to remove the disc from the chosen column.The procedure will:

have the column the disc is being removed from as a parameter move each disc in that column down to the bottom of the grid replace the top space with an empty string ("")

Complete the algorithm below.

[3]

procedure playDisc (removeColumn)

Page 121: A Level Computer Science Revision Pack Sample Papers

26

© OCR 2016 PRACTICE PAPER H446/02

(e) The programmer is adding a feature that allows a player to play against the computer.

Explain how the programmer could make use of a tree structure, using a heuristicapproach in the development of the computer player.

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

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

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

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

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

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

..............................................................................................................................................

......................................................................................................................................... [7]

END OF QUESTION PAPER

Page 122: A Level Computer Science Revision Pack Sample Papers

27

© OCR 2016 PRACTICE PAPER H556/01

ADDITIONAL ANSWER SPACE

If additional answer space is required, you should use the following lined page(s). The question number(s) must be clearly shown in the margin(s).

Page 123: A Level Computer Science Revision Pack Sample Papers

28

© OCR 2016 PRACTICE PAPER H446/02

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.

Page 124: A Level Computer Science Revision Pack Sample Papers

H446/02

Practice Paper 1 G

CE C

omputer Science

H

446/02 Algorithms and Program

ming

D

uration: 2 hour/s 30 minutes

MAXIM

UM

MAR

K

140

This document consists of 34 pages

Page 125: A Level Computer Science Revision Pack Sample Papers

9

MAR

K SC

HEM

E:

Question

Answer

Marks

Guidance

1 a

1 m

ark per data item, accept any appropriate, sensible suggestions

• N

umber of other planes that could be in the sky (1)

• Speed(1)

• Flight path(1)

• Altitudes(1)

• R

ate of acceleration(1)

3 AO

2.2 (3)

1 b

M

ax 1 for explanation of concurrent programm

ing. M

ax 3 for each example.

Concurrent processing: •

One process does not have to finish before the other starts(1)

Example e.g.

• Each plane can m

ove independently(1) •

All move at the sam

e time (1)

• All need to react to different events(1)

The weather(1)

• W

ind, rain, direction of air etc. (1) •

Each element needs to be run sim

ultaneously(1) •

It will react to its ow

n stimulii(1)

4 AO

1.2 (1) AO

2.1 (3)

Accept any reasonable suggestion for concurrent program

ming in the sim

ulator For exam

ples: 1 m

ark for identifying exam

ple. 1 m

ark for saying how they

act concurrently. 1 m

ark for saying why this is

necessary.

1 c

1 m

ark per bullet e.g. •

It is safer... (1) •

...Real planes/lives are not put at risk by testing it in reality(1)

• Tim

e can be sped up/decreased ... (1) •

... do not need to wait to see w

hat happens, can view changes

imm

ediately(1) •

It will cost less... (1)

• ...C

an make m

ultiple changes/test all possibilities(1)

4 AO

1.1 (2) AO

2.1 (2)

Page 126: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

10

Question

Answer

Marks

Guidance

1 d

1 m

ark per bullet to max 3

• R

emoving unneeded com

plexities (1) •

Saves mem

ory/resources (1) •

E.g. remove passengers, other planes, other obstacles, landscaping

to reduce mem

ory needed (1)

3 AO

1.2 (2) AO

2.2 (1)

2 a

2 m

arks, 1 for defining visualisation, 1 for application to the 2-d array and grid

• Presents data in an easy-to-grasp w

ay(1) •

An array is not actually a grid/table(1)

2 AO

1.1 (1) AO

2.1 (1)

2 b

i 1 m

ark per bullet to max 2

• D

eclares a function called generateobstacle(1)

• H

as parameter d

iceNumber (1)

2 AO

1.1 (1) AO

2.1 (1)

2 b

ii •

08(1) 1

AO2.1 (1)

2 b

iii m

ax 3 marks for benefit, m

ax 3 for drawback, m

ax 4 marks overall

Benefit •

More natural to read (1)

• Q

uicker to write/less lines of code.. (1) As som

e functions are naturally recursive(1)

• Suited to certain problem

s (1) For example those using trees (1)

• C

an reduce the size of a problem w

ith each call.(1) D

rawback

• C

an run out of stack space/mem

ory(1) (due to too many calls (1))

causing it to crash(1) This can be avoided with tail recursion (1)

• M

ore difficult to trace/follow(1) as each fram

e on the stack has its own

set of variables(1) •

Requires m

ore mem

ory than the equivalent iterative algorithm.

• U

sually slower than iterative m

ethods (1) due to maintainence of the

stack (1)

4 AO

1.1 (2) AO

1.2 (2)

Page 127: A Level Computer Science Revision Pack Sample Papers

11

Question

Answer

Marks

Guidance

2 b

iv 1 m

ark per bullet •

Loop start and end in correct positions(1) •

With correct num

ber of iterations(1) •

Returns a value(1)

• All other code correct, in the right place(1)

e.g. function generateobstacle(diceNumber)

for count = 0 to diceNumber

x = randomNumber(0, 7)

y = randomNumber(0, 7)

board(x, y) = new obstacle()

next count

return true

endfunction

4 AO

2.2 (1) AO

3.2 (3)

2 b

v 1 m

ark per bullet, to max 3

• Appropriate declaration of function, taking 2 param

eters(1) •

Checks position in board against "" correctly(1)

• R

eturns false and true correctly(1)

e.g. function checkFree(x, y)

if board(x, y) == "" then

return true

else return false

endif

endfunction

3 AO

2.1 (1) AO

3.2 (2)

Page 128: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

12

2 c

M

ax 2 marks for explanation of benefits. M

ax 2 marks for exam

ple related to this scenario

• C

ode can be re-used(1) •

…Saves tim

e (1) •

Can use subroutine(s) in other program

s(1) •

…saves tim

e(1) •

Can test independently…

(1) •

… m

ay make finding errors easier(1)

• Any suitable exam

ple, e.g. the code for rolling dice can be written

once (1), then called whenever needed in the gam

e (1)

4 AO

1.1 (1) AO

1.2 (1) AO

2.1 (2)

The question states there is only 1 program

mer, so

splitting the code and giving it to different program

mers is

not relevant to this scenario

2 d

i 1 from

Evaluate the complexity of the algorithm

(1) •

Show how

the time/m

emory/resources increase as the data size

increases (1) •

Evaluate worst case scenario for the algorithm

(1)

1 AO

1.1 (1)

2 d

ii •

As the dice no increases, the time the function takes to run increases

proportionally / linearly (1) 1

AO2.1 (1)

3

M

ark Band 3 – H

igh level (7-9 m

arks) The candidate dem

onstrates a thorough knowledge and understanding of

data; the material is generally accurate and detailed.

The candidate is able to apply their knowledge and understanding directly

and consistently to the context proided. Evidence/examples w

ill be explicitly relevant to the explanation. There is a w

ell-developed line of reasoning which is clear and logically

structured. The information presented is relevant and substantiated.

Mark B

and 2 – Mid level

(4-6 marks)

The candidate demonstrates reasonable knoledge and understanding of data

mining; the m

aterial is generally accurate but at times underdeveloped.

The candidate is able to apply their knowledge and understanding directly to

the context provided although one or two opportunities are m

issed. Evidence/exam

ples are for the most part im

plicitly relevant to the explanation.

9 AO

1.1 (2) AO

1.2 (2) AO

2.1 (2) AO

3.3 (3)

AO1: K

nowledge and

Understanding

Indicative content •

Data m

ining looks through vast quantities of data

• Searches for relationships betw

een facts/com

ponents/events that m

ay not be obvious •

May include pattern

matching algorithm

s •

May involve anom

aly detection algorithm

s •

Used for business

modelling

• U

sed to plan for future

Page 129: A Level Computer Science Revision Pack Sample Papers

13

The candidate provides a reasonable discussion, the majority of w

hich is focused. Evaluative com

ments are, for the m

ost part appropriate, although one or tw

o opportunities for development are m

issed. There is a line of reasoning presented w

ith some structure. The inform

ation presented is in the m

ost part relevant and supported by some evidence.

Mark B

and 1 – Low Level

(1-3 marks)

The candidate demonstrates a basic know

ledge of data mining w

ith limited

understanding shown; the m

aterial is basic and contains some inaccuracies.

The candidates makes a lim

ited attempt to apply acquired know

ledge and understanding to the context provided. The candidate provides a lim

ited discussion which is narrow

in focus. Judgem

ents if made are w

eak and unsubstantiated. The inform

ation is basic and comunicated in an unstructured w

ay. The inform

ation is supported by limited evidence and the relationship to the

evidence may not be clear.

0 marks

No attem

pt to answer the question or response is not w

orthy of credit.

eventualities AO

2: Application •

Can look for links

between a custom

er's purchases

• G

ive recomm

endations for future purchases

• C

heck for days/tim

es/months w

here increases are likely and w

hat the increase will be

purchasing •

Look at matching sales,

when people buy one

product what else do they

buy with it

AO3: Evaluation

Candidates w

ill need to evaluate the benefits and draw

backs of using data m

ining. e.g. •

Can im

prove marketing

• C

an improve quantity of

stock needed •

Ensure demand is m

et •

Increase sales/profit •

Takes vast processing requirem

ents •

Need pow

erful computers

• Privacy concerns from

custom

ers •

Misuse of inform

ation •

Inaccurate information

Page 130: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

14

can produce false results

4 a

1 m

ark for linear search, 2 for justification Justification:

• The array is not sorted(1)

• Linear does not need ordered/linear goes through all elem

ents from

beginning/binary needs a sorted array(1)

3 AO

1.1 (2) AO

2.1 (1)

4 b

i 1 m

ark for each set of 2 moves

02174356 01274356(1)

• 01247356 01234756(1)

• 01234576

• 01234567(1)

3 AO

1.1 (2) AO

2.1 (1)

Allow follow

through if one m

ove is incorrect

Page 131: A Level Computer Science Revision Pack Sample Papers

15

4 b

ii 1 m

ark per bullet to max 6

• U

ses divide-and-conquer(1) •

First item becom

es pivot / 2 is the pivot(1) •

Com

pare each item to the pivot (e.g. com

pare 0 to 2, then 1 to 2)(1) •

Make tw

o lists, 1 with less than the pivot... (0, 1) (1)

• ... 1 w

ith more than the pivot (7,4,3,5,6) (1)

• Q

uick sort the new lists(1)

• R

ecombine the sub-lists(1)

OR

Exam

ple of alternative quicksort method

2 →

0

1 7

4 3

5 6 ←

2 0 →

1

7 4

3 5

6 ←

2

0 1 →

7

4 3

5 6 ←

2 0

1 7 →

4

3 5

6 ←

Swap 7 and 6

2 0

1 6 →

4

3 5

7 ←

2

0 1

6 →

4 3

5 ←

7 Sw

ap 5 and 6 2

0 1

5 →

4 3

6 ←

7

2

0 1

5 4 →

3

6 ←

7

2

0 1

5 4

3 →

6 ←

7

2

0 1

5 4

3 6 ←

7

marks for: •

Uses divide-and-conquer(1)

• H

ighlight first list element as start pointer, and last list elem

ent as end

6 AO

1.1 (1) AO

1.2 (2) AO

2.1 (3)

If no description i.e. the candidate has just show

n the quick sort, m

ax 4 marks.

Page 132: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

16

pointer •

Repeatedly com

pare numbers being pointed to...

• ...if incorrect, sw

ap and move end pointer

• ...else m

ove start pointer •

Split list into 2 sublists •

Quick sort each sublist

• R

epeat until all sublists have only 1 number

• C

ombine sublists

Page 133: A Level Computer Science Revision Pack Sample Papers

17

4 c

M

ark Band 3 – H

igh level (7-9 m

arks) The candidate dem

onstrates a thorough knowledge and understanding of

merge and bubble sorts; the m

aterial is generally accurate and detailed. The candidate is able to apply their know

ledge and understanding directly and consistently to the context provided. Evidence/exam

ples will be explicitly

relevant to the explanation. There is a w

ell-developed line of reasoning which is clear and logically

structured. The information presented is relevant and substantiated.

Mark B

and 2 – Mid level

(4-6 marks)

The candidate demonstrates reasonable knoledge and understanding of

merge and bubble sorts; the m

aterial is generally accurate but at times

underdeveloped. The candidate is able to apply their know

ledge and understanding directly to the context provided although one or tw

o opportunities are missed.

Evidence/examples are for the m

ost part implicitly relevant to the explanation.

The candidate provides a reasonable discussion, the majority of w

hich is focused. Evaluative com

ments are, for the m

ost part appropriate, although one or tw

o opportunities for development are m

issed. There is a line of reasoning presented w

ith some structure. The inform

ation presented is in the m

ost part relevant and supported by some evidence.

Mark B

and 1 – Low Level

(1-3 marks)

The candidate demonstrates a basic know

ledge of merge and bubble sorts

with lim

ited understanding shown; the m

aterial is basic and contains some

inaccuracies. The candidates makes a lim

ited attempt to apply acquired

knowledge and understanding to the context provided.

The candidate provides a limited discussion w

hich is narrow in focus.

Judgements if m

ade are weak and unsubstantiated.

The information is basic and com

unicated in an unstructured way. The

information is supported by lim

ited evidence and the relationship to the evidence m

ay not be clear. 0 m

arks

9 AO

1.1 (2) AO

1.2 (2) AO

2.1 (2) AO

3.3 (3)

AO1: K

nowledge and

Understanding

Indicative content •

Merge sort uses sub-lists

• Bubble sort uses a tem

p elem

ent

• Bubble sort m

oves through the list repeatedly

• M

erge sort divides the list into sm

aller lists

• M

erge is a recursive algorithm

• W

orst case is logarithmic,

scales up well

Worst case is

exponential, does not scale up w

ell AO

2: Application •

Small data set

• Few

changes are needed •

Dem

onstrates use of m

erge and/or bubble on the array

• C

alculations of average speed/best speed/w

orse speed

AO3: Evaluation

Candidates w

ill need to evaluate the benefits and

Page 134: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

18

No attem

pt to answer the question or response is not w

orthy of credit. draw

backs of each sorting algorithm

e.g. •

Merge is fast on large

data sets •

Bubble is intuitive (easier to program

) •

Both are fast (or even) on sm

aller data sets •

Bubble's average speed is w

orse than merge

• Bubble w

ill be easier to w

rite for such a small

data set •

Accept argument for

either way as long as

justified

5 a

m

ax 1 mark for purpose and m

ax 2 for application to line 8. •

Case/convert num

eric value to a string •

Result of x

MOD 2 w

ill be a number...

• ...needs to be concatenated to string y

3 AO

1.2 (1) AO

2.2 (2)

Accept “avoid type m

ismatch error” for 1 m

ark as part of application to line 8

5 b

i 1 m

ark for flag = false.

1 mark for show

ing y's values correctly through loop 1 m

ark for showing x's values correctly through loop

4 AO

1.2 (1) AO

2.1 (3)

If only the result is shown, 1

mark only.

Award bod if no "" w

ith y

Page 135: A Level Computer Science Revision Pack Sample Papers

19

1 mark for the correct answ

er

• 10 > 0 (1)

• y = "0"

x = 5 y = "10"

x = 2 y = "010"

x = 1 y = "1010" (1 for y at each stage)

x=0 (1 for x at each stage)

• 01010 (or

y = "01010")

Accept any suitable answer,

e.g. trace table

5 b

ii 1 m

ark for flag = true and x

=13

1 mark for show

ing y's values correctly through loop 1 m

ark for showing x's values correctly through loop

1 mark for the correct answ

er

• flag = true

x = 13

• y = "1"

x = 6 y="01"

x=3

y="101"

x=1

y="1101" (1 for y at each stage)

x=0 (1 for x at each stage)

• result=11101 (or y="11101")

4 AO

1.2 (1) AO

2.1 (3)

If only the result is shown, 1

mark only.

Award bod if no "" w

ith y Accept any suitable answ

er, e.g. trace table

5 b

iii •

Converts a denary num

ber into sign and magnitude

1 AO

2.1 (1)

cao

5 c

i 1 m

ark per bullet to max 3

• Past values w

ill remain(1)

• If the last value w

as a negative number it w

ill remain t

rue... (1)

3 AO

1.2 (1) AO

2.1 (2)

Page 136: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

20

• ...future positive values w

ill still have the flag true / w

ill be treated as a negative num

ber(1)

5 c

ii 1 from

Put an else statement in/another IF to set flag to f

alse if needed(1)

• M

ake flag be f

alse in the first line of the procedure(1)

1 AO

2.2 (1)

6 a

1 m

ark per bullet to max 2

e.g. • Places have been replaced w

ith variables ... (1) •

...e.g. a place has been replaced with A

(1) •

Irrelevant information has been rem

oved... (1) •

... e.g. only the routes and places are shown(1)

• Tim

e is given as a numeric value(1)...

• ...e.g. 1 rather than 1 hour, or 1 m

inute(1) •

Relative geographic location m

ay not be accurate (1) •

... e.g. positions of the towns m

ay not be proportional to actual distance (1)

2 AO

1.2 (2)

b

i 1 m

ark for completing A,E,F below

C

1 mark for

completing A, F

below B

1 mark for

completed D

, C

below E

3 AO

2.2 (3)

Start

A

Start C

A E

F

B

A F

D

E

D C Start

Page 137: A Level Computer Science Revision Pack Sample Papers

21

6 b

ii In a binary tree a node can only have tw

o children 1

AO1.2 (1)

6 c

i 1 m

ark per bullet to max 2

• C

ollection of data nodes/vertices(1) •

Connections/edges are set betw

een nodes/vertices(1) •

Graph (edges) can be directional or bi-directional(1)

• G

raphs (edges) can be directed or undirected(1)

2 AO

1.1 (2)

6 c

ii 1 m

ark each markAllVertices (notVisited)

createQueue()

start = currentNode (1)

markAsVisited(start) (1)

pushIntoQueue(start)

while QueueIsEmpty() == false (1)

popFromQueue(currentNode)

while allNodesVisited() == false

markAsVisited(currentNode) (1)

//following sub-routine pushes all nodes

connected to

//currentNode AND that are unvisited

pushUnvisitedAdjacents()

endwhile

endwhile

4 AO

1.2 (2) AO

2.1 (1) AO

3.2 (1)

Page 138: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

22

6 d

M

ax 6. 1 m

ark for final solution, max 5 for show

ing the stages •

Mark A as the current node(1)

• R

ecord B is 5, C is 3, D

is 3(1) •

Mark A as visited(1)

• C

is shortest distance from A(1)

• (C

as current) Record E as 6, F as 6(1)

• M

ark C as visited(1)

• (D

as current) Record E as 5(1)

• M

ark D as visited(1)

• (B as current) R

ecord F as 7, do not update table as longer(1) •

Mark B as visited(1)

• (E as current) R

ecord D as 8, do not update table as longer and E as

visited(1) •

A-C-F found as shortest(1)

6 AO

1.2 (3) AO

2.1 (3)

7 a

i 1 m

ark per bullet to max 2

• Breaks a problem

down into its com

ponent parts(1) •

Gam

e can be divided into subprograms(1)

• Subprogram

s can then be programm

ed as subroutines(1)

2 AO

1.1 (2)

Page 139: A Level Computer Science Revision Pack Sample Papers

23

7 a

ii 1 m

ark for identifying all of the sub-modules in each sub-m

odule. Allow any

appropriate additions, do not award a m

ark for any inappropriate or clearly incorrect sub-m

odules. •

Player move m

ust ask for the move to be input(1)

• C

heck valid must check if the colum

n is full(1) •

Check w

on must check horizonal, vertical and diagonal(1)

e.g.

3 AO

2.2 (3)

7 a

iii 1 m

ark for the example, 1 m

ark for explanation of why it is pipelining

e.g. • The results from

the player move subroutine ... (1)

• ...w

ill feed into the check valid subroutine(1)

2 AO

1.2 (1) AO

2.1 (1)

Accept any valid example

Four in a row

Player move

Ask player for colum

n IN

PUT colum

n

Check valid

Check column

is not full

Check won

Check horizontal

Check vertical Check

diagonal

Page 140: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

24

7 b

Program

ming steps to aw

ard marks for, m

ax 6 •

Function declaration taking 2 parameters(1)

• Looping through all 6 elem

ents in the array…(1)

• …

in the correct order (bottom to top, 5 to 0) (1)

• Place player in correct position…

(1) •

… return the position(1)

• R

eturn 999 if no space in that column(1)

Example pseudocode

e.g. function gameMove(player, column)

for x = 5 to 0 step -1

if grid(x,column) == "" then

grid(x,column) = player

return x

endif

next x

return 999

endfunction

6 AO

2.2 (2) AO

3.2 (4)

Page 141: A Level Computer Science Revision Pack Sample Papers

25

7 c

The algorithm

can be tackled by either a) Checking all possible positions, b)

Just checking what is around the last m

ove c) checking the entire row. Full

marks can be aw

arded for all possible methods, if correct.

Programm

ing steps to be awarded as follow

s, to max 6 m

arks. •

Appropriate procedure declaration…

• …

taking at least player parameter(1)

• C

hecking each element in the row

(1) •

Only checking valid options (e.g. if checking row

-3, row-2, row

-1, 0 then they need to check all row

s are within the grid) (1)

• U

pdating a counter/checking for four-in-a-row(1)

• Appropriate output m

essage(1) Exam

ple pseudocode: procedure checkHorizontal (player, row)

counter = 0

for x = 0 to 6

if grid(row, x)== player then

counter = counter + 1

if counter >= 4 then

print "Player " + player + " has won"

endif

else

counter = 0

endif

next x

endprocedure

6 AO

2.2 (2) AO

3.2 (4)

Page 142: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

26

7 d

i M

ark Band 3 – H

igh level (7-9 m

arks) The candidate dem

onstrates a thorough knowledge and understanding of

queues and arrays; the material is generally accurate and detailed.

The candidate is able to apply their knowledge and understanding directly

and consistently to the context provided. Evidence/examples w

ill be explicitly relevant to the explanation. There is a w

ell-developed line of reasoning which is clear and logically

structured. The information presented is relevant and substantiated.

Mark B

and 2 – Mid level

(4-6 marks)

The candidate demonstrates reasonable knoledge and understanding of

queues and arrays; the material is generally accurate but at tim

es underdeveloped. The candidate is able to apply their know

ledge and understanding directly to the context provided although one or tw

o opportunities are missed.

Evidence/examples are for the m

ost part implicitly relevant to the explanation.

The candidate provides a reasonable discussion, the majority of w

hich is focused. Evaluative com

ments are, for the m

ost part appropriate, although one or tw

o opportunities for development are m

issed. There is a line of reasoning presented w

ith some structure. The inform

ation presented is in the m

ost part relevant and supported by some evidence.

Mark B

and 1 – Low Level

(1-3 marks)

The candidate demonstrates a basic know

ledge of queues and arrays with

limited understanding show

n; the material is basic and contains som

e inaccuracies. The candidates m

akes a limited attem

pt to apply acquired know

ledge and understanding to the context provided. The candidate provides a lim

ited discussion which is narrow

in focus. Judgem

ents if made are w

eak and unsubstantiated. The inform

ation is basic and comunicated in an unstructured w

ay. The inform

ation is supported by limited evidence and the relationship to the

evidence may not be clear.

0 marks

9 AO

1.1 (2) AO

1.2 (2) AO

2.1 (2) AO

3.3 (3)

AO1: K

nowledge and

Understanding

Indicative content •

Arrays are static (size cannot change)

• Q

ueues are dynamic

(size can change) •

Queues use pointers to

identify the first element

(to be removed)

AO2: Application

• Array w

ill need all elem

ents to be moved

'down 1' each tim

e a disc is rem

oved •

Queue w

ill allow the front

element to be taken out

and then the pointer will

move

• Algorithm

s for queues can be m

ore complex,

especially as the language m

ay use an array to im

plement the

queue

AO3: Evaluation

Candidates w

ill need to evaluate the benefits and draw

backs of using queues and arrays and suggest an appropriate solution e.g. •

Size does not need to

Page 143: A Level Computer Science Revision Pack Sample Papers

27

No attem

pt to answer the question or response is not w

orthy of credit. change (Static is needed as grid is fixed size) so that benefit of queues is not necessary

• Program

mer has already

written a program

using arrays, m

ay be less time

consuming to edit it for

arrays •

Language may need a

queue to be programm

ed in an array, therefore an array m

ay be more

straight forward to use

• Q

ueue does not need to m

ove all elements each

time a counter is

removed, only pointers

change

7 d

ii M

ax 2 •

Stack is last-in-first-out(1) •

This game the first-in needs to be first-out(1)

2 AO

1.1 (1) AO

2.1 (1)

7 d

iii 1 m

ark per bullet to max 3

• Appropriate loop to m

ove through the column (bottom

to top, so 5 to 1) •

Replacing the grid w

ith the value above (5 with 4 etc.)

• R

eplacing row 0 w

ith ""

e.g. procedure playDisc (removeColumn)

for x = 5 to 1 step -1

grid(x, removeColumn) = grid(x-1, removeColumn)

next x

grid(0, removeColumn) = ""

endprocedure

3 AO

2.2 (1) AO

3.2 (2)

7 e

1 m

ark per bullet to max 7

• Stores/considers a range of next m

oves(1) 7

AO1.2 (2)

Allow a diagram

matic answ

er w

ith appropriate annotation

Page 144: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 1

28

• C

reates branches with possible further m

oves (from both players) (1)

• C

ontinues branching(1) •

Ranks possible m

oves based on success down the branches(1)

• U

ses a branching algorithm/step to decide w

hich direction to follow(1)

• C

an increase ranks on stored moves based on past m

oves(1) •

The current board position is at the top of the tree (1) •

The possible moves are at the next level (1)

• Each level gives every possible next m

ove (1) •

Can add w

eightings as to probability of winning (1)

• Searching algorithm

can find which set of m

oves leads to/has greatest possibility of w

inning (1) •

Heuristics can help in the actual ranking / probability generation for

each game state. (1)

AO2.1 (2)

AO2.2 (3)

that meets the bullets

Page 145: A Level Computer Science Revision Pack Sample Papers

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 2016 Practice paperDC (SC/SW) 145304/2

Last name

First name

Candidatenumber

Centrenumber

Oxford Cambridge and RSA

A Level Computer ScienceH446/02 Algorithms and programming

Practice paper – Set 2Time allowed: 2 hours 30 minutes

Do not use:• a calculator

*0000000000*

OCR is an exempt Charity

Page 146: A Level Computer Science Revision Pack Sample Papers

2

H446/02© OCR 2016

Answer all the questions.

Section A

1 A binary search tree, colour, stores data about colours that are entered into a computer.

(a) A binary search tree is one example of a type of tree.

(i) State the main features of a tree.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [3]

(ii) State the features that make a tree a binary search tree.

...........................................................................................................................................

...................................................................................................................................... [1]

Page 147: A Level Computer Science Revision Pack Sample Papers

3

H446/02 Turn over© OCR 2016

(b) The current contents of colour are shown.

Black Magenta

Green

Blue Indigo

Add the following colours to the tree above in the order written:

Brown White Orange Purple [4]

Page 148: A Level Computer Science Revision Pack Sample Papers

4

H446/02© OCR 2016

(c) A second binary search tree, numbers, stores numbers that are entered into a computer. The contents of the tree are shown below:

50

45

20 48 60 98

88

92

5 31

76

(i) Explain, using the binary search tree numbers as an example, how a depth-first (post-order) traversal is performed.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [5]

Page 149: A Level Computer Science Revision Pack Sample Papers

5

H446/02 Turn over© OCR 2016

(ii) Explain, using the binary search tree numbers as an example, how a breadth-first traversal is performed.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [5]

Page 150: A Level Computer Science Revision Pack Sample Papers

6

H446/02© OCR 2016

(d) The binary search tree, values, is stored as an array of nodes. Each node has a left pointer, a right pointer and the data being stored. The following data is entered in the order shown below:

68 30 73 22 1 90 70

The following table shows the data stored in the array. The Root Pointer stores the node number of the first element in the tree.

Root Pointer Array Index Left Pointer Data Right Pointer

00 1 68 2

1 30

2 73

3 22

Free Pointer 4 1

75 90

6 70

Table 1.1

(i) Complete the remaining Left Pointer and Right Pointer values for the data entered in Table 1.1. Where the pointer is null, leave the space empty. [3]

(ii) State the purpose of the Free Pointer.

...........................................................................................................................................

...................................................................................................................................... [1]

(iii) The following data is added to the array in the given order:

6 100

Add the new nodes to Table 1.1 and update any relevant pointers. [4]

Page 151: A Level Computer Science Revision Pack Sample Papers

7

H446/02 Turn over© OCR 2016

BLANK PAGE

Page 152: A Level Computer Science Revision Pack Sample Papers

8

H446/02© OCR 2016

2 Fig. 2.1 shows the flight paths between a country’s airports. The value in bold beneath each node is the heuristic value from E.

H80

210

185

233

2551

176

30770 50

90

20

0

G L

N

M

E

Fig. 2.1

(a) State the full name of the data structure shown in Fig. 2.1.

.............................................................................................................................................. [2]

(b) The structure in Fig. 2.1 is searched using the A* algorithm making use of the heuristic values.

(i) State what the heuristic values could represent in Fig. 2.1.

...........................................................................................................................................

...................................................................................................................................... [1]

(ii) State the purpose of heuristic values in the A* algorithm.

...........................................................................................................................................

...................................................................................................................................... [1]

Page 153: A Level Computer Science Revision Pack Sample Papers

9

H446/02 Turn over© OCR 2016

(iii) Perform an A* algorithm on the data structure in Fig. 2.1 to find the shortest distance between H and E. Show each step of the process, and the calculations performed for each node visited.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [8]

Page 154: A Level Computer Science Revision Pack Sample Papers

10

H446/02© OCR 2016

(iv) Give one decision that is made in the A* algorithm, and describe the effect of this decision on the next step(s) of the algorithm.

Decision .............................................................................................................................

...........................................................................................................................................

Effect ..................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [3]

(c)* A programmer is interested in using concurrent processing to perform a searching algorithm.

Explain how concurrent processing could be used in searching algorithms, and evaluate the benefits and trade-offs from implementing concurrent processing in a searching algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [9]

Page 155: A Level Computer Science Revision Pack Sample Papers

11

H446/02 Turn over© OCR 2016

3 Dexter is leading a programming team who are creating a computer program that will simulate an accident and emergency room to train hospital staff.

(a) Identify two features of the problem that make it solvable by computational methods.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [2]

(b)* Dexter has used decomposition and abstraction during the analysis of the problem.

Explain and evaluate the use of decomposition and abstraction in the creation of this simulation.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [9]

Page 156: A Level Computer Science Revision Pack Sample Papers

12

H446/02© OCR 2016

(c) Dexter has been told he should make use of caching in the simulation.

Describe what is meant by caching and explain how caching can be used within the simulation.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [4]

(d) Two of Dexter’s programmers have developed different solutions to one part of the problem. Table 3.1 shows the Big O time complexity for each solution, where n = the number of data items.

Solution A Solution B

Time O(n) O(n)

Space O(kn)(where k > 1) O(log n)

Table 3.1

(i) The Big O time complexity for time of each solution is O(n).

Explain what is meant by time complexity, with reference to the solutions’ Big O time complexity.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [3]

Page 157: A Level Computer Science Revision Pack Sample Papers

13

H446/02 Turn over© OCR 2016

(ii) Name the space complexity for each solution:

Solution A ...........................................................................................................................

Solution B ........................................................................................................................... [2]

(iii) Explain, with reference to the Big O complexities of each solution, which solution you would suggest Dexter chooses.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [4]

(e) Dexter’s team is using an integrated development environment (IDE).

Describe how the programmers could make use of the following IDE tools:

Breakpoints ................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Stepping ....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

................................................................................................................................................... [4]

Page 158: A Level Computer Science Revision Pack Sample Papers

14

H446/02© OCR 2016

4 A program needs to sort an array of lowercase strings into descending alphabetic order. An example of the data is shown in Fig. 4.1.

sheep rabbit dog fox cow horse cat deer

Fig. 4.1

(a) Show how a bubble sort would sort the data in Fig. 4.1.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [6]

Page 159: A Level Computer Science Revision Pack Sample Papers

15

H446/02 Turn over© OCR 2016

(b) The algorithm will make use of a function, contains, that compares two strings and checks if the second string contains the first string. For example, calling the function with ("fox", "foxhound") this would return true.

The function needs to:

• Take two strings as parameters, string1 and string2 • return true if string1 is contained within string2, or both strings are identical • return false if string1 is not contained within string2

Write, using pseudocode, the function contains.

Annotate your pseudocode with comments to show how it solves the problem.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [7]

Page 160: A Level Computer Science Revision Pack Sample Papers

16

H446/02© OCR 2016

(c) (i) A merge sort could have been used instead of a bubble sort.

Describe how a merge sort differs from a bubble sort.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [4]

(ii) Name two sorting algorithms, other than a bubble sort and merge sort.

1 .........................................................................................................................................

2 ......................................................................................................................................... [2]

(d) Show how a binary search would be performed on the array shown in Fig. 4.2 to find the value ‘duck’.

wolf monkey lion iguana goat giraffe frog elephant duck

Fig. 4.2

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

Page 161: A Level Computer Science Revision Pack Sample Papers

17

H446/02 Turn over© OCR 2016

Section B

5 Kim is writing an object-oriented program for a four player board game. The board has 26 squares that players move around, as shown in Fig. 5.1.

Start 1 2 3 4 5 6 7

25 8

24 9

23 10

22 11

Deck

21 12

20 19 18 17 16 15 14 Miss aturn

Fig. 5.1

Each player takes it in turn to roll two dice. They then move that number of spaces on the board. If they roll a double (both dice have the same value), they then take a card from the deck. The deck contains 40 cards that each include a sentence (such as “You have won the lottery”). The sentence on the card determines if money is given or taken away from the player.

Each square (apart from Start and Miss a turn) has an animal associated with it that the player can purchase, if it has not been purchased already, for example square 6 has a Squirrel. Fig. 5.2 shows an example of one of these animals. Once a player has purchased the animal, any opposing player which subsequently lands on the square/animal has to pay a fine.

Each animal can be upgraded, with each upgrade the game charges more each time a player stops on them. For example, with no upgrade the level 0 squirrel costs £10 when a player stops on it. If £1000 is paid to upgrade, the squirrel is then a level 1 animal and now charges £50 for a stop.

The cost to purchase and upgrade the animal is the same.

Each animal can be upgraded to a maximum of level 3.

Name = SquirrelLevel = 0

ImageLink: squirrel.bmp

Level 0 stop = £10Level 1 stop = £50Level 2 stop = £100Level 3 stop = £500

Cost = £1000

Owned = free

Fig. 5.2

When a player lands on, or passes the square ‘Start’ (position 0), they receive £500. If they land on ‘Miss a turn’ (position 13), they miss their next turn.

Page 162: A Level Computer Science Revision Pack Sample Papers

18

H446/02© OCR 2016

(a) (i) A class, Player, stores the player’s ID (P1, P2, P3, P4), their current board position and the amount of money they have.

Fig. 5.3 shows a class diagram for Player. A class diagram describes a class. It contains the class name, followed by the attributes, then the methods.

Player

playerID: STRINGboardPosition: INTEGERmoney: INTEGER

constructor()getPosition()setPosition(position)getMoney()setMoney(amount)

Fig. 5.3

The constructor creates a new instance of Player, taking the player’s ID as a parameter. The board position is set to 0, and money to £2000.

Write, using pseudocode, the constructor method for the Player class.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [3]

Page 163: A Level Computer Science Revision Pack Sample Papers

19

H446/02 Turn over© OCR 2016

(ii) A class, Animal, define the attributes and methods for the animals stored in each square.

Fig. 5.4 shows a class diagram for Animal.

Animal

name: STRINGcurrentLevel: INTEGERcost: INTEGERL0: REALL1: REALL2: REALL3: REALimageLink: STRINGsetSquare: INTEGERowned: STRING

constructor()getCost()upgrade(player)getCurrentLevel()setOwned(player)getOwned()getAmountToCharge()getName()

Fig. 5.4

The constructor takes the required data as parameters and then sets currentLevel to 0, and assigns the parameters as the remaining attributes for the new object.

Write, using pseudocode, the constructor method for the Animal class. [4]

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Page 164: A Level Computer Science Revision Pack Sample Papers

20

H446/02© OCR 2016

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

(iii) Write, using pseudocode, the code to create an instance of Animal for the Squirrel shown in Fig. 5.2, positioned on square number 6, for the constructor function you wrote in part (a)(ii).

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [2]

Page 165: A Level Computer Science Revision Pack Sample Papers

21

H446/02 Turn over© OCR 2016

(b) The board is stored as a 1D array, board, of data type Animal. The spaces at 0, and 13, are left as empty elements that are checked using separate functions.

(i) Complete, using pseudocode, the function to:

• Roll both dice • Move the player, the dice number of spaces • If a double is rolled, calls the procedure pickDeck • Adds £500 if they have passed or landed on Start • Calls the procedure missAGo if they land on space 13 or • Calls the procedure checkAnimal • Return the new position

function playerMove(currentPlayer)

dice1 = random(1,6)

dice2 = random(1,6)

position = ............................ + dice1 + dice2

if ................ == dice2 then

pickDeck(currentPlayer)

endif

if position > 25 then

currentPlayer.setMoney(currentPlayer.getMoney() + .............)

position = position - ................................

endif

if position == ................................. then

missAGo(currentPlayer)

elseif position != 0 then

checkAnimal(currentPlayer)

endif

.................................................................

endfunction [6]

Page 166: A Level Computer Science Revision Pack Sample Papers

22

H446/02© OCR 2016

(ii)* The parameter currentPlayer from part (b)(i) can be passed by value or by reference.

Explain the difference, benefits and drawbacks between passing by value and by reference. Recommend which should be used for currentPlayer, justifying your decision.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...................................................................................................................................... [9]

Page 167: A Level Computer Science Revision Pack Sample Papers

23

H446/02 Turn over© OCR 2016

(c) The deck is stored as a zero-indexed 1D array, named deck, of type Card.

The class diagram for Card is shown in Fig. 5.5.

Card

textToDisplay: STRINGamount: INTEGER

constructor()getTextToDisplay()getAmount()

Fig. 5.5

The array, deck, is treated as a queue, with a variable, headPointer, identifying the first card in the deck. When a card has been used, the head pointer increases to move to the next position. If the end of the deck is reached, the head pointer returns to 0 and starts again.

The procedure pickDeck:

• takes the current player as a parameter • outputs the text to be displayed from the first card in the queue • adds or subtracts the amount to/from the current player’s money • increases the head pointer

Write, using pseudocode, the procedure pickDeck.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [6]

Page 168: A Level Computer Science Revision Pack Sample Papers

24

H446/02© OCR 2016

(d) The procedure checkAnimal:

• Takes the current player as a parameter • Accesses the data for the animal at the player’s position in the array board • If the animal is free, asks the player if they would like to purchase the animal and outputs

its name and cost, if they choose to buy the animal, it calls the procedure purchase() with the player and animal as parameters

• If that player owns the animal, and it is not at level 3, it asks if they would like to upgrade the animal

• If they would like to upgrade, it calls the method upgrade for that animal with the current player as a parameter

• If a different player owns the animal, it calls the method getAmountToCharge() for that animal, sending this value and the current player as parameters to the procedure chargeStay()

Write, using pseudocode, the procedure checkAnimal. [10]

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Page 169: A Level Computer Science Revision Pack Sample Papers

25

H446/02© OCR 2016

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

END OF QUESTION PAPER

Page 170: A Level Computer Science Revision Pack Sample Papers

Practice Paper 2 G

CE C

omputer Science

H

446/02 Algorithm

s and Programm

ing

Duration 2 hours 30 m

inutes

M

AXIMU

M M

ARK

140

FINA

L

This docum

ent consists of 27 pages

Page 171: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

11

Question

Answer

Marks

Guidance

1 a

i 1 m

ark per bullet to max 3

• A data structure

• C

onsists of nodes •

That have sub nodes (children) •

First node is called the root •

Lines that join nodes are called branches

3 AO

1.1 (3)

1 a

ii 1 m

ark per bullet to Max 1

• In a binary search tree, each node only has m

ax. 2 sub nodes •

If a child node is less than a parent node, it goes to the left of the parent.

• If a child node is greater than a parent node, it goes to the right of the parent.

1 AO

1.2 (1)

1 b

1 m

ark for each node as a correct sub-node

4 AO

2.1 (4)

Allow follow

through e.g. if white is

incorrect, but orange follows through in

a logical position.

Page 172: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

12

Question

Answer

Marks

Guidance

1

c i

2 marks for correct order •

5, 31, 20, 48, 45, 60 •

92, 88, 98, 76, 50

1 mark per bullet to m

ax 3 for explanation •

Visit all nodes to the left of the root node •

Visit right •

Visit root node •

Repeat three points for each node visited

5 AO

1.1 (1)

AO1.2

(2) AO

2.1 (2)

1 c

ii 2 m

arks for correct order •

50, 45, 76 •

20, 48, 60, 98, 5, 31, 88, 92 1 m

ark per bullet to max 3 for explanation

• Visit root node

• Visit all direct subnodes (children)

• Visit all subnodes of first subnode

• R

epeat three points for each subnode visited

5 AO

1.1 (1)

AO1.2

(2) AO

2.1 (2)

1 d

i 1 m

ark for the correct pointers for nodes 1, 2 and 3

3 AO

2.1 (3)

Ignore any change to FP, additional nodes and R

ight Pointers to node 4 and 5

Page 173: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

13

Question

Answer

Marks

Guidance

Array Index

Left Pointer

Data

Right

Pointer 0

1 68

2 1

3 30

2

6 73

5 3

4 22

4

1

5

90

6

70

Page 174: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

14

1 d

ii To identify w

here the next element w

ill be placed 1

AO1.2 (1)

1 d

iii 1 m

ark per bullet •

Adding data 6 and 100 •

…In the correct order

• U

pdating the Right Pointers of nodes 4 and 5

• U

pdating the Free Pointer to 9

Array Index

Left Pointer

Data

Right

Pointer 0

1 68

2 1

3 30

2

6 73

5 3

4 22

4

1

7 5

90

8 6

70

7

6

8

100

4 AO

2.1 (4) Allow

follow through for errors from

1di

2 a

1 m

ark per bullet •

Weighted/U

ndirected •

Graph

2 AO

1.2 (2)

2 b

i E.g. W

eighting/cost based on estimated distance from

final node 1

AO2.1

2 b

ii U

sed to speed up process of finding solution

1 AO

1.1

FP: 9

Page 175: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

15

2 b

iii 1 m

ark per bullet, max 7 for calculations/explanation, m

ax 1 for correct final path

• Visiting H

with correct heuristic

• Visiting G

and N from

H

o C

alculating correct distance+heuristic for G and N

Identifying G as the sm

allest value •

Visiting L and M from

G

o C

alculating distance+heuristic for L and M

• Identifying L as the sm

allest value •

Visiting E o

Calculating distance+heuristic for E

• Final path: H-G-L-E

e.g. N

ode Distance travelled

Heuristic distance+heuristic

previous node

H 0

80 80

- G

25 70

95 H

N 210

90 300

H L

51+25=76 50

126 G

M

176+25=201 233+210=443

20 221 463

G N

E 307+76=383

0 383

L

8 AO

1.2 (4)

AO2.1

(4)

2 b

iv 1 m

ark for decision, 2 marks for effect

e.g. D

ecision: •

Choosing w

hich node to take next •

The shortest distance+heuristic is taken

Effect: •

All adjoining nodes from this new

node are taken •

Other nodes are com

pared again in future checks •

Assumed that this node is a shorter distance

3 AO

2.1 (3)

Page 176: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

16

• Adjoining nodes m

ay not be shortest path …

• …

.may need to backtrack to previous nodes

2 c

M

ark Band 3 – H

igh level (7-9 m

arks) The candidate dem

onstrates a thorough knowledge and understanding of

concurrent processing; the material is generally accurate and detailed.

The candidate is able to apply their knowledge and understanding directly and

consistently to the context provided (searching algorithms).

Evidence/examples w

ill be explicitly relevant to the explanation. The candidate provides a thorough discussion w

hich is well balanced.

Evaluative comm

ents are consistenly relevant and well considered.

There is a well-developed line of reasoning w

hich is clear and logically structured. The inform

ation presented is relevant and substantiated. M

ark Band 2 – M

id level (4-6 m

arks) The candidate dem

onstrates reasonable knowledge and understanding of

concurrent processing; the material is generally accurate but at tim

es underdeveloped. The candidate is able to apply their know

ledge and understanding directly to the context provided although one or tw

o opportunities are missed. (searching

algorithms) Evidence/exam

ples are for the most part im

plicitly relevant to the explanation. The candidate provides a reasonable discussion, the m

ajority of which is

focused. Evaluative comm

ents are, for the most part appropriate, although

one or two opportunities for developm

ent are missed.

There is a line of reasoning presented with som

e structure. The information

presented is in the most part relevant and supported by som

e evidence M

ark Band 1 – Low

Level (1-3 m

arks) The candidate dem

onstrates a basic knowledge of concurrent processing w

ith lim

ited understanding shown; the m

aterial is basic and contains some

inaccuracies. The candidates makes a lim

ited attempt to apply acquired

9 AO

1.1 (2)

AO1.2

(2) AO

2.1 (2)

AO3.3

(3)

AO1: K

nowledge and U

nderstanding Indicative content •

Carrying out m

ore than one task at a tim

e •

Multiple processors

• Each processor perform

s sim

ultaneously •

Each processor performs tasks

independently and/or •

A program has m

ultiple threads •

Each thread starts and ends at different tim

es •

Each thread overlaps •

Each thread runs independently AO

2: Application •

Each processor/thread performs a

search in a different direction •

Rather than going dow

n one path, go dow

n 2+ •

E.g. apply different searches sim

ultaneously - perform breadth-

first and depth-first simultaneously

• E.g. A* take the tw

o shortest routes at each decision point, update sam

e table

• Linear search can have m

ultiple processors searching different areas at the sam

e time.

• Binary search doesn't benefit from

an increase in speed w

ith additional processors

Page 177: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

17

knowledge and understanding to the context provided (searching algorithm

s). The candidate provides a lim

ited discussion which is narrow

in focus. Judgem

ents if made are w

eak and unsubstantiated. The inform

ation is basic and comunicated in an unstructured w

ay. The inform

ation is supported by limited evidence and the relationship to the

evidence may not be clear.

0 marks

No attem

pt to answer the question or response is not w

orthy of credit.

AO3: Evaluation

Candidates w

ill need to evaluate the benefits and draw

backs of concurrent processing in searching e.g. •

Possibly find solution faster •

Takes up more m

emory

• Increase program

throughput •

May w

aste time investigating

inefficient solutions •

More difficult to program

especially to cooperate

• M

ore mem

ory intensive •

Linear search scales very with

additional processors •

Binary search can perform better on

large data sets with one processor

than linear search with m

any processors

3

a

1 mark for each feature

e.g. • Involves calculations

• H

as inputs, processes and outputs •

Involves logical reasoning

2 AO

1.2 (2)

Allow any suitable feature

3 b

M

ark Band 3 – H

igh level (7-9 m

arks) The candidate dem

onstrates a thorough knowledge and understanding of

decomposition and abstraction; the m

aterial is generally accurate and detailed. The candidate is able to apply their know

ledge and understanding directly and consistently to the context provided. Evidence/exam

ples will be explicitly relevant to the explanation.

The candidate provides a thorough discussion which is w

ell balanced. Evaluative com

ments are consistenly relevant and w

ell considered There is a w

ell-developed line of reasoning which is clear and logically

9 AO

1.1 (2)

AO1.2

(2) AO

2.1 (2)

AO3.3

(3)

AO1: K

nowledge and U

nderstanding Indicative content D

ecomposition:

• splits problem

into sub-problems

• splits these problem

s further •

until each problem can be solved

• Allow

s the use of divide and conquer

Abstraction

Page 178: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

18

structured. The information presented is relevant and substantiated.

Mark B

and 2 – Mid level

(4-6 marks)

The candidate demonstrates reasonable knoledge and understanding of

decomposition and abstraction; the m

aterial is generally accurate but at times

underdeveloped. The candidate is able to apply their know

ledge and understanding directly to the context provided although one or tw

o opportunities are missed.

Evidence/examples are for the m

ost part implicitly relevant to the explanation.

The candidate provides a reasonable discussion, the majority of w

hich is focused. Evaluative com

ments are, for the m

ost part appropriate, although one or tw

o opportunities for development are m

issed. There is a line of reasoning presented w

ith some structure. The inform

ation presented is in the m

ost part relevant and supported by some evidence

Mark B

and 1 – Low Level

(1-3 marks)

The candidate demonstrates a basic know

ledge of decomposition and

abstraction with lim

ited understanding shown; the m

aterial is basic and contains som

e inaccuracies. The candidates makes a lim

ited attempt to apply

acquired knowledge and understanding to the context provided.

The candidate provides a limited discussion w

hich is narrow in focus.

Judgements if m

ade are weak and unsubstantiated.

The information is basic and com

unicated in an unstructured way. The

information is supported by lim

ited evidence and the relationship to the evidence m

ay not be clear. 0 m

arks N

o attempt to answ

er the question or response is not worthy of credit.

• R

emoving unnecessary

elements using sym

bols •

Rem

oving unnecessary design/program

ming/

computational resources

AO2: Application

• Split the sim

ulation into subparts •

E.g. generating rooms, patients,

people, scenarios, interaction •

E.g. replacing how instrum

ents look w

ith shapes, minim

ise features of hum

an body AO

3: Evaluation e.g. •

Increase speed of production •

Assign areas to specialities •

Allows use of pre-existing m

odules •

Allows re-use of new

modules

• N

eed to ensure subprograms can

interact correctly •

Can introduce errors

• R

educes processing/mem

ory requirem

ents •

Increases response speeds of program

s

3 c

2 m

arks for definition, max 2 for application

Caching: •

Data that has been used is stored in cache/ram

in case it is needed again

• Allow

s faster access for future use

4 AO

1.1 (2)

AO2.1

(2)

Allow any reasonable exam

ple A w

ell-developed example can gain tw

o m

arks

Page 179: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

19

Application: e.g. •

Store patients’ details/conditions/appearance •

Design of people in the sim

ulation •

Design of specific room

s 3

d i

1 mark per bullet •

How

the times scales as data size increases

• O

(n) = linear complexity

• Increases at the sam

e rate as the number of data item

s increases

3 AO

1.1 (1)

AO2.1

(2)

Page 180: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

20

3 d

ii 1 m

ark each A = exponential B = logarithm

ic

2 AO

1.1 (2)

3 d

iii 1 m

ark for recomm

endation, max 3 for explanation

• R

ecomm

end: Solution B Justification

• A’s space does not scale w

ell when increased in num

ber of items

• B’s space scales w

ell / does not increase significantly with num

ber of item

s •

As n increases at some point a w

ill require significantly more space

than B •

Both have same tim

e complexity so need to look at space

4 AO

1.2 (2)

AO2.1

(2)

3 e

1 m

ark per bullet, max 2 for each tools

Breakpoints •

Use to test the program

works up to/at specific points

• C

heck variable contents at specific points •

Can set a point w

here the program stops running

Stepping •

Can set the program

to run line by line •

Slow dow

n/watch execution

• Find the point w

here an error occurs

4 AO

1.1 (2)

AO1.2

(2)

4 a

1 m

ark for each correct swap identified/described

sheep rabbit

dog fox

cow

horse cat

deer sheep

rabbit fox

dog cow

horse

cat deer

sheep rabbit

fox dog

horse cow

cat

deer sheep

rabbit fox

dog horse

cow

deer cat

sheep rabbit

fox horse

dog cow

deer

cat sheep

rabbit fox

horse dog

deer cow

cat

sheep rabbit

horse fox

dog deer

cow

cat

6 AO

1.2 (3)

AO2.1

(3)

4 b

1 m

ark per bullet to max 7

• C

orrect function declaration, taking string1 and string2 as parameters

• U

se of a flag

7 AO

2.1 (1)

AO2.2

Allow reversed true and false

Page 181: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

21

• Looping through string2 by som

e means

• U

sing string manipulators to check either letters or substrings of string2

• C

orrectly setting return value to true

• R

eturning true or f

alse accordingly

• C

omm

ents that explain how the algorithm

works

e.g. function contains(string1, string2)

wordInside = false

for i = 0 to (string2.length – string1.length)

if string2.substring(i, string1.length) ==

string1 then

wordInside=true

endif

next i

return wordInside

endfunction

(2) AO

3.2 (4)

4 c

i 1 m

ark per bullet to max 4

• M

erge sort splits the data •

Merge sorts the split data as it is put back together

• Bubble m

oves through the data in a linear way

• Bubble m

oves through the data repeatedly •

Merge is m

ore efficient with larger volum

es of data to sort •

Merge m

ay require more m

emory space

4 AO

1.1 (1)

AO1.2

(2) AO

2.1 (1)

Allow points by dem

onstration/example

4 c

ii 1 m

ark per example

e.g. • Insertion

• Q

uick

2 AO

1.1 (2)

4 d

1 m

ark for each bullet •

Duck is sm

aller than goat •

Duck is less than frog/elephant

• D

uck is equal to duck/less than elephant so only duck left

3 AO

2.1 (3)

Page 182: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

22

5 a

i 1 m

ark per bullet to max 3

• D

eclaring the procedure and taking a player ID as param

eter •

Setting playerID to param

eter •

Setting boardPosition to 0 and m

oney to 2000 e.g. public procedure new(thePlayerID)

playerID = thePlayerID

boardPosition = 0

money = 2000

endprocedure

3 AO

2.2 (2)

AO3.2

(1)

5 a

ii 1 m

ark per bullet to max 4

• D

eclaration as public and procedure, named constructor/new

and Taking all correct param

eters (missing currentLevel)

• Sets currentLevel to 0

• Setting all the data…

…to the m

atching parameters taken

e.g. public procedure new(theName, theCost, theL0, theL1,

theL2, theL3, theImageLink, theSetSquare, theOwned)

name = theName

currentLevel = 0

cost = theCost

L0 = theL0

L1 = theL1

L2 = theL2

L3 = theL3

imageLink = theImageLink

setSquare = theSetSquare

owned = theOwned

endprocedure

4 AO

2.2 (2)

AO3.2

(2)

5 a

iii 1 m

ark per bullet to max 2

• C

reating new instance e.g. squirrel = new

Anim

al •

Parameters m

atching part (b)(i)

e.g.

2 AO

2.1 (2)

Page 183: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

23

squirrel = new Animal(“Squirrel”, 1000, 10, 50, 100, 500,

“squirrel.bmp”, 6, “free”)

5 b

i 1 m

ark for each correctly completed space

function playerMove(currentPlayer)

dice1 = random(1,6)

dice2 = random(1,6)

position = currentPlayer.getPosition() +

dice1 + dice2

if dice1 == dice2 then

pickDeck(currentPlayer)

endif

if position > 25 then

currentPlayer.setMoney(currentPlayer.getMoney() +

500)

position = position - 26

endif

if position == 13 then

missAGo(currentPlayer)

elseif position != 0 then

checkAnimal(currentPlayer)

endif

return position

endfunction

6 AO

2.2 (3)

AO3.2

(3)

5 b

ii M

ark Band 3 – H

igh level (7-9 m

arks) The candidate dem

onstrates a thorough knowledge and understanding of

passing values by reference and by value; the material is generally accurate

and detailed. The candidate is able to apply their know

ledge and understanding directly and consistently to the context provided. Evidence/exam

ples will be explicitly relevant to the explanation. The candidate

9 AO

1.1 (2)

AO1.2

(2) AO

2.1 (2)

AO3.3

AO1: K

nowledge and U

nderstanding Indicative content By Value

• sends the actual value

• if changes are m

ade then only the local copy is am

ended By R

eference •

sends a pointer to the value

Page 184: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

24

provides a thorough discussion which is w

ell balanced. Evaluative comm

ents are consistently relevant and w

ell considered There is a w

ell-developed line of reasoning which is clear and logically

structured. The information presented is relevant and substantiated.

Mark B

and 2 – Mid level

(4-6 marks)

The candidate demonstrates reasonable knoledge and understanding of

passing values by reference and by value; the material is generally accurate

but at times underdeveloped.

The candidate is able to apply their knowledge and understanding directly to

the context provided although one or two opportunities are m

issed. Evidence/exam

ples are for the most part im

plicitly relevant to the explanation. The candidate provides a reasonable discussion, the m

ajority of which is

focused. Evaluative comm

ents are, for the most part appropriate, although

one or two opportunities for developm

ent are missed.

There is a line of reasoning presented with som

e structure. The information

presented is in the most part relevant and supported by som

e evidence M

ark Band 1 – Low

Level (1-3 m

arks) The candidate dem

onstrates a basic knowledge of passing values by

reference and by value with lim

ited understanding shown; the m

aterial is basic and contains som

e inaccuracies. The candidates makes a lim

ited attempt to

apply acquired knowledge and understanding to the context provided.

The candidate provides a limited discussion w

hich is narrow in focus.

Judgements if m

ade are weak and unsubstantiated.

The information is basic and com

unicated in an unstructured way. The

information is supported by lim

ited evidence and the relationship to the evidence m

ay not be clear. 0 m

arks N

o attempt to answ

er the question or response is not worthy of credit.

(3) •

The actual value is not sent/received

• If changed the original is also changed w

hen the subroutine ends

AO2: Application •

Send by value •

The currentPlayer value is

not /does not need to be changed in the subprogram

Send by reference •

The currentPlayer value is

updated AO

3: Evaluation •

ByValue creates new m

emory

space…

• ByR

eference means existing

mem

ory space is used •

Depends if original variable is

local/global •

If local and just referenced, send by value

• If original value needs editing send by reference

• If passing by reference then instead of returning p

osition

the code could just amend

currentPlayer.position

• If passing by value there could be inconsistencies w

hen currentPlayer is passed to

other methods, for exam

ple pickDeck

Page 185: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice Paper 2

25

5 c

1 m

ark per bullet to max 6

• Procedure declaration w

ith correct name and param

eter •

Outputting the correct text from

deck at headPointer

• Sending to c

urrentPlayer.setMoney …

getMoney + d

eck at head pointer am

ount •

Increase the head pointer •

Set headPointer to 0 if position 40 or greater

procedure pickDeck(currentPlayer)

output(deck[headPointer].getTextToDisplay())

amount = deck[headPointer].getMoney()

currentPlayer.setMoney(currentPlayer.getMoney() +

amount)

headPointer = headPointer + 1

if headPointer == 40 then

headPointer = 0

endif

endprocedure

6 AO

2.2 (4) AO

3.2 (2)

5 d

Declaring the procedure w

ith correct parameters

• C

heck if the space/animal is free

o If free, outputting nam

e and cost o

Checking if they w

ant to buy

Calling purchase w

ith current player and animal

• If they ow

n the animal, checking if they can upgrade

If they can, asking if they w

ant to upgrade outputting the cost

If they w

ant to, calling the upgrade m

ethod •

If they don’t own the anim

al o

Calling c

hargeStay w

ith the amount to charge and the current

player

10 AO

2.2(5) AO

3.2(5)

Allow follow

through for incorrect accessing of m

ethods

Page 186: A Level Computer Science Revision Pack Sample Papers

H446/02

Mark Schem

e Practice paper 2

26

e.g. procedure checkAnimal(currentPlayer)

if board[currentPlayer.getPosition()].owned == “free”

answer = input(“Would you like to purchase “,

board[position].getName(), “? It costs “,

board[position].getCost()

if answer = “yes” then

purchase(currentPlayer, board[position])

endif

elseif board[currentPlayer.getPosition()].getOwned() == currentPlayer

if board[currentPlayer.getPosition()].getCurrentLevel()

!= “L3”

answer = input(“Upgrade? It costs “,

board[position].getCost())

if answer == “yes” then

board[currentPlayer.getPosition()].upgrade(currentPlayer)

endif

endif

else

amount = board[position].getAmountToCharge()

chargeStay(amount, currentPlayer)

endif

endprocedure