Cambridge A Level Computer Science 9608 — 2016 Oct/Nov Paper 4 · Variant 2

9608/42/O/N/16 · 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 paper20 pages

Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 1 of 20
Page 1 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 2 of 20
Page 2 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 3 of 20
Page 3 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 4 of 20
Page 4 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 5 of 20
Page 5 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 6 of 20
Page 6 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 7 of 20
Page 7 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 8 of 20
Page 8 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 9 of 20
Page 9 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 10 of 20
Page 10 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 11 of 20
Page 11 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 12 of 20
Page 12 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 13 of 20
Page 13 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 14 of 20
Page 14 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 15 of 20
Page 15 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 16 of 20
Page 16 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 17 of 20
Page 17 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 18 of 20
Page 18 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 19 of 20
Page 19 of 20
Cambridge A Level Computer Science 9608 2016 Oct/Nov Paper 4 · Variant 2 question paper, page 20 of 20
Page 20 of 20

Mark scheme13 pages

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

Mark scheme, page 1 of 13
Page 1 of 13
Mark scheme, page 2 of 13
Page 2 of 13
Mark scheme, page 3 of 13
Page 3 of 13
Mark scheme, page 4 of 13
Page 4 of 13
Mark scheme, page 5 of 13
Page 5 of 13
Mark scheme, page 6 of 13
Page 6 of 13
Mark scheme, page 7 of 13
Page 7 of 13
Mark scheme, page 8 of 13
Page 8 of 13
Mark scheme, page 9 of 13
Page 9 of 13
Mark scheme, page 10 of 13
Page 10 of 13
Mark scheme, page 11 of 13
Page 11 of 13
Mark scheme, page 12 of 13
Page 12 of 13
Mark scheme, page 13 of 13
Page 13 of 13

Paper as text

Question paper, page 1

This document consists of 17 printed pages and 3 blank pages. DC (LEG/SW) 115870/4 © UCLES 2016 [Turn over Cambridge International Examinations Cambridge International Advanced Level * 4 5 3 0 7 7 3 2 0 8 * COMPUTER SCIENCE 9608/42 Paper 4 Further Problem-solving and Programming Skills October/November 2016 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.

Question paper, page 2

2 9608/42/O/N/16 © UCLES 2016 1 The ticket machine in the following diagram accepts the following coins: 10, 20, 50 and 100 cents. The ticket machine has: • a slot to insert coins • a tray to return coins • a ticket dispenser • two buttons: • button A (Accept) • button C (Cancel) Coin return tray Ticket dispenser $ & Coin Slot When the user has inserted as many coins as required, they press button A to print the ticket. To cancel the transaction, the user can press button C. This makes the machine return the coins. Invalid coins have no effect.

Question paper, page 3

3 9608/42/O/N/16 © UCLES 2016 [Turn over The following state transition table shows the transition from one state to another of the ticket machine: Current state Event Next state Idle Coin inserted Counting Counting Coin inserted Counting Counting Button C pressed Cancelled Cancelled Coins returned Idle Counting Button A pressed Accepted Accepted Ticket printed Idle (a) Complete the state-transition diagram. start Coin inserted Coins returned Cancelled … … … … … … … [7]

Question paper, page 4

4 9608/42/O/N/16 © UCLES 2016 (b) A company wants to simulate the use of a ticket machine. It will do this with object-oriented programming (OOP). The following diagram shows the design for the class TicketMachine. This includes its attributes and methods. TicketMachine Amount : INTEGER // total value of coins inserted in cents State : STRING // "Idle", "Counting", "Cancelled" // or "Accepted" Create() // method to create and initialise an object // if using Python use __init__ SetState() // set state to parameter value // and output new state StateChange() // insert coin or press button, // then take appropriate action CoinInserted() // parameter is a string // change parameter to integer // and add coin value to Amount ReturnCoins() // output Amount, then set Amount to zero PrintTicket() // print ticket, then set Amount to zero Write program code for the following methods. Programming language … (i) Create() … … … … …[3] (ii) SetState() … … … …[2]

Question paper, page 5

5 9608/42/O/N/16 © UCLES 2016 [Turn over (iii) ReturnCoins() … … … … [2] (iv) Each coin inserted must be one of the following: 10, 20, 50 or 100 cents. Write program code for a function ValidCoin(s : STRING) that returns: • TRUE if the input string is one of "10", "20", "50" or "100" • FALSE otherwise Programming language … … … … … … … … … … …[3] (v) Write program code for the method CoinInserted() … … … … …[2]

Question paper, page 6

6 9608/42/O/N/16 © UCLES 2016 (vi) Convert the flowchart to program code for the method StateChange(). Use the attributes and methods in the original class definition and the ValidCoin() function from part (iv). METHOD StateChange INPUT NewInput Is NewInput = 'C'? Yes Yes No No No No No Yes Yes Yes Is State = "Counting"? CALL SetState("Cancelled") CALL ReturnCoins() Is NewInput = 'A'? Is Amount = 0? OUTPUT "No coins inserted" CALL SetState("Accepted") CALL PrintTicket() Is NewInput a valid coin? CALL CoinInserted(NewInput) CALL SetState("Counting") CALL SetState("Idle") OUTPUT "Error – not a valid coin" ENDMETHOD

Question paper, page 7

7 9608/42/O/N/16 © UCLES 2016 [Turn over Programming language … … … … … … … … … … … … … … … … … … … … … … … … … … … … …[12]

Question paper, page 8

8 9608/42/O/N/16 © UCLES 2016 (vii) The company needs to write a program to simulate a parking meter. The program will create an object with identifier ParkingMeter, which is an instance of the class TicketMachine. The main program design is: instantiate ParkingMeter (create and initialise ParkingMeter) loop forever (continually use ParkingMeter) call StateChange() method end loop Write program code for the main program. Programming language … … … … … … … … … …[4]

Question paper, page 9

9 9608/42/O/N/16 © UCLES 2016 [Turn over (c) It is possible to declare attributes and methods as either public or private. A programmer has modified the class design for TicketMachine as follows. TicketMachine PRIVATE Amount : INTEGER State : STRING PUBLIC Create() StateChange() PRIVATE SetState() CoinInserted() ReturnCoins() PrintTicket() (i) Describe the effects of declaring the TicketMachine attributes as private. … … … …[2] (ii) Describe the effects of declaring two methods of the class as public and the other four as private. … … … …[2]

Question paper, page 10

10 9608/42/O/N/16 © UCLES 2016 2 Commercial software usually undergoes alpha testing and beta testing. Distinguish between the two types of testing by stating: • who does the testing • when the testing occurs • the specific purpose of each type of testing (i) Alpha testing Who … … When … … Purpose … …[3] (ii) Beta testing Who … … When … … Purpose … …[3] 3 (a) The numerical difference between the ASCII code of an upper case letter and the ASCII code of its lower case equivalent is 32 denary (3210). For example, 'F' has ASCII code 70 and 'f' has ASCII code 102. Bit number 7 6 5 4 3 2 1 0 ASCII code ASCII code in binary 70 0 1 0 0 0 1 1 0 102 0 1 1 0 0 1 1 0 The bit patterns differ only at bit number 5. This bit is 1 if the letter is lower case and 0 if the letter is upper case.

Question paper, page 11

11 9608/42/O/N/16 © UCLES 2016 [Turn over (i) A program needs a mask to ensure that a letter is in upper case. Write the binary pattern of the mask in the space provided in the table below. Bit number 7 6 5 4 3 2 1 0 ASCII code ASCII code in binary 70 0 1 0 0 0 1 1 0 102 0 1 1 0 0 1 1 0 Mask Give the bit-wise operation that needs to be performed using the mask and the ASCII code. …[2] (ii) A program needs a mask to ensure that a letter is in lower case. Write the binary pattern of the mask in the space provided in the table below. Bit number 7 6 5 4 3 2 1 0 ASCII code ASCII code in binary 70 0 1 0 0 0 1 1 0 102 0 1 1 0 0 1 1 0 Mask Give the bit-wise operation that needs to be performed using the mask and the ASCII code. …[2]

Question paper, page 12

12 9608/42/O/N/16 © UCLES 2016 The following table shows part of the instruction set for a processor which has one general purpose register, the Accumulator (ACC), and an index register (IX). Instruction Explanation Op code Operand LDM #n Immediate addressing. Load the number n to ACC. LDD <address> Direct addressing. Load the contents of the given address to ACC. LDX <address> Indexed addressing. Form the address from <address> + the contents of the index register. Copy the contents of this calculated address to ACC. LDR #n Immediate addressing. Load the number n into IX. STO <address> Store the contents of ACC at the given address. INC <register> Add 1 to the contents of the register (ACC or IX). CMP <address> Compare the contents of ACC with the contents of <address>. CMP #n Compare the contents of ACC with number n. JPE <address> Following a compare instruction, jump to <address> if the compare was True. JPN <address> Following a compare instruction, jump to <address> if the compare was False. AND #n Bitwise AND operation of the contents of ACC with the operand. AND <address> Bitwise AND operation of the contents of ACC with the contents of <address>. XOR #n Bitwise XOR operation of the contents of ACC with the operand. XOR <address> Bitwise XOR operation of the contents of ACC with the contents of <address>. OR #n Bitwise OR operation of the contents of ACC with the operand. OR <address> Bitwise OR operation of the contents of ACC with the contents of <address>. OUT Output to the screen the character whose ASCII value is stored in ACC. END Return control to the operating system. A programmer is writing a program that will output the first character of a string in upper case and the remaining characters of the string in lower case. The program will use locations from address WORD onwards to store the characters in the string. The location with address LENGTH stores the number of characters that make up the string.

Question paper, page 13

13 9608/42/O/N/16 © UCLES 2016 [Turn over The programmer has started to write the program in the following table. The comment column contains descriptions for the missing program instructions. (b) Complete the program using op codes from the given instruction set. Label Op code Operand Comment START: // initialise index register to zero // get first character of WORD // ensure it is in upper case using MASK1 // output character to screen // increment index register // load 1 into ACC // store in COUNT LOOP: // load next character from indexed address WORD // make lower case using MASK2 // output character to screen // increment COUNT starts here // is COUNT = LENGTH ? // if FALSE, jump to LOOP // end of program COUNT: MASK1: // bit pattern for upper case MASK2: // bit pattern for lower case LENGTH: 4 WORD: B01100110 // ASCII code in binary for 'f' B01110010 // ASCII code in binary for 'r' B01000101 // ASCII code in binary for 'E' B01000100 // ASCII code in binary for 'D' [12]

Question paper, page 14

14 9608/42/O/N/16 © UCLES 2016 Question 4 begins on page 15.

Question paper, page 15

15 9608/42/O/N/16 © UCLES 2016 [Turn over 4 Circle the programming language that you have studied: Visual Basic (console mode) Python Pascal Delphi (console mode) (a) (i) Name the programming environment you have used when typing in program code. … … List three features of the editor that helped you to write program code. 1 … … 2 … … 3 … …[3] (ii) Explain when and how your programming environment reports a syntax error. When … … … How … … …[2]

Question paper, page 16

16 9608/42/O/N/16 © UCLES 2016 (iii) The table shows a module definition for BubbleSort in three programming languages. Study one of the examples. Indicate your choice by circling A, B or C: A B C A) Python 01 02 03 04 05 06 07 08 09 10 def BubbleSort(SList, Max): NoMoreSwaps = False while NoMoreSwaps == False: NoMoreSwaps = True for i in (Max - 1): if SList[i] > SList[i + 1]: NoMoreSwaps = True Temp = SList[i] SList[i] = SList[i + 1] SList[i + 1] = Temp B) Pascal/Delphi 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 PROCEDURE BubbleSort(VAR SList : ARRAY OF INTEGER; Max : INTEGER); VAR NoMoreSwaps : BOOLEAN; i, Temp : INTEGER; BEGIN REPEAT NoMoreSwaps := TRUE; FOR i := 1 TO (Max – 1) IF SList[i] > SList[i + 1] THEN BEGIN NoMoreSwaps := TRUE; Temp := SList[i]; SList[i] := SList[i + 1]; SList[i + 1] := Temp; END; UNTIL NoMoreSwaps; END; C) Visual Basic 01 02 03 04 05 06 07 08 09 10 11 12 13 14 Sub BubbleSort(ByRef SList() As Integer, ByVal Max As Integer) Dim NoMoreSwaps As Boolean, i, Temp As Integer Do NoMoreSwaps = True For i : 0 To (Max – 1) If SList(i) > SList(i + 1) Then NoMoreSwaps = True Temp = SList(i) SList(i) = SList(i + 1) SList(i + 1) = Temp End If Next Loop Until (NoMoreSwaps = True) End Sub

Question paper, page 17

17 9608/42/O/N/16 © UCLES 2016 The programming environment reported a syntax error in the BubbleSort code. State the line number … Write the correct code for this line. …[2] (b) (i) State whether programs written in your programming language are compiled or interpreted. … …[1] (ii) A programmer corrects the syntax error and tests the function. It does not perform as expected. The items are not fully in order. State the type of error … Write the line number where the error occurs. … Write the correct code for this line. …[2] (iii) State the programming environment you have used when debugging program code. … Name two debugging features and describe how they are used. 1 … … … … 2 … … … …[4]

Question paper, page 18

18 9608/42/O/N/16 © UCLES 2016 BLANK PAGE

Question paper, page 19

19 9608/42/O/N/16 © UCLES 2016 BLANK PAGE

Question paper, page 20

20 9608/42/O/N/16 © UCLES 2016 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 the registered trademark of Cambridge International Examinations. This document consists of 13 printed pages. © UCLES 2016 [Turn over Cambridge International Examinations Cambridge International Advanced Level COMPUTER SCIENCE 9608/42 Paper 4 Written Paper October/November 2016 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 will not enter into discussions about these mark schemes. Cambridge is publishing the mark schemes for the October/November 2016 series for most Cambridge IGCSE®, Cambridge International A and AS Level components and some Cambridge O Level components.

Mark scheme, page 2

Page 2 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 1 (a) [7] 1 mark for each label

Mark scheme, page 3

Page 3 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (b) (i) 1 mark per bullet to max 3: [3] • method header and close • initialising amount to 0 • initialising state to “Idle” e.g. PYTHON: def __init__(self): self.__amount = 0 self.__state = "Idle" PASCAL/DELPHI: constructor TicketMachine.Create(); begin Amount := 0; State := 'Idle'; end; VB: Public Sub New() Amount = 0 State = "Idle" End Sub VB: Public Sub Create() Amount = 0 state = “Idle” End Sub (ii) 1 mark per bullet to max 2: [2] • method header, close with parameter • setting state to parameter value • outputting state e.g. PYTHON: def SetState(self, NewState): self.__State = NewState print(self.__State) PASCAL/DELPHI: procedure TicketMachine.SetState(NewState : string); begin State := NewState; Writeln(State); end;

Mark scheme, page 4

Page 4 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 VB: Public Sub SetState(NewState As String) Me.State = NewState Console.WriteLine(Me.State) End Sub VB: Private _State As String Public Property State() As String Get Return _State End Get Set(value As String) _State = value End Set End Property Public Sub SetState() Console.WriteLine(Me.State) End Sub (iii) 1 mark per bullet to max 2: [2] • output Amount • set amount to zero e.g. PYTHON: def ReturnCoins(self): print(self.__Amount) self.__Amount = 0 PASCAL/DELPHI: procedure TicketMachine.ReturnCoins(); begin Writeln(Amount); Amount := 0; end; VB: Public Sub ReturnCoins() Console.WriteLine(Me.Amount) Me.Amount = 0 End Sub

Mark scheme, page 5

Page 5 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (iv) 1 mark per bullet to max 3: [3] • function header, take string as parameter, return Boolean • check the parameter is a valid coin • return of value for both cases e.g. PYTHON: def __validCoin(self, s): coins = ['10','20','50','100'] if s in coins: isValid = True else: isValid = False return(isValid) PASCAL/DELPHI: function TicketMachine.ValidCoin(s : string) : boolean; begin if ((s = '10') or (s = '20') or (s = '50') or (s = '100')) then ValidCoin:= True; else ValidCoin := False; end; VB: Public Function ValidCoin(ByVal s As String) As Boolean If s = “10” or s = “20” or s = “50” or s = “100” Then ValidCoin = True Else ValidCoin = False End If End Sub

Mark scheme, page 6

Page 6 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (v) 1 mark per bullet to max 2 [2] • Cast parameter as integer • Add value to amount e.g. PYTHON: def coinInserted(self, s): coinValue = int(s) self.__amount = self.__amount + coinValue PASCAL/DELPHI: procedure TicketMachine.CoinInserted(s : string); var CoinValue, Code : integer; begin Val(s, CoinValue, Code); Amount := Amount + CoinValue; end; VB: Public Sub CoinInserted(ByVal S As String) CoinValue = INT(s) Me.Amount = Me.Amount + CoinValue End Sub

Mark scheme, page 7

Page 7 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (vi) 1 mark per bullet to max 12 [12] • read NewInput from keyboard • check if input ‘C’ and state = Counting o then set state to cancelled o call method returnCoins() and set state to Idle • check if input ‘A’ o then check if amount = 0 then output no coins o else set state to Accepted o call PrintTicket method and Set state to Idle • else if input is a valid coin o call CoinInserted method with NewInput as parameter o set state to Counting o error message if not a valid coin e.g. PYTHON: def stateChange(self): newInput = input("Insert coin: ") if newInput == "C": if self.__state == "Counting": self.setState("Cancelled") self.returnCoins() self.setState("Idle") elif newInput == "A": if self.__amount == 0: print("no coins inserted") else: self.setState("Accepted") self.__PrintTicket() self.setState("Idle") elif self.__validCoin(newInput): self.coinInserted(newInput) self.setState("Counting") else: print("Error - not a valid coin") PASCAL/DELPHI: procedure TicketMachine.StateChange(); var NewInput : string; begin Write('Insert coin: '); Readln(NewInput); if (NewInput = 'C') then begin if (State = 'Counting') then begin State := 'Cancelled'; ReturnCoins(); end; SetState('Idle') end else if (NewInput = 'A') then

Mark scheme, page 8

Page 8 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 begin if (Amount = 0) then Writeln('No coins inserted') else begin SetState('Accepted'); PrintTicket(); end; SetState('Idle'); end else if (ValidCoin(NewInput)) then begin CoinInserted(NewInput); SetState('Counting') end else Writeln('Error - not a valid coin') end; VB: Public Sub StateChange() Dim NewInput As String NewInput = Console.Readline() If NewInput = “C” Then If State = “Counting” Then SetState(“Cancelled”) ReturnCoins() End If SetState(“Idle”) Elseif NewInput = “A” Then If Amount = 0 Then Console.Writeline(“No coins inserted”) Else SetState(“Accepted”) PrintTicket() Endif SetState(“Idle”) Elseif ValidCoin(NewInput) Then CoinInserted(NewInput) SetState(“Counting”) Else Console.Writeline(“Error – not a valid coin”) EndIf End Sub

Mark scheme, page 9

Page 9 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (vii) 1 mark per bullet to max 4 [4] • declaration of main method header • Initialising ParkingMeter as instance of TicketMachine • Looping while true/until false o Calling stateChange method on ParkingMeter e.g. PYTHON: def main(): ParkingMeter = TicketMachine() while True: ParkingMeter.stateChange() PASCAL/DELPHI: begin ParkingMeter := TicketMachine.Create(); while True do ParkingMeter.StateChange(); end. VB: Sub Main() Dim ParkingMeter As New TicketMachine ParkingMeter.Create() While (True) Call ParkingMeter.StateChange() End While End Sub

Mark scheme, page 10

Page 10 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (c) (i) 1 mark per bullet to max 2: [2] • The attributes can only be accessed in the class • Properties are needed to get/set the data // It provides/uses encapsulation • Increase security/integrity of attributes (ii) 1 mark per bullet [2] • The public methods can be called anywhere in the main program // Public methods can be inherited by sub-classes • The private methods can only be called within the class definition // cannot be called outside the class definition // Private methods cannot be inherited by sub-classes 2 [6] (i) Alpha testing (ii) Beta testing Who In house testers / developers / programmers (potential) (end) user(s)/client(s) When Near the end of development // program is nearly fully-usable // after integration and before beta Before general release of software // passed Alpha testing Purpose To find errors not found in earlier testing // ensure ready for beta testing For constructive comments/ feedback // to test in real-life scenarios/situations/ environments // ensure it is ready for release // ensure it meets users’ needs 3 (a) (i) 1 mark per bullet to max 2: [2] • 11011111 • AND (ii) 1 mark per bullet to max 2: [2] • 00100000 • OR

Mark scheme, page 11

Page 11 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (b) 1 mark per line START: LDR #0 // initialise index register to zero 1 LDX WORD // get first character of WORD 1 AND MASK1 // ensure it is in upper case using MASK1 1 OUT // output character to screen INC IX // increment index register 1 LDM #1 // load 1 into ACC 1 STO COUNT // store in COUNT 1 LOOP: LDX WORD // load next character from indexed address WORD 1 OR MASK2 // make lower case using MASK2 1 OUT // output character to screen LDD COUNT // increment COUNT 1 INC ACC // STO COUNT // CMP LENGTH // is COUNT = LENGTH? 1 JPN LOOP // if FALSE – jump to LOOP 1 END // end of program 1 COUNT: 0 MASK1: B11011111 // bit pattern for upper case 1 MASK2: B00100000 // bit pattern for lower case LENGTH: 4 WORD: B01100110 //ASCII code in binary for 'f' B01101000 //ASCII code in binary for 'r' B01000101 //ASCII code in binary for 'E' B01000100 //ASCII code in binary for 'D' [max 12]

Mark scheme, page 12

Page 12 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 4 (a) (i) 1 mark per feature to max 3 [3] e.g. • auto-indent • auto-complete / by example • colour-coded keywords/ strings/ comments/ built-in functions/ user-defined function names pop-up help • can set indent width • expand/collapse subroutines/code • block highlighting incorrect syntax highlighting/ underlining // dynamic syntax checker (ii) Read and mark the answer as one paragraph. Mark a how and a when anywhere in the answer. 1 mark for when, 1 mark for how. e.g. When: • the error has been typed • when the program is being run/compiled/interpreted How: • highlights/underlines displays error message/pop-up (iii) 1 mark for identifying the correct line, 1 mark for writing the corrected line A - Line 5 B - Line 6 C - Line 5 [1] for i in range(Max-1): FOR i := 1 TO (Max- 1) DO For i = 0 To (Max – 1) [1] (b) (i) Python: compiled/interpreted [1] VB.NET: compiled Pascal:compiled/interpreted Delphi: compiled/interpreted

Mark scheme, page 13

Page 13 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 42 © UCLES 2016 (ii) 1 mark for naming error, 1 mark for line number and correction A Logic error B Logic error C Logic error [1] 7 NoMoreSwaps = False 10 NoMoreSwaps := FALSE; 7 NoMoreSwaps = False [1] (iii) 1 mark for naming, 1 for description [4] • breakpoint • a point where the program can be halted to see if the program works at this point • stepping / step through • executes one statement at a time and then pauses to see the effect of each statement • variable watch window • observe how variables changed during execution

What you needed in this session

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

A53/75
B46/75
C38/75
D31/75
E24/75