A Level Computer Science 9618 Paper 23, May/June 2023

Question paper and mark scheme75 marks8 questions

Solve it on ExamPal

Practise

Untimed. Write on the paper and check as you go.

Start

Exam

Timed, with a clock you set, like sitting the real paper.

Start

Opens full screen.

Papers open in

Opening the question paper

Read as textThe questions and the mark scheme as plain text. Easier to read on a phone.

Question paper

9618/23 · May/June 2023

Download PDF
1

The following pseudocode represents part of the algorithm for a program. Line numbers are for reference only. 10 DECLARE Sheet4 : ARRAY[1:2, 1:50] OF INTEGER … 100 FOR PCount ← 0 TO 49 101 Sheet4[1, PCount] ← 0 102 Sheet4[2, PCount] ← 47 103 NEXT PCount

a

The pseudocode contains references to an array. Complete the table by writing the answer for each row. Answer The dimension of the array The name of the variable used as an array index The number of elements in the array

[3]
b

The pseudocode contains two errors. One error is that variable PCount has not been declared. Identify the other error and state the line number where it occurs. Error .......................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... Line number ..............................................................................................................................

[2]
c

The pseudocode does not include a declaration for PCount. State the data type that should be used in the declaration.

[1]
d

The pseudocode statements given in the following table are used in other parts of the algorithm. Complete the table by placing one or more ticks (✓) in each row. The first row has already been completed. Pseudocode statement | Input | Process | Output INPUT MyChoice | ✓ | | OUTPUT FirstName & LastName | | | WRITEFILE YourFile, TextLine | | | READFILE MyFile, TextLine | | | Result ← SQRT(NextNum) | | |

[4]
2

A program stores a date of birth for a student using a variable, MyDOB, of type DATE.

a

MyDOB has been assigned a valid value corresponding to Kevin’s date of birth. Complete the pseudocode statement to test whether Kevin was born on a Thursday. IF ........................................................................................................................ THEN

[2]
b(i)

A function CheckDate() will take three integer parameters representing a day, month and year of a given date. The function will validate the date of birth for a student that the parameters passed to it represent. For a date to be valid, a student must be at least 18 in year 2020. Two of the parameter values can be checked without reference to the third parameter. Describe these two checks. Check 1 ............................................................................................................................. ........................................................................................................................................... ........................................................................................................................................... Check 2 ............................................................................................................................. ........................................................................................................................................... ........................................................................................................................................... ...........................................................................................................................................

[2]
b(ii)

Several values of the parameter representing the day can only be checked completely by referring to the value of one other parameter. Describe this check.

[2]
3

A program processes data using a stack. The data is copied to a text file before the program ends.

a(i)

The following diagram shows the current state of the stack. The operation of this stack may be summarised as follows: • The TopOfStack pointer points to the last item added to the stack. • The BottomOfStack pointer points to the first item on the stack. • The stack grows upwards when items are added. Stack Pointer Memory location | Value 506 | 505 | WWW ← TopOfStack 504 | YYY 503 | XXX 502 | ZZZ 501 | NNN 500 | PPP ← BottomOfStack An error will be generated if an attempt is made to POP a value when the stack is empty. State the maximum number of consecutive POP operations that could be performed on the stack shown above before an error is generated.

[1]
a(ii)

The following operations are performed: 1. POP and store value in variable Data1 2. POP and store value in variable Data2 3. PUSH value AAA 4. PUSH value BBB 5. POP and discard value 6. POP and store value in variable Data2 Complete the diagram to show the state of the stack and the variables after the given operations have been performed.

[4]
b(i)

The data is copied to a text file before the program ends. State an advantage of writing the data from the stack to a text file before the program ends.

[1]
b(ii)

A module SaveStack() will write the data from the stack to a text file. Express an algorithm for SaveStack() as five steps that could be used to produce pseudocode. Write the five steps. Step 1 ................................................................................................................................ ........................................................................................................................................... Step 2 ................................................................................................................................ ........................................................................................................................................... Step 3 ................................................................................................................................ ........................................................................................................................................... Step 4 ................................................................................................................................ ........................................................................................................................................... Step 5 ................................................................................................................................ ...........................................................................................................................................

[5]
4

A function MakeString() will: 1. take two parameters: • a count as an integer • a character 2. generate a string of length equal to the count, made up of the character 3. return the string generated, or return "ERROR" if the count is less than 1. For example, the function call: MakeString(3, 'Z') will return the string "ZZZ" Write pseudocode for function MakeString().

[6]
5

A program is designed, coded and compiled without errors. The compiled code is sent for testing.

a

The program will be tested using the walkthrough method. Additional information will be needed before this method can be used. Identify this additional information and explain why it is needed. Additional information ............................................................................................................... ................................................................................................................................................... Explanation ............................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ...................................................................................................................................................

[3]
b

Testing is completed and the program is made available to users. Some time later, changes are made to the program to improve the speed of response. State the type of maintenance that has been applied to the program.

[1]
6

A procedure Select() will: 1. take two integer values as parameters representing start and end values where both values are greater than 9 and the end value is greater than the start value 2. output each integer value between the start and the end value (not including the start and end values), where the sum of the last two digits is 6, for example, 142.

a

Write pseudocode for procedure Select(). Parameter validation is not required.

[7]
b

The check performed by procedure Select() on the last two digits is needed at several places in the program and will be implemented using a new function. The new function CheckNum() will: • allow the required sum to be specified (not just 6) • check one number • return an appropriate value. Describe the function interface and two advantages of this modular approach. Interface .................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... Advantage 1 ............................................................................................................................. ................................................................................................................................................... Advantage 2 ............................................................................................................................. ...................................................................................................................................................

[4]
7

A school has a library system which allows students to borrow books for a length of time. Information relating to students and books is stored in text files. Student information includes name, home address, email address, date of birth, tutor and subject choices. Book information includes author, title, subject category, library location and the date that the book was borrowed. A program helps the staff to manage the borrowing of books.

Figure 1 of 1 for question 7
a(i)

A new module needs to be written to generate emails to send to students who have an overdue book. Students who are sent an email are prevented from borrowing any more books until the overdue book is returned. The process of abstraction has been used when designing the new module. State the purpose of applying abstraction to this problem.

[1]
a(ii)

Identify one item of information that is required and one item that is not required in the new module. Justify your choices. Item required ..................................................................................................................... Justification ....................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... Item not required ............................................................................................................... Justification ....................................................................................................................... ........................................................................................................................................... ...........................................................................................................................................

[2]
a(iii)

Identify two operations that would be required to process data when an overdue book is returned. Operation 1 ....................................................................................................................... ........................................................................................................................................... Operation 2 ....................................................................................................................... ...........................................................................................................................................

[2]
b

Part of the library program contains program modules with headers as follows: Pseudocode module header PROCEDURE Module-X() PROCEDURE Module-Y(BYREF RA : INTEGER, SA : REAL) PROCEDURE Overlay() FUNCTION Replace(RA : INTEGER, RB : BOOLEAN) RETURNS BOOLEAN FUNCTION Reset(TA : STRING) RETURNS INTEGER Module-X() and Module-Y() are both called from module Overlay(). Complete the structure chart.

[3]
8

A computer shop assembles desktop computers, using items bought from several suppliers. A text file Stock.txt contains information about each item. Information for each item is stored as a single line in the Stock.txt file in the format: <ItemNum><SupplierCode><Description> Item information is as follows: Format | Comment ItemNum | 4 numeric characters | unique number for each item in the range “0001” to “5999” inclusive SupplierCode | 3 alphabetic characters | code to identify the supplier of the item Description | a string | a minimum of 12 characters The file is organised in ascending order of ItemNum and does not contain all possible values in the range. The programmer has defined the first program module as follows: Module | Description ChangeSupp() | • called with two parameters Code1 and Code2 of type string that represent valid supplier codes • creates a new file NewStock.txt from the contents of the file Stock.txt where any reference to Code1 is replaced by Code2 • returns a count of the number of items that have had their supplier code changed

a

Write pseudocode for module ChangeSupp().

[8]
b

A new module is required: Module | Description Report_1() | • takes a parameter of type string that represents a SupplierCode • searches the Stock.txt file for each line of item information that contains the given SupplierCode • produces a formatted report of items for the given SupplierCode, for example, for supplier DRG, the output could be: Report for Supplier: DRG Item Description 1234 USB Printer Cable 3m 1273 32GB USB Flash Drive 1350 Mouse Mat 320 x 240mm Number of items listed: 3 Write pseudocode for module Report_1().

[6]
c(i)

The format of the output from module Report_1() from part (b) is changed. The number of items listed is moved to the top of the report as shown in the example: Report for Supplier: DRG Number of items listed: 3 Item Description 1234 USB Printer Cable 3m 1273 32GB USB Flash Drive 1350 Mouse Mat 320 x 240mm Explain why this new layout would increase the complexity of the algorithm.

[2]
c(ii)

The algorithm will be modified to produce the report in the new format. The modified algorithm will be implemented so that the file Stock.txt is only read once. Describe the modified algorithm.

[3]

Mark scheme

9618/23 · May/June 2023

Download PDF

1a · 3 marks

  • 1 mark

    The dimension of the array: 2

  • 1 mark

    The name of the variable used as an array index: PCount

  • 1 mark

    The number of elements in the array: 100

1b · 2 marks

  • 1 mark

    The (second dimension/index of the) array is declared from 1 to 50 but the loop runs from 0 to 49

  • 1 mark

    Line number: 10 / 100 / 101 / 102

1c · 1 mark

  • 1 mark

    Integer

1d · 4 marks

  • 1 mark

    OUTPUT FirstName & LastName: Process and Output

  • 1 mark

    WRITEFILE OutputFile, TextLine: Output

  • 1 mark

    READFILE MyFile, TextLine: Input

  • 1 mark

    Result  SQRT(NextNum): Process

2a · 2 marks

  • 1 mark

    DAYINDEX(MyDOB)

  • 1 mark

    = 5

2b(i) · 2 marks

  • 1 mark

    Value for month is between 1 and 12 (inclusive)

  • 1 mark

    Value of year is <= 2002

2b(ii) · 2 marks

  • 1 mark

    Reference to month and day

  • 1 mark

    Clear description for a check that the day number matches with a relevant month (Either day matches with month // month matches with day)

3a(i) · 1 mark

  • 1 mark

    6

3a(ii) · 4 marks

  • 1 mark

    Values 'BBB' and 'AAA'

  • 1 mark

    Values 'XXX' to 'PPP' (unchanged)

  • 1 mark

    Both pointers and labelled22

  • 1 mark

    Values of both variables

3b(i) · 1 mark

  • 1 mark

    So that the data may be recovered / restored (the next time the program is run) // the data is permanently saved / data is not lost when the program terminates

3b(ii) · 5 marks

  • 1 mark

    Open the text file in WRITE mode

  • 1 mark

    Check there is a value on the stack

  • 1 mark

    POP value …. / Read value from ToS location

  • 1 mark

    Write value to the text file / Write the value to the text file – Must some attempt at ‘the value’ NOT ‘all the values’

  • 1 mark

    Repeat from Step 2 // loop referencing the stack items / Decrement ToS and Repeat from step 2

4 · 6 marks

  • 1 mark

    Function heading and end including parameters and return type

  • 1 mark

    Declaration of locals Index and MyString

  • 1 mark

    Test for Count < 1 and if true, assign "ERROR" to MyString / Immediate RETURN

  • 1 mark

    Loop for Count iterations

  • 1 mark

    Use of concatenate – must have been initialised in a loop

  • 1 mark

    Return STRING (correctly in both cases)

5a · 3 marks

  • 1 mark

    Additional Information: The (program/source) code/specification

  • 1 mark

    Additional Information: test plan // inputs/test data and expected outputs

  • 1 mark

    Explanation: The structure / design / algorithm of the program needs to be known / so that all paths through the program can be tested

5b · 1 mark

  • 1 mark

    Perfective

6a · 7 marks

  • 1 mark

    Procedure heading and ending

  • 1 mark

    (Count-controlled) Loop

  • 1 mark

    …. with correct range from Start+1 to End-1

  • 1 mark

    Convert ThisNum (loop counter) to a string

  • 1 mark

    Extract the last two/first/second 'character digit(s)' required in a loop

  • 1 mark

    Extract the second individual 'character digit' required in a loop

  • 1 mark

    Calculate the sum of the last two digits / If sum = 6 then OUTPUT the number (either string or integer) in a loop

6b · 4 marks

  • 1 mark

    The function will take two integer parameters - the number and the (required) total

  • 1 mark

    … and return a Boolean

  • 1 mark

    CheckNum() can be called repeatedly as and when required

  • 1 mark

    CheckNum() is designed and tested once (then used repeatedly) / Any subsequent change to CheckNum() needs to be made once only // is easier to maintain/modify

7a(i) · 1 mark

  • 1 mark

    To filter out information (that is not necessary to solve the problem) // to include only essential information

7a(ii) · 2 marks

  • 1 mark

    Required items correctly identified

  • 1 mark

    Not required items correctly identified

7a(iii) · 2 marks

  • 1 mark

    Clear the loan // indicate that the book has been returned // update loan history

  • 1 mark

    Take the student off 'block' // allow the student to borrow further books // Send acknowledgement to the student when book is returned

7b · 3 marks

  • 1 mark

    All modules correctly labelled and interconnected.

  • 1 mark

    Correct parameters and return type to Module-X and Reset

  • 1 mark

    Correct parameters and return type to Module-Y and Replace / Overlay and Module-Y

8a · 8 marks

  • 1 mark

    Open both files, in correct modes, and subsequently close

  • 1 mark

    Conditional loop until EOF(“Stock.txt”)

  • 1 mark

    Read a line from Stock.txt AND extract ThisCode in a loop

  • 1 mark

    Test ThisCode = Code1 AND if true, increment Count (must have been Initialised) in a loop

  • 1 mark

    Update ThisLine using substring functions and '&' in a loop

  • 1 mark

    completely correct update of ThisLine in a loop

  • 1 mark

    Write ThisLine to NewStock.txt in a loop

  • 1 mark

    Return count after loop

8b · 6 marks

  • 1 mark

    Output report header (blank lines optional) – Must contain the parameter code

  • 1 mark

    Conditional loop until EOF("Stock.txt")

  • 1 mark

    Read a line from Stock.txt AND extract SupplierCode in a loop

  • 1 mark

    Test if SupplierCode = Supp then increment count (must have been Initialised)

  • 1 mark

    Extract AND output item and description in a loop

  • 1 mark

    Output the final line with count

8c(i) · 2 marks

  • 1 mark

    Must ‘calculate’ the count before any item + description output / after the file is read once

  • 1 mark

    Lines to be output have to be stored … / The file has to be read twice

8c(ii) · 3 marks

  • 1 mark

    Loop through the file calculating the count / Save ‘selected’ items in an array

  • 1 mark

    (After all lines have been read), output the header lines / count

  • 1 mark

    Loop through the array to output each array element

Questions

  1. 1
    Question 110 marks
    Mark scheme ›
  2. 2
    Question 26 marks
    Mark scheme ›
  3. 3
    Question 311 marks
    Mark scheme ›
  4. 4
    Question 46 marks
    Mark scheme ›
  5. 5
    Question 54 marks
    Mark scheme ›
  6. 6
    Question 611 marks
    Mark scheme ›
  7. 7
    Question 78 marks
    Mark scheme ›
  8. 8
    Question 819 marks
    Mark scheme ›

More 9618 papers

Other papers from May/June 2023

Solve it on ExamPalStart