A Level Computer Science 9618 Paper 22, 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/22 · May/June 2023

Download PDF
1

Refer to the insert for the list of pseudocode functions and operators. A program calculates the postal cost based on the weight of the item and its destination. Calculations occur at various points in the program and these result in the choice of several possible postal costs. The programmer has built these postal costs into the program. For example, the postal cost of $3.75 is used in the following lines of pseudocode: IF Weight < 250 AND ValidAddress = TRUE THEN ItemPostalCost <- 3.75 // set postal cost for item to $3.75 ItemStatus <- "Valid" // item can be sent ENDIF

a(i)

Identify a more appropriate way of representing the postal costs.

[1]
a(ii)

Describe the advantages of your answer to part (a)(i) with reference to this program.

[3]
b

The lines of pseudocode contain features that make them easier to understand. State three of these features. 1 2 3

[3]
c

Give the appropriate data types for the following variables: ValidAddress ItemPostalCost ItemStatus

[3]
2

A program stores a user's date of birth using a variable MyDOB of type DATE.

a

Write a pseudocode statement, using a function from the insert, to assign the value corresponding to 17/11/2007 to MyDOB.

[1]
b

MyDOB has been assigned a valid value representing the user's date of birth. Write a pseudocode statement to calculate the number of months from the month of the user's birth until the end of the year and to assign this to the variable NumMonths. For example, if MyDOB contains a value representing 02/07/2008, the value 5 would be assigned to NumMonths.

[2]
c

The program will output the day of the week corresponding to MyDOB. For example, given the date 22/06/2023, the program will output "Thursday". An algorithm is required. An array will be used to store the names of the days of the week. Define the array and describe the algorithm in four steps. Do not use pseudocode statements in your answer. Array definition Step 1 Step 2 Step 3 Step 4

[6]
3

A program stores data in a text file. When data is read from the file, it is placed in a queue.

a(i)

The diagram below represents an Abstract Data Type (ADT) implementation of the queue. Each data item is stored in a separate location in the data structure. During initial design, the queue is limited to holding a maximum of 10 data items. The operation of this queue may be summarised as follows: • The Front of Queue Pointer points to the next data item to be removed. • The End of Queue Pointer points to the last data item added. • The queue is circular so that locations can be reused. Describe how the data items Orange and Yellow are added to the queue shown in the diagram.

[4]
a(ii)

The following diagram shows the state of the queue after several operations have been performed. All queue locations have been used at least once. State the number of data items in the queue.

[1]
b

The design of the queue is completed and the number of locations is increased. A function AddToQueue() has been written. It takes a string as a parameter and adds this to the queue. The function will return TRUE if the string was added successfully. A procedure FileToQueue() will add each line from the file to the queue. This procedure will end when all lines have been added or when the queue is full. Describe the algorithm for procedure FileToQueue(). Do not use pseudocode in your answer.

[5]
4

A function GetNum() will: 1. take two parameters: a string and a character 2. count the number of times that the character occurs in the string 3. return the count. Any comparison between characters needs to be case sensitive. For example, character 'a' and character 'A' are not identical. Write pseudocode for function GetNum().

[6]
5

A programmer has produced the following pseudocode to output the square root of the numbers from 1 to 10. Line numbers are for reference only. 10 DECLARE Num : REAL 11 Num <- 1.0 ... 40 REPEAT 41 CALL DisplaySqrt(Num) 42 Num <- Num + 1.0 43 UNTIL Num > 10 ... 50 PROCEDURE DisplaySqrt(BYREF ThisNum : REAL) 51 OUTPUT ThisNum 52 ThisNum <- SQRT(ThisNum) // SQRT returns the square root 53 OUTPUT " has a square root of ", ThisNum 54 ENDPROCEDURE The pseudocode is correctly converted into program code. Function SQRT() is a library function and contains no errors. The program code compiles without errors, but the program gives unexpected results. These are caused by a design error.

a

Explain why the program gives unexpected results.

[3]
b

Explain why the compiler does not identify this error.

[1]
c

Describe how a typical Integrated Development Environment (IDE) could be used to identify this error.

[3]
d

The pseudocode is converted into program code as part of a larger program. During compilation, a complex statement generates an error. The programmer does not want to delete the complex statement but wants to change the statement so that it is ignored by the compiler. State how this may be achieved.

[1]
6

A procedure Square() will take an integer value in the range 1 to 9 as a parameter and output a number square. The boundary of a number square is made up of the character representing the parameter value. The inside of the number square is made up of the asterisk character (*). The pseudocode OUTPUT command starts each output on a new line. For example, the following three OUTPUT statements would result in the outputs as shown: OUTPUT "Hello" OUTPUT "ginger" OUTPUT "cat" Resulting output: Hello ginger cat Write pseudocode for procedure Square(). Parameter validation is not required.

[6]
7

A computer system for a shop stores information about each customer. The items of information include name and address (both postal and email) together with payment details and order history. The system also stores the product categories they are interested in and how they would like to be contacted.

Figure 1 of 1 for question 7
a(i)

The shop wants to add a program module that will generate emails to be sent to customers who may be interested in receiving details of new products. State three items of information that the new module would need. Justify your choice in each case. Information Justification Information Justification Information Justification

[3]
a(ii)

Identify two items of customer information that would not be required by the new module. Justify your choice in each case. Information Justification Information Justification

[2]
b

The program includes a module to validate a Personal Identification Number (PIN). This is used when customers pay for goods using a bank card. A state‑transition diagram has been produced for this module. The table show the inputs, outputs and states for this part of the program: Complete the state‑transition diagram to represent the information given in the table.

[4]
8

A computer shop assembles 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> Valid item information is as follows: The file is organised in ascending order of ItemNum and does not contain all possible values in the range. A programmer has started to define program modules as follows:

a

Write pseudocode for module CheckInfo(). Module OnlyAlpha() should be used as part of your solution.

[7]
b

A new module is defined as follows: As a reminder, the file Stock.txt is organised in ascending order of ItemNum and does not contain all possible values in the range. Write pseudocode for module AddItem().

[7]
c

The program contains modules SuppExists() and CheckSupplier(). These have been written but contain errors. These modules are called from several places in the main program and testing of the main program (integration testing) has had to stop. Identify a method that can be used to continue testing the main program before the errors in these modules have been corrected and describe how this would work. Method Description

[3]

Mark scheme

9618/22 · May/June 2023

Download PDF

1a(i) · 1 mark

  • 1 mark

    Use of constants

1a(ii) · 3 marks

  • 1 mark

    Postal rates are entered once only

  • 1 mark

    Avoids input error / changing the cost accidentally // avoids different values for postal rates at different points in the program

  • 1 mark

    When required, the constant representing the postal rate value is changed once only // easier to maintain the program when the postal rates change

1b · 3 marks

  • 1 mark

    Indentation

  • 1 mark

    White space

  • 1 mark

    Comments

1c · 3 marks

  • 1 mark

    BOOLEAN

  • 1 mark

    REAL

  • 1 mark

    STRING

2a · 1 mark

  • 1 mark

    MyDOB ← SETDATE(17, 11, 2007)

2b · 2 marks

  • 1 mark

    NumMonths ← 12 -

  • 1 mark

    MONTH(MyDOB)

2c · 6 marks

  • 1 mark

    A (1D) array containing 7 elements

  • 1 mark

    of type STRING

  • 1 mark

    Step1: Assign value "Sunday" to first element, "Monday" to second element etc.

  • 1 mark

    Step2: Use the function DAYINDEX() to return / find the day number from MyDoB

  • 1 mark

    Step3: Use the returned value as the array index / to access the element that contains the name / string

  • 1 mark

    Step4: Output the element / name / string

3a(i) · 4 marks

  • 1 mark

    Check that the queue is not full

  • 1 mark

    EoQ pointer will move to point to location 9

  • 1 mark

    Data item Orange will be stored in location referenced by EoQ pointer

  • 1 mark

    EoQ pointer will move to point to location 0 / Data item Yellow will be stored in location referenced by EoQ pointer

3a(ii) · 1 mark

  • 1 mark

    7

3b · 5 marks

  • 1 mark

    Open file in READ mode

  • 1 mark

    Loop to EOF() // read / process all the lines in file

  • 1 mark

    Loop will end when return value from AddToQueue() is FALSE / queue is full

  • 1 mark

    Read a line from the file in a loop

  • 1 mark

    Pass string to AddToQueue() // AddToQueue() is executed with line as parameter

4 · 6 marks

  • 1 mark

    Function heading and end, including parameters and return type

  • 1 mark

    Declare local Integers for Index and Count

  • 1 mark

    Loop for length of ThisString

  • 1 mark

    Extract a character and compare with parameter in a loop

  • 1 mark

    Increment Count if match in a loop

  • 1 mark

    Return Count after loop

5a · 3 marks

  • 1 mark

    parameter / Num has been passed by reference // should have been passed by value

  • 1 mark

    so when the value / ThisNum is modified (in procedure DisplaySqrt())

  • 1 mark

    the new value will be used in the loop (lines 40–43) // Num will be changed to modified value

5b · 1 mark

  • 1 mark

    The rules of the language have not been broken // there are no syntax errors

5c · 3 marks

  • 1 mark

    Set a breakpoint to stop the program at a certain line / statement / point

  • 1 mark

    Step through the program line by line / statement by statement

  • 1 mark

    checking the value of 'num' / a variable using a report / watch window

5d · 1 mark

  • 1 mark

    Change the statement into a comment // Change the statement to a string representing a literal value and assign it to a variable / output it

6 · 6 marks

  • 1 mark

    Procedure heading and ending including parameter

  • 1 mark

    Loop using parameter, containing attempt to construct first line / last line // Correct use of parameter to select all required squares

  • 1 mark

    Construct first line / last line // Correct output of first two squares

  • 1 mark

    Attempt at loop to construct intermediate line // At least six squares correctly output

  • 1 mark

    Output first / last line of square when Dim > 2 // At least one loop to output lines with multiple asterisks

  • 1 mark

    Output all intermediate lines in a loop / Correct output of first two squares // All number squares output correctly

7a(i) · 3 marks

  • 1 mark

    Information: customer name; Justification: to personalise / address the email

  • 1 mark

    Information: email address; Justification: so that the email can be delivered correctly

  • 1 mark

    Information: product category preference; Justification: to check that the customer would be interested in the product

7a(ii) · 2 marks

  • 1 mark

    postal address; Justification: sending an email, not a letter

  • 1 mark

    payment details; Justification: Nothing being bought / sold at this stage

7b · 4 marks

  • 1 mark

    Line from S1 to S2 and label

  • 1 mark

    S2 loop label

  • 1 mark

    S3 circle and label on incoming

  • 1 mark

    S4 circle and label on incoming

8a · 7 marks

  • 1 mark

    Test length of parameter

  • 1 mark

    Extract first 4 characters of parameter (as ItemNum)

  • 1 mark

    Test first four characters are all numeric

  • 1 mark

    Test ItemNum in range "0001" to "5999"

  • 1 mark

    Extract characters 5 to 7 of parameter (as SupplierCode)

  • 1 mark

    Use of OnlyAlpha() with extracted SupplierCode

  • 1 mark

    Return BOOLEAN value correctly in all cases, must have been declared as local

8b · 7 marks

  • 1 mark

    Open both files, in correct modes, and subsequently close

  • 1 mark

    Conditional loop until end of file Stock.txt // Declare AND initialise Temp array

  • 1 mark

    Read a line from Stock.txt AND extract ThisItemNum in a loop // Store NewLine in appropriate array element

  • 1 mark

    Test ThisItemNum > NewItemNum then write NewLine to NewStock.txt // Loop until end of file Stock.txt

  • 1 mark

    ...including mechanism to only do this once only // Read a line from Stock.txt AND extract Index in a loop

  • 1 mark

    Write line read from Stock to NewStock // Assign line read to appropriate array element in a loop

  • 1 mark

    Deal with the case where NewLine is the new last line // Loop through array, writing non-blank elements to file NewStock.txt

8c · 3 marks

  • 1 mark

    Method: Stub testing

  • 1 mark

    The modules SuppExists() and CheckSupplier() are replaced by dummy modules

  • 1 mark

    ...which return a known result / contain an output statement to show they have been called

Questions

  1. 1
    Question 110 marks
    Mark scheme ›
  2. 2
    Question 29 marks
    Mark scheme ›
  3. 3
    Question 310 marks
    Mark scheme ›
  4. 4
    Question 46 marks
    Mark scheme ›
  5. 5
    Question 58 marks
    Mark scheme ›
  6. 6
    Question 66 marks
    Mark scheme ›
  7. 7
    Question 79 marks
    Mark scheme ›
  8. 8
    Question 817 marks
    Mark scheme ›

More 9618 papers

Other papers from May/June 2023

Solve it on ExamPalStart