Cambridge A Level Computer Science 9608 — 2018 May/June Paper 4 · Variant 2

9608/42/M/J/18 · 75 marks · ≈84 min

The question paper and its mark scheme, free to read here and free to download. This is Cambridge’s own paper, exactly as it was sat.

← All Computer Science papersWhat was in this paper?

Question paper24 pages

Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 1 of 24
Page 1 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 2 of 24
Page 2 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 3 of 24
Page 3 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 4 of 24
Page 4 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 5 of 24
Page 5 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 6 of 24
Page 6 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 7 of 24
Page 7 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 8 of 24
Page 8 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 9 of 24
Page 9 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 10 of 24
Page 10 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 11 of 24
Page 11 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 12 of 24
Page 12 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 13 of 24
Page 13 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 14 of 24
Page 14 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 15 of 24
Page 15 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 16 of 24
Page 16 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 17 of 24
Page 17 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 18 of 24
Page 18 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 19 of 24
Page 19 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 20 of 24
Page 20 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 21 of 24
Page 21 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 22 of 24
Page 22 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 23 of 24
Page 23 of 24
Cambridge A Level Computer Science 9608 2018 May/June Paper 4 · Variant 2 question paper, page 24 of 24
Page 24 of 24

Mark scheme21 pages

Answers below. Sit the paper first if you are practising.

Mark scheme, page 1 of 21
Page 1 of 21
Mark scheme, page 2 of 21
Page 2 of 21
Mark scheme, page 3 of 21
Page 3 of 21
Mark scheme, page 4 of 21
Page 4 of 21
Mark scheme, page 5 of 21
Page 5 of 21
Mark scheme, page 6 of 21
Page 6 of 21
Mark scheme, page 7 of 21
Page 7 of 21
Mark scheme, page 8 of 21
Page 8 of 21
Mark scheme, page 9 of 21
Page 9 of 21
Mark scheme, page 10 of 21
Page 10 of 21
Mark scheme, page 11 of 21
Page 11 of 21
Mark scheme, page 12 of 21
Page 12 of 21
Mark scheme, page 13 of 21
Page 13 of 21
Mark scheme, page 14 of 21
Page 14 of 21
Mark scheme, page 15 of 21
Page 15 of 21
Mark scheme, page 16 of 21
Page 16 of 21
Mark scheme, page 17 of 21
Page 17 of 21
Mark scheme, page 18 of 21
Page 18 of 21
Mark scheme, page 19 of 21
Page 19 of 21
Mark scheme, page 20 of 21
Page 20 of 21
Mark scheme, page 21 of 21
Page 21 of 21

Paper as text

Question paper, page 1

This document consists of 22 printed pages and 2 blank pages. DC (NH/SW) 148546/2 © UCLES 2018 [Turn over * 1 7 4 7 4 5 3 8 8 0 * COMPUTER SCIENCE 9608/42 Paper 4 Further Problem-solving and Programming Skills May/June 2018 2 hours Candidates answer on the Question Paper. No Additional Materials are required. No calculators allowed. READ THESE INSTRUCTIONS FIRST Write your Centre number, candidate number and name in the spaces at the top of this page. Write in dark blue or black pen. You may use an HB pencil for any diagrams, graphs or rough working. Do not use staples, paper clips, glue or correction fluid. DO NOT WRITE IN ANY BARCODES. Answer all questions. No marks will be awarded for using brand names of software packages or hardware. At the end of the examination, fasten all your work securely together. The number of marks is given in brackets [ ] at the end of each question or part question. The maximum number of marks is 75. Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level

Question paper, page 2

2 9608/42/M/J/18 © UCLES 2018 1 Paul is using an application (app) called CAMplus. The app allows users to: • log in • create a new collection of photographs • use the camera to take new photographs • automatically add new photographs to the new collection • share the new collection with other users • start another collection or log out of the app. The following JSP structure diagram represents the operation of CAMplus. CAMplus Log out Add user Add to collection Log in Create a collection * * * Add photo to collection Take photo Create collections

Question paper, page 3

3 9608/42/M/J/18 © UCLES 2018 [Turn over (a) An algorithm has been written in pseudocode to represent the Create collections operation from the JSP structure diagram. The algorithm is incomplete. Write pseudocode to complete this algorithm. REPEAT REPEAT CALL TakePhoto … OUTPUT "Do you want to take another photo?" INPUT AddPhoto UNTIL AddPhoto = "No" REPEAT … OUTPUT "Do you want to add another user?" INPUT NewUser UNTIL … = "No" OUTPUT "Do you want to create another collection?" … UNTIL NewCollection = "No" [4]

Question paper, page 4

4 9608/42/M/J/18 © UCLES 2018 (b) The app is updated. Paul can now add and delete photos from chosen collections. Paul can also delete collections. Complete the JSP structure diagram to show the changes. CAMplus Log out Log in Manage a collection * Create a collection O Manage collections * * Add to collection Add user [5]

Question paper, page 5

5 9608/42/M/J/18 © UCLES 2018 [Turn over Question 2 begins on the next page.

Question paper, page 6

6 9608/42/M/J/18 © UCLES 2018 2 A declarative language is used to represent the following facts and rules about iguanas and lizards. 01 has(reptile, cold_blood). 02 has(reptile, air_breathing). 03 has(reptile, scales). 04 05 is_a(squamata, reptile). 06 is_a(iguana, squamata). 07 is_a(lizard, squamata). 08 is_a(green_iguana, iguana). 09 is_a(cayman, iguana). 10 is_a(smooth_iguana, iguana). 11 12 maxsize(green_iguana, 152). 13 maxsize(cayman, 90). 14 maxsize(smooth_iguana, 70). These clauses have the following meaning: Clause Explanation 01 A reptile has cold blood. 09 A cayman is a type of iguana. 12 The maximum size of a green iguana is 152 cm. (a) More facts are to be included. A gecko is a type of lizard. It has a maximum size of 182 cm. Write the additional clauses to record these facts. 15 … 16 … [2]

Question paper, page 7

7 9608/42/M/J/18 © UCLES 2018 [Turn over (b) Using the variable R, the goal is_a(R, squamata). returns R = iguana, lizard Write the result returned by the goal is_a(T, iguana). T = …[2] (c) Write the goal, using the variable X, to find what a squamata is. …[2] (d) All iguanas and lizards are squamata. All squamata are reptiles. Write a recursive rule to make all lizards and iguanas inherit the properties of reptiles. has(X, Y) IF … …[3] (e) State what the following goal returns. NOT(maxsize(cayman, 70)). …[1]

Question paper, page 8

8 9608/42/M/J/18 © UCLES 2018 3 The arrays PollData[1:10] and CardData[1:10] store data. PollData 12 85 52 57 25 11 33 59 56 91 CardData 11 12 25 33 52 56 57 59 91 85 An insertion sort sorts these data. (a) State why it will take less time to complete an insertion sort on CardData than on PollData. … …[1] (b) The following pseudocode algorithm performs an insertion sort on the CardData array. Complete the following pseudocode algorithm. 01 ArraySize ← 10 02 FOR Pointer ← 2 TO … 03 ValueToInsert ← CardData[Pointer] 04 HolePosition ← … 05 WHILE (HolePosition > 1 AND (… > … )) 06 CardData[HolePosition] ← CardData[ …] 07 HolePosition ← … 08 ENDWHILE 09 CardData[HolePosition] ← … 10 ENDFOR [7]

Question paper, page 9

9 9608/42/M/J/18 © UCLES 2018 [Turn over (c) (i) A binary search algorithm is used to find a specific value in an array. Explain why an array needs to be sorted before a binary search algorithm can be used. … … … … … … … …[2] (ii) The current contents of CardData are shown. 11 12 25 33 52 56 57 59 85 91 Explain how a binary search will find the value 25 in CardData. … … … … … … … … … … … … … … …[4]

Question paper, page 10

10 9608/42/M/J/18 © UCLES 2018 (d) Complete this procedure to carry out a binary search on the array shown in part (c)(ii). PROCEDURE BinarySearch(CardData, SearchValue) DECLARE Midpoint : INTEGER First ← 1 Last ← ARRAYLENGTH( …) Found ← FALSE WHILE (First <= Last) AND NOT(Found) Midpoint ← … IF CardData[Midpoint] = SearchValue THEN Found ← TRUE ELSE IF SearchValue < CardData[Midpoint] THEN Last ← … ELSE First ← … ENDIF ENDIF ENDWHILE ENDPROCEDURE [4]

Question paper, page 11

11 9608/42/M/J/18 © UCLES 2018 [Turn over Question 4 begins on the next page.

Question paper, page 12

12 9608/42/M/J/18 © UCLES 2018 4 X-Games is an international extreme sports competition. A program will store and process data about the teams in the competition. • Each team is made up of members. • Members can be added and removed from each team. • Each member has a first name, last name, date of birth and gender. • Each member can be an official or a competitor. • Each official has a job title and may be first-aid trained. • Each competitor takes part in one sport. The program is written using object-oriented programming. The program can output the full name and date of birth of any member. For example, “Nadia Abad 16/05/1995” An introduction about a team member can be output using their name. For example, “Hello, I’m Nadia Abad”. The program outputs a different version of the introduction for a competitor. This version includes the competitor’s sport. For example, “Hello, I’m Sally Jones and my sport is Skateboard Park.”

Question paper, page 13

13 9608/42/M/J/18 © UCLES 2018 [Turn over (a) Complete the following class diagram to show the attributes, methods and inheritance for the program. You do not need to write the get and set methods. Member Team FirstName : STRING LastName : STRING DateOfBirth : DATE Gender : STRING TeamName : STRING TeamList : ARRAY OF Member Constructor() Introduction() DisplayFullnameAndDateOfBirth() Constructor() … … Competitor Official Sport : STRING … … Constructor() Introduction() Constructor() DisplayJobTitle() [3]

Question paper, page 14

14 9608/42/M/J/18 © UCLES 2018 (b) Write program code for the Member class. Programming language … Program code … … … … … … … … … … … … … … … … … … … … … … …[5]

Question paper, page 15

15 9608/42/M/J/18 © UCLES 2018 [Turn over (c) Write program code for the Competitor class. Programming language … Program code … … … … … … … … … … … … … … … … … … … … … … …[5]

Question paper, page 16

16 9608/42/M/J/18 © UCLES 2018 (d) Omar Ellaboudy is an official at X-Games. He is first-aid trained and his job title is Judge. He is male and was born on 17/03/1993. Write program code to create an instance of an object with the identifier BMXJudge. All attributes of the instance must be fully initialised. Programming language … Program code … … … … … …[3]

Question paper, page 17

17 9608/42/M/J/18 © UCLES 2018 [Turn over Question 5 begins on the next page.

Question paper, page 18

18 9608/42/M/J/18 © UCLES 2018 5 A company is developing an application program. The project manager has been asked to create a work breakdown schedule for the project as follows: Activity Days to complete Predecessor activity A Gather User Requirements 6 B Design work 4 A C Develop server code 4 B D Develop application code 5 B E User Interface Development 6 B F Test server code 2 C G Test application 2 D, E H Test application/server integration 6 F, G I Roll out mobile application 6 H (a) A GANTT chart is created from the work breakdown schedule. Activities A and B have already been added to the chart. Complete the GANTT chart. Activity A B C D E F G H I Day number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [5] (b) State which activities can run in parallel on the following days. (i) Day 14 …[1] (ii) Day 16 …[1]

Question paper, page 19

19 9608/42/M/J/18 © UCLES 2018 [Turn over (c) Explain how the project manager will use the GANTT chart to make sure the project is completed on time. … … … …[2]

Question paper, page 20

20 9608/42/M/J/18 © UCLES 2018 6 An Abstract Data Type (ADT) is used to create an unordered binary tree. The binary tree is created as an array of nodes. Each node consists of a data value and two pointers. A record type, Node, is declared using pseudocode. TYPE Node DECLARE DataValue : STRING DECLARE LeftPointer : INTEGER DECLARE RightPointer : INTEGER ENDTYPE The following statement declares an array BinaryTree. DECLARE BinaryTree : ARRAY[0:14] OF Node A variable, NextNode, points to the next free node. The following diagram shows a possible node. "Red" 1 2 0 ArrayIndex DataValue LeftPointer RightPointer The commands in the following table create and add nodes to the binary tree. Command Comment CreateTree(NodeData) Sets NextNode to 0. Writes NodeData into DataValue at the position NextNode Updates NextNode using NextNode = NextNode + 1 AttachLeft(NodeData, ParentNode) Writes NodeData into DataValue of NextNode Sets the LeftPointer of node ParentNode to NextNode Updates NextNode using NextNode = NextNode + 1 AttachRight(NodeData, ParentNode) Writes NodeData into DataValue of NextNode Sets the RightPointer of node ParentNode to NextNode Updates NextNode using NextNode = NextNode + 1

Question paper, page 21

21 9608/42/M/J/18 © UCLES 2018 [Turn over (a) The following commands are executed. CreateTree("Red") AttachLeft("Blue", 0) AttachRight("Green", 0) The following diagram shows the current state of the binary tree. "Red" 1 2 0 "Green" 2 "Blue" 1 … … … … … … … … … … … … Write on the diagram to show the state of the binary tree after the following commands have been executed. AttachRight("Black", 2) AttachLeft("Brown", 2) AttachLeft("Peach", 3) AttachLeft("Yellow", 1) AttachRight("Purple", 1) AttachLeft("White", 6) AttachLeft("Pink", 7) AttachLeft("Grey", 9) AttachRight("Orange", 9) [5]

Question paper, page 22

22 9608/42/M/J/18 © UCLES 2018 (b) A new command has been added to initialise the pointers of the binary tree to − 1 to indicate they are not in use. A leaf is a node of the binary tree which has no children. In the case of this binary tree, a node with a LeftPointer of − 1 and a RightPointer of − 1 is a leaf. Write a recursive function, in program code, to traverse the binary tree and output the value of DataValue for each leaf node. Programming language … Program code … … … … … … … … … … … … … … … … … … … … … …[8]

Question paper, page 23

23 9608/42/M/J/18 © UCLES 2018 BLANK PAGE

Question paper, page 24

24 9608/42/M/J/18 © UCLES 2018 Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity. To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge International Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after the live examination series. Cambridge International Examinations 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. BLANK PAGE

Mark scheme, page 1

IGCSE™ is a registered trademark. This document consists of 21 printed pages. © UCLES 2018 [Turn over Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/42 Paper 4 Written Paper May/June 2018 MARK SCHEME Maximum Mark: 75 Published This mark scheme is published as an aid to teachers and candidates, to indicate the requirements of the examination. It shows the basis on which Examiners were instructed to award marks. It does not indicate the details of the discussions that took place at an Examiners’ meeting before marking began, which would have considered the acceptability of alternative answers. Mark schemes should be read in conjunction with the question paper and the Principal Examiner Report for Teachers. Cambridge International will not enter into discussions about these mark schemes. Cambridge International is publishing the mark schemes for the May/June 2018 series for most Cambridge IGCSE™, Cambridge International A and AS Level and Cambridge Pre-U components, and some Cambridge O Level components.

Mark scheme, page 2

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 2 of 21 Generic Marking Principles These general marking principles must be applied by all examiners when marking candidate answers. They should be applied alongside the specific content of the mark scheme or generic level descriptors for a question. Each question paper and mark scheme will also comply with these marking principles. GENERIC MARKING PRINCIPLE 1: Marks must be awarded in line with: • the specific content of the mark scheme or the generic level descriptors for the question • the specific skills defined in the mark scheme or in the generic level descriptors for the question • the standard of response required by a candidate as exemplified by the standardisation scripts. GENERIC MARKING PRINCIPLE 2: Marks awarded are always whole marks (not half marks, or other fractions). GENERIC MARKING PRINCIPLE 3: Marks must be awarded positively: • marks are awarded for correct/valid answers, as defined in the mark scheme. However, credit is given for valid answers which go beyond the scope of the syllabus and mark scheme, referring to your Team Leader as appropriate • marks are awarded when candidates clearly demonstrate what they know and can do • marks are not deducted for errors • marks are not deducted for omissions • answers should only be judged on the quality of spelling, punctuation and grammar when these features are specifically assessed by the question as indicated by the mark scheme. The meaning, however, should be unambiguous. GENERIC MARKING PRINCIPLE 4: Rules must be applied consistently e.g. in situations where candidates have not followed instructions or in the application of generic level descriptors.

Mark scheme, page 3

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 3 of 21 GENERIC MARKING PRINCIPLE 5: Marks should be awarded using the full range of marks defined in the mark scheme for the question (however; the use of the full mark range may be limited according to the quality of the candidate responses seen). GENERIC MARKING PRINCIPLE 6: Marks awarded are based solely on the requirements as defined in the mark scheme. Marks should not be awarded with grade thresholds or grade descriptors in mind.

Mark scheme, page 4

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 4 of 21 Question Answer Marks 1(a) 1 mark for each correctly completed pseudocode line to max 4 01 REPEAT 02 CALL TakePhoto 03 CALL AddPhotoToCollection 04 OUTPUT "Do you want to take another photo?" 05 INPUT AddPhoto 06 UNTIL AddPhoto = "No" 07 REPEAT 08 CALL AddUser 09 OUTPUT "Do you want to add another user?" 10 INPUT NewUser 11 UNTIL NewUser = "No" 12 OUTPUT "Do you want to create another collection?" 13 INPUT NewCollection 14 UNTIL NewCollection = "No" 4

Mark scheme, page 5

960 © U Q 08/42 CLES 2018 uestion 1(b) 1 ma • E • M • D • b • a ark per bullet: Edit a collection Manage photos Delete a collectio both add and rem appropriate sele Ca // Choose a coll on move a photo // ection and iteratio ambridge Interna lection // Select add to collection on in all boxes ational AS/A Lev PUBLISHED Page 5 of 21 Answer a collection n, delete to colle vel – Mark Sche ection me May/June 2 Mar 018 rks 5

Mark scheme, page 6

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 6 of 21 Question Answer Marks 2(a) 1 mark for each statement 15 is_a(gecko, lizard). 16 maxsize(gecko, 182). 2 2(b) 1 mark for 2 results 2 marks for 3 correct results green_iguana, cayman, smooth_iguana 2 2(c) 1 mark per bullet • is_a used with brackets () • squamata, X in correct order is_a(squamata, X). 2 2(d) 1 mark for each bullet to max 3 • is_a(X, Z) • and // , has(Z, Y). is_a(X, Z) AND has(Z, Y). 3 2(e) YES 1

Mark scheme, page 7

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 7 of 21 Question Answer Marks 3(a) CardData is partially sorted/ordered // more items in order/sorted 1 3(b) 1 mark for each correct statement 01 ArraySize ← 10 02 FOR Pointer ← 2 TO ArraySize // 10 03 ValueToInsert ← CardData[Pointer] 04 HolePosition ← Pointer 05 WHILE(HolePosition>1 AND(CardData[HolePosition - 1] > ValueToInsert)) 06 CardData[HolePosition] ← CardData[HolePosition – 1] 07 HolePosition ← HolePosition – 1 08 ENDWHILE 09 CardData[HolePosition] ← ValueToInsert 10 ENDFOR 7 3(c)(i) 1 mark per bullet to max 2 • It doesn’t check every value • The midpoint is the middle element, not the middle numerical value • When the higher/lower elements are discarded they will not be the higher/lower elements • It might discard the value you are looking for 2 3(c)(ii) 1 mark per bullet to max 4. Max 2 marks if no relation to CardData values. • Find mid-point and comparison // 25 is smaller than/compared to 52/56 • Discard/ignore greater // change upper bound to 33/52/midpoint - 1 //e.g. right hand side // only use array elements 1 - 4/5 • Find and compare to mid-point of new list e.g. 12/25 • Value is the midpoint // Continue until value found 4

Mark scheme, page 8

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 8 of 21 Question Answer Marks 3(d) 1 mark for each complete statement PROCEDURE BinarySearch(CardData, SearchValue) DECLARE Midpoint : INTEGER First ← 1 Last ← ARRAYLENGTH(CardData) Found ← FALSE WHILE (First <= Last) AND NOT(Found) Midpoint ← (First + Last) \ 2 IF CardData[Midpoint] = SearchValue THEN Found ← TRUE ELSE IF SearchValue < CardData[Midpoint] THEN Last ← Midpoint - 1 ELSE First ← Midpoint + 1 ENDIF ENDIF ENDWHILE ENDPROCEDURE 4

Mark scheme, page 9

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 9 of 21 Question Answer Marks 4(a) 1 mark per bullet: • Team methods • Official attributes • Two inheritance arrows or containment Member Team FirstName: STRING LastName: STRING DateOfBirth: DATE Gender: STRING TeamName: STRING TeamList: ARRAY OF Member Constructor() Introduction() DisplayFullnameAndDateOfBirth() Constructor() AddMember() DeleteMember() Competitor Official Sport: STRING JobTitle: STRING FirstAidTrained: BOOLEAN/STRING Constructor() Introduction() Constructor() DisplayJobTitle() 3

Mark scheme, page 10

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 10 of 21 Question Answer Marks 4(b) 1 mark per bullet to max 5 • class declaration • FirstName, LastName, DateOfBirth and Gender all defined as private • constructor declaration • «all four attributes assigned values from parameters • (Public) method for Introduction • «outputs message with FirstName and LastName attributes // returns FirstName and LastName • Public method for DisplayFullNameAndDateofbirth • « outputs message with FirstName, LastName and DateOfBirth // returns FirstName, LastName, DateOfBirth Python example code: class Member: def __init__(self, Fname, Lname, DOB, GenderVal): self.__FirstName = Fname self.__LastName = Lname self.__DateOfBirth = DOB self.__Gender = GenderVal def Introduction(self): return "Hello, I am ", self.__FirstName, " ", self.LastName def DisplayFullnameAndDateofbirth(self): print self.__FirstName, self.__LastName, self.__DateOfBirth 5

Mark scheme, page 11

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 11 of 21 Question Answer Marks 4(b) Visual Basic example code: Class Member Private Firstname As String Private Lastname As String Private DateOfBirth As Date Private Gender As String Public Sub New(ByVal Fname As String,ByVal Lname As String, ByVal DOB As Date, ByVal GenderVal As String) Firstname = Fname Lastname = Lname DateOfBirth = DOB Gender = GenderVal End Sub Public Function Introduction() As String Dim Message As String Message = "Hello, I am " + Firstname + " " + Lastname + " " + DateOfBirth Return Message End Function Public Function DisplayFullNameAndDateOfBirth As String DisplayFullNameAndDateOfBirth = Firstname + " " + Lastname + " " + DateOfBirth End Function End Class

Mark scheme, page 12

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 12 of 21 Question Answer Marks 4(b) Pascal example code: type Member = class private Firstname : string; Lastname : string; DateOfBirth : date; Gender : string; public constructor Create(Fname, Lname, Gend, DBirth : string); function Introduction() : string; function DisplayFullNameAndDateOfBirth() : string; constructor Member.Create(Fname, Lname, Gend, DBirth : string); begin Firstname := Fname LastName := Lname Gender := Gend DateOfBirth := DBirth end; function Member.Introduction() : String; begin Introduction := "Hello, I am " + Firstname + " " + Lastname end; function Member.DisplayFullNameAndDateOfBirth As String; begin; DisplayFullNameAndDateOfBirth = Firstname + " " + Lastname + " " + DateOfBirth end;

Mark scheme, page 13

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 13 of 21 Question Answer Marks 4(c) 1 mark per bullet to max 5 • Class declaration that inherits from Member • Constructor declaration taking all five parameters • «that inherits from Member • Declaration of Sport as private String • «. and assigning to parameter • Introduction method declaration (with polymorphism) • «returning/outputting message with FirstName, LastName and Sport variables Python example code: class Competitor(Member): def __init__(self, Fname, Lname, DOB, GenderVal, MySport): Member.__init__(self, Fname, Lname, DOB, GenderVal) self.__Sport = MySport def Introduction(self): print "Hello, I am %s %s and my sport is %s" % (self.FirstName, self.LastName, self.__Sport) 5

Mark scheme, page 14

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 14 of 21 Question Answer Marks 4(c) Visual Basic example code: Class Competitor Inherits Member Private Sport As String Public Sub New(ByVal Fname As String,ByVal Lname As String, ByVal DOB As Date, ByVal GenderVal As String, ByVal SportVal As String) MyBase.New(Fname, Lname, DOB, GenderVal) Sport = SportVal End Sub Public Overloads Function Introduction() As String Dim Message As String Message = "Hello, I am " + Firstname + " " + Lastname + " and my sport is " + Sport Return Message End Function End Class

Mark scheme, page 15

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 15 of 21 Question Answer Marks 4 (c) Pascal example code: type Competitor = class(Member) private Sport : String; public Constructor init(Fname, Lname: String; DOB: Date; GenderVal, Sport:String); Function Introduction() : String; end; Constructor Competitor.initFname, Lname: String; DOB: Date; GenderVal, SportVal:String); begin inherited init(Fname, Lname, DOB, GenderVal); Sport := SportVal; end; Function Competitor.Introduction(); begin Result:= "Hello, I am " + Firstname + " " + Lastname + " and my sport is " + Sport end;

Mark scheme, page 16

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 16 of 21 Question Answer Marks 4(d) 1 mark per bullet • variable BMXJudge assigned value • call Official • with all 6 parameters assigned correctly Python example code: BMXJudge = Official("Omar", "Ellaboudy", "17/03/1993", "Male", true, "Judge") Visual Basic example code: BMXJudge = New Official("Omar", "Ellaboudy", "17/03/1993", "Male, true, "Judge") Pascal example code: BMXJudge := Official("Omar", "Ellaboudy", "17/03/1993", "Male", true, "Judge") 3

Mark scheme, page 17

960 © U Q 5 08/42 CLES 2018 uestion 5(a) 1 ma • C • F • G • H • I 5(b)(i) C, D, 5(b)(ii) E, F ark per bullet C/D/E in parallel F with dependen G with dependen H with correct de I with dependenc , E Ca l starting after B ncy on C and co ncy on D and E ependency on F cy on H ambridge Interna , with correct du orrect duration with correct dur F and G ational AS/A Lev PUBLISHED Page 17 of 21 Answer urations. ration vel – Mark Scheme May/June 2 Mar 018 rks 5 1 1

Mark scheme, page 18

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 18 of 21 Question Answer Marks 5(c) 1 mark per bullet to max 2 For example: • Check if the project is on track • «so the project manager can intervene if behind • lets you identify slack time to • «reallocate resources to support the process • find critical path • «to ensure activities are given correct priority • see when tasks end • ...to plan the next tasks • see which tasks can run in parallel • set milestones/goals • check correct tasks are being carried out on current day • Calculate latest start time • Calculate earliest finish time • Calculate latest start time for a task 2

Mark scheme, page 19

960 © U Q 08/42 CLES 2018 uestion 6(a) 1 ma • B • Y • P • W • G ark per bullet Brown left and b Yellow left and P Peach left come White left from 6 Grey left from 9 Ca black right from n Purple right from es from 3 6 and Pink left fr and orange righ ambridge Interna node 2 m node 1 rom 7 ht from 9 ational AS/A Lev PUBLISHED Page 19 of 21 Answer vel – Mark Scheme May/June 2 Mar 018 rks 5

Mark scheme, page 20

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 20 of 21 Question Answer Marks 6(b) 1 mark for outputting all the leaf data values • Outputting BinaryTree[CurrentNode].DataValue only when both LeftPointer and RightPointer are -1 1 mark per bullet to max 7 • Function declaration • «taking CurrentNode or equivalent as parameter • Check if BinaryTree[CurrentNode].LeftPointer is not -1 « • « recursive call « • «with left pointer value as parameter • Check if BinaryTree[CurrentNode].RightPointer is not -1« • « recursive call« • « with right pointer value as parameter Python example code: def FindLeaves(CurrentNode): global BinaryTree if(BinaryTree[CurrentNode].LeftPointer != -1): FindLeaves(BinaryTree[CurrentNode].LeftPointer) if(BinaryTree[CurrentNode].RightPointer != -1): FindLeaves(BinaryTree[CurrentNode].RightPointer) if((BinaryTree[CurrentNode].RightPointer == -1) and (BinaryTree[CurrentNode].LeftPointer == -1)): print BinaryTree[CurrentNode].DataValue return 8

Mark scheme, page 21

9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED May/June 2018 © UCLES 2018 Page 21 of 21 Question Answer Marks 6(b) Visual Basic example code: Procedure FindLeaves(CurrentNode): if(BinaryTree[CurrentNode].LeftPointer <> -1) then FindLeaves(BinaryTree[CurrentNode].LeftPointer) End if if(BinaryTree[CurrentNode].RightPointer <> -1) then FindLeaves(BinaryTree[CurrentNode].RightPointer) end if if ((BinaryTree[CurrentNode].RightPointer = -1) and (BinaryTree[CurrentNode].LeftPointer = -1)) then Console.WriteLine(BinaryTree[CurrentNode].DataValue) End if End Procedure Pascal example code: Procedure FindLeaves(CurrentNode); Begin if(BinaryTree[CurrentNode].LeftPointer <> -1) then FindLeaves(BinaryTree[CurrentNode].LeftPointer); if(BinaryTree[CurrentNode].RightPointer <> -1): FindLeaves(BinaryTree[CurrentNode].RightPointer); if((BinaryTree[CurrentNode].RightPointer = -1) and (BinaryTree[CurrentNode].LeftPointer = -1)) then print (BinaryTree[CurrentNode].DataValue); End;

What you needed in this session

Cambridge’s own grade thresholds for 2018 May/June, Paper 4 · Variant 2. A higher threshold means an easier paper — the bar moves with how the cohort did.

A55/75
B48/75
C40/75
D32/75
E25/75