Professional Documents
Culture Documents
A2 Level Computer Science Topical Paper 4 Final 2018
A2 Level Computer Science Topical Paper 4 Final 2018
A2 Level Paper 4
Computer Science
Paper 4: Further Problem-solving and
Programming Skills
ADNAN SALEEM
Exclusively Available at
STUDENTS RESOURCE® ANEES BOOK CORNER
Shop 23-24, A.B Height Plaza Main Market Gulberg
Basement Faysal Bank,
Near Toyota Motors Airport, Lahore NEW & OLD BOOK SHOP
0321/320-4567519 / 0423-5700707 Opp. Punjab Bank, H-DHA,Ph-I
---------------------------------------------------------------------------
All Rights Reserved.
This Book or Parts thereof may not be reproduced in an form, stored in any retrieval system, or
transmitted in any form by any means – electronic, mechanical, photocopy, recording, or otherwise-
without prior written permission of the STUDENTS RESOURCE® Airport Road (publisher)
---------------------------------------------------------------------------
NOTICE (warning)
NO FURTHER NOTICE (Legal Warning) WOULD BE ISSUED FOR THIS PURPOSE.
Legal Advisor
Salik Aziz Vaince
M.Sc. LLB.
Advocate High Court
CEO Vaince Law
Chamber
Visiting Lecturer of Law
Write a comment…….
Your feedback is warmly welcomed. Feel free to suggest us for improvements if you have any
comments; kindly send us at aqsaleem@gmail.com or +923224125423.
The Author
Topic 23 Computational Thinking & Problem-Solving ……. 5
Topic 24 Algorithm Design Methods ……………………….. 93
Topic 25 Recursion ……………………………………………161
Topic 26 Further Programming…………………………….. 173
Topic 27 Object-Oriented Programming (OOP) ………… 199
Topic 28 Low level Programming …………………………..293
Topic 29 Declarative Programming.………………………. 343
Topic 30 Software Development ……………………………365
CAIE Latest Syllabus Content……………………………………389
Example Candidate Responses for P4 ……………………….. 401
Topic 23
Computational Thinking &
Problem-Solving
E®
RC
U
SO
RE
TS
N
DE
U
ST
5
AS Computer Science Paper 4
A2 1 Topic 23: Computational Thinking & Problem-Solving
QUESTION # 1
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 2
EM
L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E
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
92
AS Computer Science Paper 4
1
Topic 24
Algorithm Design Methods
E®
RC
U
SO
RE
TS
N
DE
U
ST
93
AS Computer Science Paper 4
A2 1 Topic 24: Algorithm Design Methods
QUESTION # 1
EM
LE
SA
AN
N
AD
SOLUTION
QUESTION # 2
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 3
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 4
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
QUESTION # 5
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 6
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 7
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
QUESTION # 8
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 9
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 9
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 10
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 11
EM
LE
SA
AN
N
AD
SOLUTION
QUESTION # 12
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 13
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
160
AS Computer Science Paper 4
1
Topic 25
Recursion
E®
RC
U
SO
RE
TS
N
DE
U
ST
161
AS Computer Science Paper 4
A2 1 Topic 25: Recursion
QUESTION # 1
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 2
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
QUESTION # 3
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
QUESTION # 4
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
172
AS Computer Science Paper 4
A2 1
Topic 26
Further Programming
E®
RC
U
SO
RE
TS
N
DE
U
ST
173
AS Computer Science Paper 4
A2 1 Topic 26: Further programming
QUESTION # 1
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 2
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 3
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
QUESTION # 4
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 5
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
QUESTION # 6
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
198
AS Computer Science Paper 4
1
Topic 27
Object-Oriented Programming
(OOP)
E®
RC
U
SO
RE
TS
N
DE
U
ST
199
AS Computer Science Paper 4
A2 1 Topic: 27 Object-oriented programming (OOP)
QUESTION # 1
EM
LE
SA
A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
E®
RC
U
SO
RE
TS
N
QUESTION # 15
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
Topic 28
Low level Programming
E®
RC
U
SO
RE
TS
N
DE
U
ST
293
AS Computer Science Paper 4
A2 1 Topic 28: Low level programming
QUESTION # 1
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 2
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 3
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 4
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 5
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 6
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 7
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 8
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 9
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 10
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 11
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
Topic 29
Declarative Programming
E®
RC
U
SO
RE
TS
N
DE
U
ST
343
AS Computer Science Paper 4
A2 1 Topic 29: Declarative programming
QUESTION # 1
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 2
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 3
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 4
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 5
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 6
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 7
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
QUESTION # 8
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 9
EM
LE
SA
AN
N
AD
Topic 30
Software Development
E®
RC
U
SO
RE
TS
N
DE
U
ST
365
AS Computer Science Paper 4
A2 1 Topic 30: Software development
QUESTION # 1
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 2
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 3
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
QUESTION # 4
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
EM
LE
SA
AN
N
AD
QUESTION # 5
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 6
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 7
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 8
EM
LE
SA
AN
N
AD
SOLUTION
E®
RC
U
SO
RE
TS
N
DE
U
ST
QUESTION # 9
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
SOLUTION
QUESTION # 10
EM
LE
SA
AN
N
AD
SYLLABUS
Cambridge International AS and A Level
Computer Science
9608
For examination in June and November 2017, 2018 and 2019
This syllabus has been updated. The latest version is version 2, published May 2016.
Significant changes to the syllabus are indicated by black vertical lines either side of the text.
You are strongly advised to read the whole syllabus before planning your teaching
programme.
E®
RC
U
SO
RE
TS
N
DE
U
ST
Section Topics
1.7.1 Ethics
1.7.2 Ownership
LE
Language (DML)
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
4. Assessment at a glance
For Cambridge International AS and A Level Computer Science, candidates may choose:
• to take Papers 1, 2, 3 and 4 in the same examination series, leading to the full Cambridge International
A Level
• to follow a staged assessment route by taking Papers 1 and 2 (for the AS Level qualification) in one
series, then Papers 3 and 4 (for the full Cambridge International A Level) in a later series
• to take Papers 1 and 2 only (for the AS Level qualification).
Advanced Subsidiary (AS) forms 50% of the assessment weighting of the full Advanced (A) Level.
LE
1
SA
1
On receipt of estimated entry forms by the required date stated in the Administrative Guide, the
pre-release material for Paper 2 and Paper 4 will be made available to Centres the January before
AN
the June examination, and the July before the November examination. The material will be sent in hard
copy form. When the material has been received, it should be shared with the relevant teachers in the
Centre and issued to candidates immediately, as teachers and candidates need the material to prepare for
N
the examinations. Candidates are not permitted to bring any prepared material into the examination.
AD
AO2 Skills 5 20 5 20 50 50
6. Syllabus content
This syllabus is set out in the form of teaching sections. Each teaching section is assessed by its associated
paper. The AS Level syllabus consists of teaching Sections 1 and 2 only, and the A Level syllabus consists of
all four teaching sections.
1 1 Theory Fundamentals
3 3 Advanced Theory
E®
Each section is presented as a set of sub-sections, each with details of content and associated learning
SO
outcomes.
RE
TS
N
DE
U
ST
4.1.1 Abstraction
• show understanding of how to model a complex system by only including essential details, using:
– functions and procedures with suitable parameters (as in procedural programming, see
Section 2.3)
– ADTs (see Section 4.1.3)
– classes (as used in object-oriented programming, see Section 4.3.1)
– facts, rules (as in declarative programming, see Section 4.3.1)
4.1.2 Algorithms
• write a binary search algorithm to solve a particular problem
• show understanding of the conditions necessary for the use of a binary search
• show understanding of how the performance of a binary search varies according to the number of
data items
• write an algorithm to implement an insertion sort
• write an algorithm to implement a bubble sort
• show understanding that performance of a sort routine may depend on the initial order of the data
and the number of data items
• write algorithms to find an item in each of the following: linked list, binary tree, hash table
• write algorithms to insert an item into each of the following: stack, queue, linked list, binary tree,
hash table
• write algorithms to delete an item from each of the following: stack, queue, linked list
• show understanding that different algorithms which perform the same task can be compared by
using criteria such as time taken to complete the task and memory used
…
ENDTYPE
LE
built-in types or other ADTs: stack, queue, linked list, dictionary, binary tree
AN
N
AD
4.1.4 Recursion
• show understanding of the essential features of recursion
• show understanding of how recursion is expressed in a programming language
• trace recursive algorithms
• write recursive algorithms
• show understanding of when the use of recursion is beneficial
• show awareness of what a compiler has to do to implement recursion in a programming language
• describe facilities available in debuggers and how and when they should be deployed
N
AD
4.4.2 Testing
• show awareness of why errors occur
• show understanding of how testing can expose possible errors
• appreciate the significance of testing throughout software development
• show understanding of the methods of testing available: dry run, walkthrough, white-box,
black-box, integration, alpha, beta, acceptance
• show understanding of the need for a test strategy and test plan and their likely contents
• choose appropriate test data (normal, abnormal and extreme/boundary) for a test plan
E®
RC
U
SO
RE
TS
N
DE
U
ST
7. Description of components
The assessment is by written papers, but the learning should be done in a mainly practical way: problem-
solving and programming. Questions will require the candidate to think, use knowledge with understanding
and demonstrate understanding gained through practising practical skills.
The examination questions will require candidates to have practical programming experience, including
EM
writing their own programs, executing (running), testing and debugging them. Candidates are to be
encouraged to extend their practical programming beyond the scope of these tasks.It is appreciated that in
LE
an examination, candidates will not have access to a compiler, interpreter or any other aid to writing correct
syntax. Therefore, minor syntax errors in candidates’ programs will be ignored.
SA
AN
N
AD
In order to help us develop the highest quality Curriculum Support resources, we are
undertaking a continuous programme of review; not only to measure the success of our
resources but also to highlight areas for improvement and to identify new development needs.
9608
Paper 4
E®
RC
U
SO
RE
TS
N
DE
U
ST
Mark scheme
EM
LE
SA
AN
N
AD
Question 2
EM
LE
SA
AN
N
AD
Question 2, continued
Mark scheme
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
In part (b) the candidate knew that the variable ‘ThisCity’ would instantiate first to London and then to
Manchester.
In part (c) the candidate realised that the clauses ‘city_visited’ and ‘city_in_country’ are needed to find out
which countries the travel writer has visited. The candidate also realised that variables were required.
However, the variables for ‘city_in_country’ were not in the correct order as the second variable represents
the country and therefore needs to match the variable used in the head of the rule. The response then
continues as an imperative IF statement rather than the required declarative statement making a rule.
E®
RC
U
SO
RE
TS
N
DE
U
ST
In part (b) the candidate knew that the variable ‘ThisCity’ would instantiate first to London and then to
Manchester.
In part (c) the candidate realised that the clauses ‘city_visited’ and ‘city_in_country’ are needed to find out
which countries the travel writer has visited. The candidate also realised that variables were required.
However, the response is written as an imperative IF statement rather than the required declarative
statement representing a rule.
E®
RC
U
SO
RE
TS
N
Question 3
EM
LE
SA
AN
N
AD
Question 3, continued
E®
RC
U
SO
RE
TS
N
DE
U
ST
Mark scheme
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
In part (b) the candidate was able to distinguish which conditions could not be simplified. When the condition
that goods totalled more than $20 was not satisfied then all other conditions were irrelevant and so could be
replaced by a dash. So the candidate correctly replaced the four final columns in part (a) by just one column,
removing redundancies.
In part (c) the candidate used Visual Basic to answer this part. The function header included the parameters
but did not show the data type for the return value of the function. The candidate did not appreciate that a
local variable of the same name as the function is not possible. The candidate tried to deal with the last
column of the answer in part (b) first but did not realise that the opposite to testing for GoodsTotal > 20 is in
fact testing for GoodsTotal <= 20. The candidate used nested IF statements to some extent, but could have
improved on this rather than writing complex conditions involving AND.
Marks awarded for part (a)= 4/4 Marks awarded for part (b)= 5/5 Marks awarded for part (c) = 3/6
Total marks awarded = 12 out of 15
Example candidate response – middle
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
Marks awarded for part (a)= 3/4 Marks awarded for part (b)= 3/5 Marks awarded for part (c) = 2/6
Total marks awarded = 8 out of 15
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
In part (b) the response is a deduction from part (a). However, the candidate needed to check whether this
answer makes sense. The question stated that discount is only given when goods total more than $20. So
completing the first row with the ‘don’t care’ symbol is clearly incorrect.
In part (c) the candidate used Python to answer this part. The function header correctly showed the
parameters and the function body returns the calculated result. The question stated that the parameter
HasDiscountCard is Boolean. However, the candidate handles the parameter values as though they were
character values Y or N. The candidate does not check whether the goods total is over $20 but less than or
equal to $100.
Question 4
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
Mark scheme
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
In part (b) the candidate displayed some knowledge of how to declare a class in VB.Net. The class heading
and ending is correct and one method is provided, although three methods were required as part of the
question. The properties of a class should be declared using the keyword Private rather than Dim.
In parts (c)(i) and (ii) the candidate correctly states the extra properties required for the subclasses
HourlyPaidEmployee and SalariedEmployee. The candidate also realised that the method CalculatePay
needs to be redeclared for each of the subclasses.
In part (d) by stating ‘overriding’ the candidate demonstrates some understanding of what the question is
asking but this is not the correct term required here.
E®
RC
U
SO
RE
TS
N
DE
U
ST
In part (b) the candidate does not appear to have any knowledge of how to declare a class in VB.Net. The
answer given here is an attempt at the declaration of a record. The keyword Dim is not appropriate here.
In parts (c)(i) and (ii) the candidate included the properties required for the subclasses HourlyPaidEmployee
and SalariedEmployee as well as the inherited properties which did not need listing here. The candidate
misinterpreted the term ‘method’ and described how the calculation of pay should be performed rather than
giving the identifier of the subclass methods required.
In part (d) the candidate provides an object-oriented programming term that applies to all classes, not the
required term for methods that behave differently for different subclasses.
Question 5
E®
RC
U
SO
RE
TS
N
DE
U
ST
Question 5, continued
EM
LE
SA
AN
N
AD
Question 5, continued
E®
RC
U
SO
RE
TS
N
DE
U
ST
Mark scheme
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
In part (b)(i) the response here is not very clear. The candidate needs to state that each FOR loop will
RC
execute 9 times as they are not dependent on any condition. In part (b)(ii) the candidate demonstrates
excellent understanding of how a bubble sort operates and where changes are possible to improve
U
efficiency. The candidate realises that the outer loop can be changed to a conditional loop, so it terminates
SO
when there are no more changes, and the inner loop does not need to examine every element every time.
RE
With each iteration of the outer loop, another element will be in its correct position and therefore the upper
value of the FOR loop can be decreased.
TS
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
In parts (b)(i) and (ii) the candidate appears to have some understanding that for each iteration of the outer
LE
loop the inner loop is executed a set number of times. The misunderstanding that each loop iterates 8 times
rather than 9 times results in the answer of 64 rather than a total of 81 iterations. The candidate realised that
one way of making efficiency gains is to restrict the number of times the inner loop iterates for each iteration
SA
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
Therefore, when moving the contents of Temp to the correct location, (Pointer +1) must be used as index,
not ThisPointer. In part (a)(ii) the candidate understands that the WHILE loop is not entered when NameList
RC
is in order, although the explanation is a little too vague. The candidate recognises that the FOR loop will
always iterate 9 times.
U
SO
In parts (b)(i) and (ii) the candidate states that the inner FOR loop iterates 9 times. This is true, but it will do
so for each of the 9 times that the outer FOR loop iterates. The candidate seems to be unaware of this.
RE
Consequently the revised pseudocode is not an improved solution for the bubblesort algorithm. The only
th
difference to the original pseudocode is that the inner loop does not address the 9 element. This means that
TS
Question 6
EM
LE
SA
AN
N
AD
Question 6, continued
E®
RC
U
SO
RE
TS
N
DE
U
ST
Question 6, continued
EM
LE
SA
AN
N
AD
Question 6, continued
E®
RC
U
SO
RE
TS
N
DE
U
ST
Mark scheme
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
In part (b)(i) when the CreateQueue operation has been carried out, the queue is empty and all nodes are
part of the free list. The candidate correctly links all nodes with a null pointer in the final node. FreePointer
EM
correctly points to the first node in the free list and HeadPointer is the null pointer. However, as there is no
queue content, the tail pointer should also be a null pointer.In part (b)(ii) the candidate understands that
testing for an empty queue means testing for HeadPointer to be the null pointer. The candidate correctly
LE
initialises CurrentPointer and updates HeadPointer by following the pointer of the current node. The
candidate does not appreciate that if the last name in the queue has just been removed the head pointer
would now be null and therefore the tail pointer would also need to be set to null. Linking the released node
SA
to the free list means linking it to the front of the list that FreePointer is pointing to. The candidate correctly
updates FreePointer, but the released node is not linked to the front of the free list.
AN
E®
RC
U
SO
RE
TS
N
DE
U
ST
EM
LE
SA
AN
N
AD
In part (a) the candidate used the work space to draw the nodes in the queue at different points. The answer
in the node shapes shows the correct names and the pointers point to the correct nodes. The final node
containing the name Jatinder should have a null pointer. There are no pointers to show where the head and
tail of the queue are.
In part (b)(i) when the CreateQueue operation has been carried out, the queue is empty and all nodes are
part of the free list. The candidate correctly links all nodes. However, the final node does not contain a null
pointer but points back to the beginning of the free list. FreePointer correctly points to the first node in the
E®
free list. However, HeadPointer and TailPointer should be null pointers as there is no queue content. In part
(b)(ii) the candidate understands that testing for an empty queue means testing for HeadPointer to be the
RC
null pointer. The candidate correctly initialises CurrentPointer and updates HeadPointer by following the
pointer of the current node. The candidate does not appreciate that if the last name in the queue has just
U
been removed the head pointer would now be null and therefore the tail pointer would also need to be set to
SO
null. The candidate does not demonstrate that linking the released node to the free list means linking it to the
front of the list that FreePointer is pointing to, so the pointer of the released node and FreePointer need to be
RE
updated.
TS
EM
LE
SA
AN
N
AD
E®
RC
U
SO
RE
TS
N
DE
U
ST
In part (b)(i) when the CreateQueue operation has been carried out, the queue is empty and all nodes are
part of the free list. The candidate correctly links all nodes with a null pointer in the final node. FreePointer
correctly points to the first node in the free list and HeadPointer is a null pointer. However, as there is no
queue content, the tail pointer should also be a null pointer. The candidate seems to assume that if
FreePointer points to the first node in the array, the queue must be empty. This is true when the queue is
first initialised, but may not be true after names have been added and removed. In part (b)(ii), in a queue
EM
ADT, the node accessed for removal is always at the head of the queue, the candidate here wrongly uses
CurrentPointer, which does not yet have a value. The candidate correctly updates HeadPointer by following
LE
the pointer of the current node, but does not appreciate that if the last name in the queue has just been
removed the head pointer would now be null and therefore the tail pointer would also need to be set to null.
The candidate does not demonstrate that linking the released node to the free list means linking it to the front
SA
of the list that FreePointer is pointing to, so the pointer of the released node and FreePointer need to be
updated.
AN
For order: please call at: Stay update with new series
0321-4567519 / 0320-4567519 www.fb.me/students.resource
0313-4567519 / 0323-4567519
Or visit us at
www.studentsresource.net
Price List A Level
CIE A Level Rs:
Accounts Paper 1 Topical Unsolved 595
Accounts Paper 2 Topical Unsolved 950
Accounts Paper 3 Topical Unsolved 850
Business Topical Paper 1 (2002-2017) by Asif Iqbal 750
Business Topical Paper 2(2002-2017) by Asif Iqbal 795
Business Topical Paper 3(2002-2017) by Asif Iqbal 950
Biology Topical Unsolved Paper 1 by Rasheed Akhtar Chattha 750
Biology Topical Unsolved Paper 2 by Rasheed Akhtar Chattha 995
Biology Topical Unsolved Paper 4 by Rasheed Akhtar Chattha 995
Chemistry Topical Paper 1 by Niaz Ahmad Awan 750
Chemistry Topical Paper 2 by Niaz Ahmad Awan 950
Chemistry Topical Paper 4 by Niaz Ahmad Awan 995
Chemistry Paper 5 Worked Solution by Umar Zaman Khattak 550
Computer Science Topical P1-P2-P3-P4 by Adnan Saleem 2780
Computer Science P1-P2-P3-P4 Notes by Fawad Khan 1300
Economics Notes for AS Level by Rana Irfan Mahmood 550
Economics Notes for A2 Level by Rana Irfan Mahmood 550
Mathematics Paper 1 Topical Unsolved by Jawad Saeed 350
Mathematics Paper 3 Topical Unsolved by Jawad Saeed 350
Mathematics Paper 4 (M1) Topical Unsolved by Jawad Saeed 350
Mathematics Paper 6 (S1) Topical Unsolved by Jawad Saeed 350
Mathematics Paper 1 Notes by Ehsan ul Haq 450
Mathematics Paper 3 Notes by Ehsan ul Haq 450
Mathematics Paper 4 (M1) Notes by Ehsan ul Haq 450
Mathematics Paper 6 (S1) Notes by Ehsan ul Haq 450
Law (ELS) Paper 1 and Paper 2 Notes by Salik Aziz Vaince 945
Law (Contract of Law) Paper 3 Notes by Salik Aziz Vaince 1945
Law (Tort of Law) Paper 4 Notes by Salik Aziz Vaince 2000
Sociology Notes by Azhar Nazir (Anzway Editorial Board) 550
Sociology Notes by Akbar Saqi 550
Sociology Notes by Asmar Chaudhary 550
Sociology Notes by Azhar Nazir (Anzway) 550
Physics A Level (AS) Notes by Abdul Hakeem 350
Physics A Level (A2) Notes by Abdul Hakeem 350
Physics Topical Paper 1 by Abdul Hakeem 750
Physics Topical Paper 2 by Abdul Hakeem 950
Physics Topical Paper 4 by Afzal Ahmad 995
SAT Math Notes & Practice Book by Jawad Saeed (SJ) 750
SAT Math Notes & Practice Book by Rafique Akhtar Baloch 750
SAT-I Math & English 8 Latest Practice Test with Answer by SJ 1250
Rs: 795/-