33
Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41 1 (a) 1 mark for both Set code entered correct. 1 mark for each label. [7] (b) (i) 1 mark per bullet to max 3 [3] Method header initialising Code to "" initialising State to "Open-NoCode" e.g. PYTHON: def __init__(self): self.__code = "" self.__state = "Open-NoCode" PASCAL/DELPHI: constructor SafetyDepositBox.Create(); begin Code := ''; State := 'Open-NoCode'; end; QUESTION 1.

QUESTION 1. Page 2 Mark Scheme Syllabus Paper Cambridge ... · Page 2 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41 © UCLES 2016 1

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

  • Page 2 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    1 (a) 1 mark for both Set code entered correct. 1 mark for each label. [7]

    (b) (i) 1 mark per bullet to max 3 [3] • Method header • initialising Code to "" • initialising State to "Open-NoCode" e.g. PYTHON: def __init__(self): self.__code = "" self.__state = "Open-NoCode" PASCAL/DELPHI: constructor SafetyDepositBox.Create(); begin Code := ''; State := 'Open-NoCode'; end;

    QUESTION 1.

  • Page 3 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    VB: Public Sub New() Code = "" State = "Open-NoCode" End Sub (ii) 1 mark per bullet to max 2 [2] • method header • Setting code to "" e.g. PYTHON: def reset(self): self.__code = "" PASCAL/DELPHI: procedure SafetyDepositBox.Reset(); begin Code := ''; end; VB: Public Sub Reset() Code = "" End Sub (iii) 1 mark per bullet to max 2 [2] • method header 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 SetState(NewState : String); begin State := NewState WriteLn(State) end;

  • Page 4 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    VB: VB:Public Sub SetState(ByVal NewState As String) State = NewState Console.WriteLine(State) End Sub

    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

    (iv) 1 mark per bullet to max 2 [2] • setting code to parameter • Outputting New cost set and code e.g. PYTHON: def SetNewCode(self, NewCode): self.__code = NewCode print("New code set: ", self.__code) PASCAL/DELPHI: procedure SetNewCode(NewCode : String); begin Code := NewCode; WriteLn('New code set: ', Code) end; VB: Public Sub SetNewCode(NewCode) Code = NewCode Console.WriteLine("New code set: " & Code) End Sub

  • Page 5 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    (v) 1 mark per bullet to max 4 [4] • function header taking string parameter, returns Boolean • check length of string is 4 • check each character is a digit • return of correct Boolean value for both cases

    e.g PYTHON: def __valid(self, s): digits = ['0','1','2','3','4','5','6','7','8','9'] isValid = False if (len(s) == 4): if (s[0] in digits) & (s[1] in digits) & (s[2] in digits) &

    (s[3] in digits): isValid = True return(isValid) PASCAL/DELPHI:

    function Valid(s : string) : Boolean; var isValid : Boolean; i : integer; begin isValid := False if Length(s) = 4 then begin isValid := True; For i := 1 to 4 do if (s[i] < '0') OR (s[i] > '9') then isValid := False; end; end;

    VB: ByVal optional Public Function valid(ByVal s As String) As Boolean If s Like "####" Then Return True Else Return False End If End Function

  • Page 6 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    (vi) 1 mark per bullet to max 12 [12] • read Chars from keyboard • check if ‘R’ and state = Open-CodeSet • call method Reset() & method SetState • if Chars is the set code: • check if locked • set state to Open-CodeSet • else if closed • then set state to Locked • if Chars is empty and State is “Open-CodeSet” then setState to closed • if Chars is a valid 4-digit code and state is Open-NoCode • call setNewCode and SetState • outputting correct error messages for not valid 4-digit and state is not Open-NoCode e.g. PYTHON: def StateChange(self): Chars = input("Enter code: ") if Chars == "R": if self.__state == "Open-CodeSet": self.reset() self.SetState("Open-NoCode") elif Chars == self.__code: if self.__state == "Locked": self.SetState("Open-CodeSet") elif self.__state == "Closed": self.SetState("Locked") elif (Chars == "") & (self.__state == "Open-CodeSet"): self.SetState("Closed") elif self.__valid(Chars): if self.__state == "Open-NoCode": self.SetNewCode(Chars) self.SetState("Open-CodeSet") else: print("Error - does not match set code") else: print("Error - Code format incorrect")

  • Page 7 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    PASCAL/DELPHI: Procedure StateChange(); var Chars : String; begin ReadLn(Chars); If Chars = 'R' Then If State = 'Open-CodeSet' Then begin Reset(); SetState('Open-NoCode'); end Else If Chars = Code Then If state = 'Locked' Then SetState('Open-CodeSet') Else If state = 'Closed' Then SetState('Locked') Else If (Chars = '') AND (State = 'Open-CodeSet') Then SetState('Closed') Else If Valid(Chars) Then begin If State == 'Open-NoCode' Then begin SetNewCode(Chars); SetState('Open-CodeSet'); end else WriteLn('Error - does not match set code') end Else WriteLn('Error - Code format incorrect'); end;

  • Page 8 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    VB: Public Sub StateChange() Dim Chars As String Chars = Console.ReadLine() If Chars = "R" Then If State = "Open-CodeSet" Then Reset() SetState("Open-NoCode") End If ElseIf Chars = Code Then If state = "Locked" Then SetState("Open-CodeSet") ElseIf state = "Closed" Then SetState("Locked") End If ElseIf (Chars = "") AND (State = "Open-CodeSet") Then SetState("Closed") ElseIf Valid(Chars) Then If State == "Open-NoCode" Then SetNewCode(Chars) SetState("Open-CodeSet") Else Console.WriteLine("Error - does not match set code") End If Else Console.WriteLine("Error - Code format incorrect") End If End Sub (vii) 1 mark per bullet to max 4 [4] • method header • Initialising ThisSafe to instance of SafetyDepositBox • Loop forever • Call method StateChange on ThisSafe e.g. PYTHON: def main(): ThisSafe = SafetyDepositBox() while True: ThisSafe.StateChange() PASCAL/DELPHI: var ThisSafe : SafetyDepositBox; ThisSafe := SafetyDepositBox.Create; while True do ThisSafe.StateChange;

  • Page 9 Mark Scheme Syllabus Paper Cambridge International A Level – October/November 2016 9608 41

    © UCLES 2016

    VB: Sub Main() Dim ThisSafe As New SafetyDepositBox() Do ThisSafe.StateChange() Loop End Sub (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 (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. [2] 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)

    A B C

    Line 3 Line 5 Line 4 [1]

    while (Index == -1) & (Low

  • 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

    QUESTION 2.

  • 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;

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2017

    © UCLES 2017 Page 2 of 15

    Question Answer Marks

    1 1 mark for each completed statement

    7

    Question Answer Marks

    2(a)(i) • Asterisk (*) in the corner/top of the box(es) 1

    2(a)(ii) • Circle (o) in the corner/top of box(es) 1

    Window closed

    Window half

    open

    Temperature > 20° C

    Temperature < 15 °C Temperature > 30°C

    Temperature < 25° C

    QUESTION 3.

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 4 of 19

    Question Answer Marks

    1(a)(i) 1 mark for each correct Activity and time • B 3 • C 10 (following B) • D 7 (following B) • E 3 (following C and D) • G 2 (following F) • H 2 (following F)

    6

    1(a)(ii) The shortest time to complete the project // the sequence of activities that must be completed to avoid delaying the project 1

    1(a)(iii) 1 mark for identify, max 1 for description • GANTT • A table that has time across the top and activities on the left, boxes are coloured to show dependencies and find

    critical path // colour in the boxes to show the length of time for each task

    2

    1 2 3 5

    8

    6

    9

    4

    7

    A

    1

    F 1

    B

    3

    C

    10

    A

    1

    D 7

    H 2

    G2

    QUESTION 4.

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 5 of 19

    Question Answer Marks

    1(b)(i) A, B, C and D in correct places with no alteration to start and end pointer

    A B D C

    1

    1(b)(ii) 1 mark per bullet point

    • correct jobs in correct order • correct location of start pointer • correction location of new end pointer

    F G H D C E

    3

    1(b)(iii) 1 mark from: • An error message would be generated

    1

    Start Pointer End Pointer

    Start Pointer End Pointer

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 6 of 19

    Question Answer Marks

    1(b)(iv) 1 mark for each correct line FUNCTION Remove RETURNS STRING DECLARE PrintJob : STRING IF StartPointer = EndPointer THEN RETURN "Empty" ELSE PrintJob ← Queue[StartPointer] IF StartPointer = 5 THEN StartPointer ← 0 ELSE StartPointer ← StartPointer + 1 ENDIF RETURN PrintJob ENDIF ENDFUNCTION

    4

    1(b)(v) 1 mark per bullet point • A stack is Last In First Out (LIFO) while a queue is First In First Out (FIFO) • The queue removes and returns the element at start pointer // item is removed from the start/head // • A stack would remove and return the element at end pointer // item is removed from the end

    2

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 7 of 19

    Question Answer Marks

    1(c) 1 mark for each correct transition with arrow

    5

    Printer idle

    Printer active

    Job unsuccessful

    Print job received

    Print job successful

    Print job sent

    Print job in progress

    Timeout

    Error message

    Print job in progress

    Check print queue

    Print job added to queue

    Start

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 8 of 19

    Question Answer Marks

    1(d)(i) 1 mark per bullet • Way of modelling logic • Show all possible outputs // shows every possible outcome // all outcomes • based on the inputs • Determine which action to take in specific conditions // how different conditions affect the actions/outcomes

    2

    1(d)(ii) 1 mark for each row Accept Y/X/ticks as long as clear which are Y. Accept N/X/– for empty spaces

    Rules

    Conditions

    Document printed, but quality is poor Y Y Y Y N N N N

    Error light is flashing on printer Y Y N N Y Y N N

    Document printed, but paper size is incorrect Y N Y N Y N Y N

    Actions

    Check connection from computer to printer X

    Check ink status X X X X

    Check if there is a paper jam X

    Check paper size selected X X X X

    4

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 9 of 19

    Question Answer Marks

    1(d)(iii) 1 mark each for each correct column Accept –/X for empty spaces. Accept Y/X/Ticks as long as clear which are used

    Rules

    Conditions

    Document printed, but quality is poor Y Y N N N

    Error light is flashing on printer Y N

    Document printed, but paper size is incorrect Y N Y N N

    Actions

    Check connection from computer to printer X

    Check ink status X X

    Check if there is a paper jam X

    Check paper size selected X X

    5

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 10 of 19

    Question Answer Marks

    1(e)(i) 1 mark per bullet point to max 4 • Method header and close (where necessary) with three parameters • Initialised PrintID, FirstName, LastName and Credits • to the parameters • Initialised Credits to 50 PYTHON def__init__(self, NewFN, NewLN, NewPrintID): self.__PrintID = NewPrintID self.__FirstName = NewFN self.__LastName = NewLN self.__Credits = 50 PASCAL Constructor NewPrintAccount.Create(NewFN, NewLN, NewPrintID); begin PrintID := NewPrintID; FirstName = NewFN; LastName = NewLN; Credits := 50; end; VB Public Sub New(NewFN, NewLN, NewPrintID As String) PrintID = NewPrintID FirstName = NewFN LastName = NewLN Credits = 50 End Sub

    4

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 11 of 19

    Question Answer Marks

    1(e)(ii) 1 mark per bullet point • method/procedure header (and close where appropriate) taking a parameter • FirstName is set to parameter PYTHON def __SetFirstName(self, NewFirstName): self.__FirstName = NewFirstName PASCAL procedure SetFirstName(newFirstName : String); begin FirstName := newFirstName; end; VB public sub SetFirstName(NewFirstName As String) FirstName = NewFirstName End Sub

    2

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 12 of 19

    Question Answer Marks

    1(e)(iii) 1 mark per bullet point • concatenates FirstName, space and LastName • function/method header without parameter and returns (generated) value PYTHON def __GetName(self): return(self.__FirstName + " " + self.__LastName) PASCAL function GetName(); begin result := FirstName + " " + LastName end; VB public function GetName() As String return(FirstName & " " & LastName) End Function

    2

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 13 of 19

    Question Answer Marks

    1(e)(iv) 1 mark per each correct bullet point from: • Procedure/method header and close (where necessary) passing MoneyInput • At least 3 constants (e.g. freecredit10, freecredit20, twenty, 10, creditperdollar) • If MoneyInput9 and MoneyInput 19 then calculate MoneyInput * 25 + 50 • All three correct calculations add to Credits, not overwrite • Efficient IF (i.e. elseif) PYTHON def __AddCredits(self, MoneyInput): CreditPerDollar = 25 FreeCredit10 = 25 FreeCredit20 = 50 Twenty = 20 Ten = 10 if MoneyInput >= Twenty: Credits = Credits + (MoneyInput * CreditPerDollar) + FreeCredit20 elif MoneyInput >= Ten: Credits = Credits + (MoneyInput * CreditPerDollar) + FreeCredit10 else: Credits = Credits + (MoneyInput * CreditPerDollar)

    6

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 14 of 19

    Question Answer Marks

    1(e)(iv) PASCAL procedure AddCredits(MoneyInput : Real); const CreditPerDollar = 25 const FreeCredit10 = 25 const FreeCredit20 = 50 const Twenty = 20 const Ten = 10 begin If MoneyInput > = Twenty Then Credits := Credits + (MoneyInput * CreditPerDollar) + FreeCredit20; Else If MoneyInput > = Ten Then Credits := Credits + (MoneyInput * CreditPerDollar) + FreeCredit10; Else Credits := Credits + (MoneyInput * CreditPerDollar); end; VB.NET Public Sub AddCredits(MoneyInput As Integer) Const CreditPerDollar As Integer = 25 Const FreeCredit10 As Integer = 25 Const FreeCredit20 AS integer = 50 Const Twenty As Integer = 20 Const Ten AS Integer = 10 If MoneyInput > = Twenty Then Credits = Credits + (MoneyInput * CreditPerDollar) + FreeCredit20 Else If MoneyInput > = Ten Then Credits = Credits + (MoneyInput * CreditPerDollar) + FreeCredit10 Else Credits = Credits + (MoneyInput * CreditPerDollar) End If End Sub

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 15 of 19

    Question Answer Marks

    1(e)(v) 1 mark per bullet • Declaring StudentAccounts as array of 1000 elements • of type PrintAccount DECLARE StudentAccounts ARRAY[0:999] OF PrintAccount

    2

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 16 of 19

    Question Answer Marks

    1(e)(vi) 1 mark per bullet point to max 8 • Generating ID with ‘1’ at the end all in lowercase from parameters • Loop through array to last occupied element • Check if the PrintID already exists • using GetPrintID() • increment number at end of PrintID • Create a new instance of PrintAccount • sending FirstName, LastName, PrintID as parameters • adding new account to StudentAccounts at position NumberStudents • Increment NumberStudents VB.NET Sub CreateId(firstName, lastName) Dim count As Integer Dim PrintID = Left(firstname, 3).ToLower & Left(lastname, 3).ToLower & “1” Dim studentAdd As Integer = 0 If numberStudents 0 Then For x = 0 To numberStudents - 1 If studentAccounts(x).getPrintID() = username Then PrintID = PrintID + 1 username = Left(firstname, 3).ToLower & Left(lastname, 3).ToLower & PrintID.ToString End If Next studentAdd = numberStudents End If studentAccounts(studentAdd) = New printAccount(firstname, lastname, username) numberStudents = numberStudents + 1

    8

  • 9608/41 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 17 of 19

    Question Answer Marks

    1(e)(vi) Python def CreateID(firstname, lastname): count = 0 PrintID = firstname[0:3].lower() + lastname[-3].lower() + "1" StudentAdd = 0 if numberStudents != 0: for x in range(0, numberStudents): if studentAccounts[x].getPrintID() == username: PrintID = PrintID + 1 username = firstname[0:3].lower() + lastname[0:3].lower + str(PrintID) studentAdd = numberStudents studentAccounts[studentAdd] = printAccount(firstname, lastname, username) numberStudents = numberStudents + 1 Pascal procedure CreateID(firstname : String, lastname: String); var count : Integer; studentAdd : Integer; PrintID : String; begin studentAdd := 0; PrintID := LowerCase(substr(firstname,0,3)) + LowerCase(substr(lastname,0,3))+ "1"; if numberStudents 0: ror x := 0 To numberStudents - 1; if studentAccounts[x].getPrintID() = username: PrintID := PrintID + 1; username := LowerCase(substr(firstname, 3) + LowerCase(substr(lastname,0,3))+str(PrintID); studentAdd := numberStudents; studentAccounts[studentAdd] := printAccount.Create(firstname, lastname, username); numberStudents := numberStudents + 1

  • 9608/42 Cambridge International AS/A Level – Mark Scheme PUBLISHED

    October/November 2019

    © UCLES 2019 Page 17 of 20

    Question Answer Marks

    4 1 mark for each correct transition with arrow.

    8

    ATM active

    Waiting for PIN

    Checking PIN

    Account accessed

    Checking account

    Transaction complete

    Transaction cancelled

    Start Insert card

    Enter Pin

    Input amount to withdraw

    Ret

    urn

    card

    an

    d di

    spen

    se

    cash

    Funds not available

    QUESTION 5.