Cambridge A Level Computer Science 9608 — 2018 Oct/Nov Paper 2 · Variant 2
9608/22/O/N/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.
Question paper16 pages
















Mark scheme13 pages
Answers below. Sit the paper first if you are practising.













Paper as text
Question paper, page 1
This document consists of 16 printed pages. DC (NH/CT) 150983/3 © UCLES 2018 [Turn over * 2 7 2 0 5 0 4 7 1 6 * COMPUTER SCIENCE 9608/22 Paper 2 Fundamental Problem-solving and Programming Skills October/November 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/22/O/N/18 © UCLES 2018 Question 1 begins on the next page. 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.
Question paper, page 3
3 9608/22/O/N/18 © UCLES 2018 [Turn over 1 (a) The following table contains statements written in pseudocode. Show the type of programming construct each statement represents. Put a tick (3) in the appropriate column for each statement. Statement Selection Repetition (Iteration) Assignment Index Index + 5 FOR Count 1 TO 100 TempValue[Index] ReadValue(SensorID) IF Index < 30 UNTIL DayNumber > 7 OTHERWISE OUTPUT "ERROR" [6] (b) (i) The following table contains statements written in pseudocode. Give the most appropriate data type for the variable used in each statement. Statement Data type Revision 'B' MaxValue 13.3 ArrayFull TRUE Activity "Design" NumberOfEdits 270 [5] (ii) The following table contains statements written in pseudocode. Complete the table by evaluating each expression using the values from part (b)(i). If any expression is invalid, write “ERROR” in the Evaluates to column. For the built-in functions list, refer to the Appendix on page 16. Expression Evaluates to MID(Activity, 3, 4) & "ature" INT(MaxValue * 2) ArrayFull AND NumberOfEdits < 300 ASC(Revision + 1) Activity = "Testing" OR Revision = 'A' [5]
Question paper, page 4
4 9608/22/O/N/18 © UCLES 2018 2 Shop customers have a discount card with a unique card number. Customers collect points each time they buy items. The number of points they collect depends on: • the total amount they spend • the number of points already collected. The function CalcPoints() takes the card number and the total amount spent as parameters. It returns the number of new points collected. A flowchart for the function is shown. The function uses the following variables and functions. Identifier Data type Description CardNum STRING A numeric string representing the unique card number OldPoints INTEGER The number of points already collected NewPoints INTEGER The number of new points collected Total REAL The amount spent GetPoints() FUNCTION Takes the card number as a parameter and returns the number of points already collected INT() FUNCTION Refer to the Appendix on page 16 START OldPoints GetPoints(CardNum) Is OldPoints > 2000 ? NewPoints INT(Total * 1.2) NewPoints INT(Total * 1.1) Is Total > 100 ? NewPoints 0 RETURN NewPoints END YES NO NO YES
Question paper, page 5
5 9608/22/O/N/18 © UCLES 2018 [Turn over (a) (i) Write pseudocode for the CalcPoints() function. Your solution should follow the flowchart as closely as possible. … … … … … … … … … … … … … … … … … … … … … … …[7]
Question paper, page 6
6 9608/22/O/N/18 © UCLES 2018 (ii) The value of the total amount spent is calculated by an Electronic Point Of Sale (EPOS) system. This system does not have the prices of all items. For these items, a valid total amount has to be entered manually. A function, GetTotal(), prompts the user to input this value. If the user enters a valid value greater than 0 and less than 10 000, the function returns the value. The function prompts the user to re-enter the value each time the user enters an invalid value. Write pseudocode to complete the GetTotal() function. FUNCTION GetTotal() RETURNS REAL … … … … … … … … … … … … … … … … … … … … ENDFUNCTION [5]
Question paper, page 7
7 9608/22/O/N/18 © UCLES 2018 [Turn over (b) The function CalcPoints() is written in a high-level language. It has been checked and it does not contain any syntax or logic errors. (i) Name and describe one other type of error that the high-level language code could contain. Name … Description … … … [2] (ii) The function CalcPoints() is tested using white-box testing. State two different values of Total that could be used to test different paths through the algorithm. Justify your choices. Value … Justification … … … Value … Justification … … … [4]
Question paper, page 8
8 9608/22/O/N/18 © UCLES 2018 3 (a) Programming is sometimes referred to as a transferable skill. You are asked to work on a program written in a language you are not familiar with. Explain how transferable skills would help you work on the program. … … … …[2] (b) Stepwise refinement is often used in the development of an algorithm. Describe stepwise refinement. … … … …[2] (c) A program needs to search through 1000 elements of an unsorted array to find a given value. The program will output: • either the position in the array of the value • or the message “Not Found” Outline the steps the program needs to follow. Do not write pseudocode or program code. … … … … … … … … … … …[4]
Question paper, page 9
9 9608/22/O/N/18 © UCLES 2018 [Turn over Question 4 begins on the next page.
Question paper, page 10
10 9608/22/O/N/18 © UCLES 2018 4 Part of a program written in pseudocode is shown. 010 DECLARE NextArrayElement : INTEGER … 100 FUNCTION ScanFile(SearchString: STRING) RETURNS INTEGER 101 102 DECLARE FileData : STRING 103 DECLARE FileLine : INTEGER 104 105 NextArrayElement 1 106 FileLine 1 107 FileData ReadFileLine("DataFile.txt", FileLine) 108 109 WHILE FileData <> "" 110 IF LEFT(FileData, 7) = SearchString 111 THEN 112 ResultArray[NextArrayElement] FileData 113 NextArrayElement NextArrayElement + 1 114 ENDIF 115 FileLine FileLine + 1 116 FileData ReadFileLine("DataFile.txt", FileLine) 117 ENDWHILE 118 119 CALL ScanCompleted() 120 RETURN FileLine 121 122 ENDFUNCTION (a) (i) Examine the pseudocode. Complete the following table. Answer The identifier name of a local variable The identifier name of a user-defined procedure The identifier name of a user-defined function The number of dimensions of ResultArray The scope of FileData [5] (ii) Describe in detail the purpose of lines 109 to 117 in the ScanFile() function. Do not use pseudocode in your answer. … … … … … …[4]
Question paper, page 11
11 9608/22/O/N/18 © UCLES 2018 [Turn over (b) The function ScanFile() is to be amended so that the first 7 characters of FileData are not written to the array. Write program code to implement this amended ScanFile() function. Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement for each variable used with its data type. Programming language … Program code … … … … … … … … … … … … … … … … … … … … … … … …[8]
Question paper, page 12
12 9608/22/O/N/18 © UCLES 2018 (c) (i) State how structured programming languages support the implementation of sub-tasks. …[1] (ii) State a benefit of using sub-tasks. … …[1] (d) ResultArray is a 1D array of type STRING. It contains 100 elements. Write program code to declare ResultArray and set all elements to the value "NO DATA". Programming language … Program code … … … … … …[3]
Question paper, page 13
13 9608/22/O/N/18 © UCLES 2018 [Turn over Question 5 begins on the next page.
Question paper, page 14
14 9608/22/O/N/18 © UCLES 2018 5 The procedure LineNumber() will: • read data from a text file • modify each line by adding a line number, and the string (": ") • output each modified line. For example, when the procedure reads MyFile.txt, the output is: 10: <First line of MyFile.txt> 15: <Second line of MyFile.txt> 20: <Third line of MyFile.txt> … 350: <Last line of MyFile.txt> The procedure takes three parameters: Identifier Data type Description FileName STRING The name of the text file StartNumber INTEGER The first line number to be added StepNumber INTEGER The line number increment In this example, the procedure call would be: CALL LineNumber("MyFile.txt", 10, 5) After every 20 lines, the program outputs a message asking whether the user wants to continue. The program ends when the user enters an 'N' or the end of file is reached. Write pseudocode for the LineNumber() procedure. … … … … … … … … … …
Question paper, page 15
15 9608/22/O/N/18 © UCLES 2018 [Turn over … … … … … … … … … … … … … … … … … … … … … … … … … … … …[11]
Question paper, page 16
16 9608/22/O/N/18 © UCLES 2018 Appendix Built-in functions (pseudocode) Each function returns an error if the function call is not properly formed. MID(ThisString : STRING, x : INTEGER, y : INTEGER) RETURNS STRING returns a string of length y starting at position x from ThisString Example: MID("ABCDEFGH", 2, 3) returns string "BCD" LENGTH(ThisString : STRING) RETURNS INTEGER returns the integer value representing the length of ThisString Example: LENGTH("Happy Days") returns 10 LEFT(ThisString : STRING, x : INTEGER) RETURNS STRING returns leftmost x characters from ThisString Example: LEFT("ABCDEFGH", 3) returns string "ABC" RIGHT(ThisString: STRING, x : INTEGER) RETURNS STRING returns rightmost x characters from ThisString Example: RIGHT("ABCDEFGH", 3) returns string "FGH" NUM_TO_STRING(x : REAL) RETURNS STRING returns a string representation of a numeric value. Example: If x has the value 87.5 then NUM_TO_STRING(x) will return "87.5" Note: This function will also work if x is of type integer. INT(x : REAL) RETURNS INTEGER returns the integer part of x Example: INT(27.5415) returns 27 ASC(ThisChar : CHAR) RETURNS INTEGER returns the ASCII value of character ThisChar Example: ASC('A') returns 65 Operators (pseudocode) Operator Description & Concatenates (joins) two strings Example: "Summer" & " " & "Pudding" produces "Summer Pudding" AND Performs a logical AND on two Boolean values Example: TRUE AND FALSE produces FALSE OR Performs a logical OR on two Boolean values Example: TRUE OR FALSE produces TRUE
Mark scheme, page 1
This document consists of 13 printed pages. © UCLES 2018 [Turn over Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/22 Paper 2 Written Paper October/November 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 October/November 2018 series for most Cambridge IGCSE™, Cambridge International A and AS Level components and some Cambridge O Level components.
Mark scheme, page 2
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 2 of 13 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. 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 3
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 3 of 13 Question Answer Marks 1(a)(i) Statement Selection Repetition (Iteration) Assignment Index ← Index + 5 3 FOR Count ← 1 TO 100 3 (3) TempValue[Index] ← ReadValue(SensorID) 3 IF Index < 30 3 UNTIL DayNumber > 7 3 OTHERWISE OUTPUT "ERROR" 3 1 mark per correct row Ignore any tick in assignment column for second statement 6 1(b)(i) Statement Data type Revision ← 'B' CHAR MaxValue ← 13.3 REAL ArrayFull ← TRUE BOOLEAN Activity ← "Design" STRING NumberOfEdits ← 270 INTEGER 1 mark per correct row 5 1(b)(ii) Expression Evaluates to MID(Activity, 3, 4) & "ature" "signature" INT(MaxValue * 2) 26 ArrayFull AND NumberOfEdits < 300 TRUE ASC(Revision + 1) ERROR Activity = "Testing" OR Revision = 'A' FALSE 1 mark per correct row 5
Mark scheme, page 4
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 4 of 13 Question Answer Marks 2(a)(i) FUNCTION CalcPoints(CardNum: STRING, Total: REAL) RETURNS INTEGER DECLARE OldPoints : INTEGER DECLARE NewPoints : INTEGER IF Total > 100 THEN OldPoints ← GetPoints(CardNum) IF OldPoints > 2000 THEN NewPoints ← INT(Total * 1.2) ELSE NewPoints ← INT(Total * 1.1) ENDIF ELSE NewPoints ← 0 ENDIF RETURN NewPoints ENDFUNCTION 1 mark for each of the following: 1 Correct FUNCTION heading (as given) and end 2 Declaring local variables for OldPoints and NewPoints 3 IF...THEN...ELSE...ENDIF with Total > 100 4 «Newpoints set to zero if Total <= 100 5 Nested IF...THEN...ELSE...ENDIF with OldPoints > 2000 6 « with correct assignments of NewPoints 7 Return NewPoints for all cases 7
Mark scheme, page 5
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 5 of 13 Question Answer Marks 2(a)(ii) FUNCTION GetTotal() RETURNS REAL DECLARE Valid : BOOLEAN DECLARE Amount : REAL Valid ← FALSE REPEAT OUTPUT "Enter the amount" INPUT Amount IF Amount > 0 AND Amount < 10000 THEN Valid ← TRUE ENDIF UNTIL Valid = TRUE RETURN Amount ENDFUNCTION Note that the pseudocode shown is only an example. The use of an explicit flag and IF structure are not essential provided the functionality is provided. 1 mark for each of: 1 declaration of local variable(s) used 2 prompt followed by input 3 conditional loop 4 checking that input value > 0 and input value < 10000 5 returning the value 5 2(b)(i) 1 mark for name, 1 mark for description Accept by example for description Name: Run-time Description: The program executes an illegal instruction // performs an illegal operation that is trapped by the OS 2 2(b)(ii) One specific value from within each of the following ranges: For example: • 73 (a value <= 100) • 145.3 (a value > 100) 1 mark for the value, plus one for a meaningful description. 4
Mark scheme, page 6
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 6 of 13 Question Answer Marks 3(a) You should be able to recognise / understand in another language: • Declaration / assignment / sequence / selection / repetition (iteration) / Subroutines / Parameters passed between modules / program structure / Input and Output Any 2 marks from the list. Max 1 mark if no explanation given 2 3(b) Key points: • to increase the level of detail of the algorithm // break the problem into smaller steps • until steps are easier to solve // to be directly translated into lines of code 2 3(c) Key points: • A loop / repetition / iteration to check every element • Compare the array element with the value being searched • Exit loop / stop search when value found or end of array reached • If value is found then output the index position, otherwise output “Not found” 4 Question Answer Marks 4(a)(i) The identifier name of a local variable FileData / FileLine The identifier name of a user-defined procedure ScanCompleted The identifier name of a user-defined function ReadFileLine / ScanFile The number of dimensions of ResultArray 1 The scope of FileData Local 1 mark for each correct answer 5 4(a)(ii) Example mark points, max 4 marks: • If FileData is not empty, start and continue a loop // while FileData is not empty... • Compare the Left 7 characters of FileData with SearchString • If they match, add FileData to the array / ResultArray[] • If they match, increment the array index variable • Increment FileLine • Read the next line from the file 4
Mark scheme, page 7
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 7 of 13 Question Answer Marks 4(b) Pseudocode solution included here for development and clarification of mark scheme. Programming language solutions appear at the end of this mark scheme. FUNCTION ScanFile(SearchString STRING) RETURNS INTEGER DECLARE FileData : STRING DECLARE FileLine : INTEGER DECLARE NewData : STRING DECLARE Size : INTEGER NextArrayElement ← 1 FileLine ← 1 FileData ← ReadFileLine("DataFile.txt", FileLine) WHILE FileData <> "" IF LEFT(FileData, 7) = SearchString THEN Size ← LENGTH(FileData) NewData ← RIGHT(FileData,Size-7) ResultArray[NextArrayElement] ← NewData NextArrayElement ← NextArrayElement + 1 ENDIF FileLine ← FileLine + 1 FileData ← ReadFileLine("DataFile.txt", FileLine) ENDWHILE CALL ScanCompleted() RETURN FileLine ENDFUNCTION 1 mark for each of the following: 1 Function heading and ending including parameters and return statement 2 Local variable declarations for FileData and FileLine but NOT declaration of NextArrayElement 3 initialisation of FileLine and NextArrayElement (allow 0 or 1) 4 WHILE ... ENDWHILE loop 5 Comparing SearchString with first seven characters of FileData 6 Use of substring function and subtraction of 7 from length 7 Assign NewData to array ResultArray following attempt at MP6 8 Increment NextArrayElement and FileLine (as above) 8 4(c)(i) Through the use of: Subroutines / Functions / Procedures / Parameters / Methods 1 4(c)(ii) Reduces program complexity // easier to develop / test / debug // tasks may be re-used // tasks can be allocated to different programmers/teams (with different skills) // limited scope of local variables 1
Mark scheme, page 8
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 8 of 13 Question Answer Marks 4(d) Pseudocode solution included here for development and clarification of mark scheme. Programming language solutions appear at the end of this mark scheme. DECLARE ResultArray : ARRAY [1:100] OF STRING DECLARE Index: INTEGER FOR Index ← 1 TO 100 ResultArray[Index] ← "NO DATA" ENDFOR 1 mark for each of the following: • ResultArray declaration / commented in Python • Loop for 100 elements • «assignment of string "NO DATA" to indexed array element 3
Mark scheme, page 9
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 9 of 13 Question Answer Marks 5 PROCEDURE LineNumber(FileName: STRING, StartNumber: INTEGER, StepNumber: INTEGER) DECLARE FileData : STRING DECLARE Count : INTEGER DECLARE Reply : CHAR DECLARE Continue : BOOLEAN Count ← 0 Continue ← TRUE OPENFILE FileName FOR READ WHILE NOT EOF(FileName) AND Continue = TRUE READFILE FileName, FileData FileData ← NUM_TO_STRING(StartNumber) & ": " & FileData OUTPUT FileData Count ← Count + 1 IF Count = 20 THEN OUTPUT "Do you wish to continue?" INPUT Reply IF Reply = 'N' THEN Continue ← FALSE ELSE Count ← 0 ENDIF ENDIF StartNumber ← StartNumber + StepNumber ENDWHILE CLOSEFILE FileName ENDPROCEDURE 11
Mark scheme, page 10
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 10 of 13 Question Answer Marks 5 1 mark for each of the following to max 11: 1 Procedure heading including parameters 2 Declare an integer variable for the count 3 Open file in READ mode 4 Initialise Count variable before loop and increment in the loop (or other mechanism) 5 Loop including until EOF(FileName) (see note) 6 Call READFILE() in a loop 7 Convert StartNumber to string in a loop 8 Output concatenated string in a loop 9 Check if count = 20 10 Prompt and Input (inside an IF) 11 If user input = ‘N’ terminate loop 12 Add StepNumber to StartNumber 13 Close file *** End of Mark Scheme – program code solutions follow ***
Mark scheme, page 11
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 11 of 13 Program Code Solutions Q4 (b): Visual Basic Function ScanFile(SearchString As String) As Integer Dim FileData As String Dim FileLine As Integer Dim NewData As String Dim Size As Integer NextArrayElement = 1 FileLine = 1 FileData = ReadFileLine("DataFile.txt", FileLine) Do While FileData <> "" If Left(FileData, 7) = SearchString Then Size = Len(FileData) NewData = Right(FileData,Size-7) // NewData = Mid(FileData, 8, Size-7) ResultArray(NextArrayElement) = NewData NextArrayElement = NextArrayElement + 1 End If FileLine = FileLine + 1 FileData = ReadFileLine("DataFile.txt", FileLine) Loop Call ScanCompleted() ' Keyword "Call" OK but not required Return FileLine End Function
Mark scheme, page 12
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 12 of 13 Q4 (b): Pascal function ScanFile(SearchString : string) : integer; var FileData : string; FileLine : integer; NewData : string; Size : integer; begin NextArrayElement := 1; FileLine := 1; FileData := ReadFileLine('DataFile.txt', FileLine); while FileData <> '' do begin if leftstr(FileData, 7) = SearchString then begin Size := Length(FileData); NewData := rightstr(FileData,Size-7); ResultArray[NextArrayElement] := NewData; NextArrayElement := NextArrayElement + 1; end; FileLine := FileLine + 1; FileData := ReadFileLine("DataFile.txt", FileLine); end; ScanCompleted(); // Keyword "Call" not valid Return FileLine; // ScanFile := FileLine; end; Q4 (b): Python def scanfile(searchstring): # filedata : string # fileline : integer # newdata : string nextarrayelement = 1 fileline = 1 filedata = readfileline("datafile.txt", fileline) while filedata != "" : if filedata[:7] == searchstring: newdata = filedata[7:] resultarray[nextarrayelement] = newdata nextarrayelement = nextarrayelement + 1 fileline = fileline + 1 filedata = readfileline("datafile.txt", fileline) scancompleted() # keyword "call" not valid ??? return fileline
Mark scheme, page 13
9608/22 Cambridge International AS/A Level – Mark Scheme PUBLISHED October/November 2018 © UCLES 2018 Page 13 of 13 Q4 (d): Visual Basic Dim ResultArray(99) As String Dim Index As Integer For Index = 0 To 99 ResultArray(Index) = "NO DATA" Next Index Q4 (d): Pascal var ResultArray : array [1..100] of string; Index : integer; begin for Index := 1 to 100 do ResultArray[Index] := 'NO DATA'; end. Q4 (d): Python – alternative 1 of n #ResultArray[] as STRING Resultarray = ["NO DATA" for index in range(100)] Q4 (d): Python – alternative 2 of n #ResultArray[] as STRING ResultArray = [] For Index in range(100): ResultArray.append("NO DATA") Q4 (d): Python – alternative 3 of n # ResultArray[99] As String ResultArray = ["NO DATA"]*100
What you needed in this session
Cambridge’s own grade thresholds for 2018 Oct/Nov, Paper 2 · Variant 2. A higher threshold means an easier paper — the bar moves with how the cohort did.