2
Assignment
Refer to the insert for the list of pseudocode functions and operators.
1 (a) (i) Complete the following table by giving the appropriate data type in each case.
Variable Example data value Data type
Name "Catherine"
Index 100
Modified FALSE
Holiday 25/12/2020
[4]
(ii) Evaluate each expression in the following table by using the initial data values shown in
part (a)(i).
Expression Evaluates to
Modified OR Index > 100
LENGTH("Student: " & Name)
INT(Index + 2.9)
MID(Name, 1, 3)
[4]
(b) Each pseudocode statement in the following table contains an example of selection,
assignment or iteration.
Put one tick (‘✓’) in the appropriate column for each statement.
Statement Selection Assignment Iteration
Index Index + 1
IF Modified = TRUE THEN
ENDWHILE
[3]
© UCLES 2021 9618/22/M/J/21
3
2 (a) Examine the following state-transition diagram.
Low level detected | Activate pump
Low level detected
X S2
S1
Normal level detected Normal level detected | Deactivate pump
S3
(i) Complete the table with reference to the diagram.
Answer
The number of transitions that result in a different state
The number of transitions with associated outputs
The label that should replace ‘X’
The final or halting state
[4]
(ii) The current state is S1. The following inputs occur.
1. Low level detected
2. Low level detected
3. Low level detected
4. Low level detected
Give the number of outputs and the current state.
Number of outputs .............................................................................................................
Current state .....................................................................................................................
[2]
© UCLES 2021 9618/22/M/J/21 [Turn over
5
3 The following diagram represents an Abstract Data Type (ADT).
A B
Dolphin Cat Fish Elk
(a) Identify this type of ADT.
............................................................................................................................................. [1]
(b) Give the technical term for the item labelled A in the diagram.
............................................................................................................................................. [1]
(c) Give the technical term for the item labelled B in the diagram.
Explain the meaning of the value given to this item.
Term ..........................................................................................................................................
Meaning ....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[2]
(d) Complete the diagram to show the ADT after the data has been sorted in alphabetical order.
Dolphin Cat Fish Elk
[2]
© UCLES 2021 9618/22/M/J/21 [Turn over
6
4 A teacher uses a paper-based system to store marks for a class test. The teacher requires a
program to assign grades based on these results.
The program will output the grades together with the average mark.
Write a detailed description of the algorithm that will be needed.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [6]
© UCLES 2021 9618/22/M/J/21