Professional Documents
Culture Documents
9618 s24 Ms 22 Zak-3
9618 s24 Ms 22 Zak-3
Zak-
Hom es + 786
* 2 3 2 3 4 6 9 7 5 8 *
2 hours
INSTRUCTIONS
● Answer all questions.
● Use a black or dark blue pen.
● Write your name, centre number and candidate number in the boxes at the top of the page.
● Write your answer to each question in the space provided.
● Do not use an erasable pen or correction fluid.
● Do not write on any bar codes.
● You may use an HB pencil for any diagrams, graphs or rough working.
● Calculators must not be used in this paper.
INFORMATION
● The total mark for this paper is 75.
● The number of marks for each question or part question is shown in brackets [ ].
● No marks will be awarded for using brand names of software packages or hardware.
● The insert contains all the resources referred to in the questions.
DC (PQ/CGW) 329350/3
© UCLES 2024 [Turn over
2
Refer to the insert for the list of pseudocode functions and operators.
Each example may contain statements that relate to one or more of the following:
• selection
• iteration (repetition)
• input/output.
Complete the table by placing one or more ticks (3) in each row.
MyChar CHAR
MyString STRING
MyInt INTEGER
Complete the table by filling in each gap with a function (from the insert) so that each expression
is valid.
Expression
MyChar MID
.......................................... ("Elwood", 3, 1)
MyString NUM-TO-STR
.......................................... INT (27.509))
( ..........................................
(c) The variables given in part (b) are chosen during the design stage of the program development
life cycle.
State a suitable way of documenting the variables and give one piece of information that
should be recorded, in addition to the data type.
Identifier Table
...................................................................................................................................................
............................................................................................................................................. [2]
Assume the values are all different and are input in no particular order.
START
IS
NUMA> Num] AND No
Num1) Num3
&
Yes Is
Num2) Num1
AND No
Yes
output "The
Largectis" . Ans , "and
the
average is
"Ang
END
[5]
(b) A different part of the program contains an algorithm represented by the following program
flowchart:
START
Is Flag = Yes
TRUE ?
No END
Set Port to 1
No
Is Port = 4 ?
CALL Reset(Port)
Yes
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [5]
© UCLES 2024 9618/22/M/J/24
7
The data for each item will be held in a record structure of type Component.
The programmer has started to define the fields that will be needed as shown in the table.
(a) (i) Write pseudocode to declare the record structure for type Component.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [4]
(ii) A 1D array Item of 2000 elements will store the data for all items.
..................................................................................................................................... [2]
(b) State three benefits of using an array of records to store the data for all items.
...................................................................................................................................................
Allows for iteration over the items
.
easily
3 ................................................................................................................................................
...................................................................................................................................................
[3]
© UCLES 2024 9618/22/M/J/24 [Turn over
8
B C
A × A = (B × B) + (C × C)
A procedure will be written to check whether three lengths represent a right-angled triangle.
The lengths will be input in any sequence.
The length of the longest side may not be the first value input.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
.................................................................................................................................................... [5]
The program contains a global 1D array Data of type string containing 200 elements.
#g
Syntax error 1 ....................................................................................................................
...........................................................................................................................................
*
Syntax error 2 ....................................................................................................................
...........................................................................................................................................
It will accen
# array element O ,
Other error .........................................................................................................................
3
which doesn't exist .
...........................................................................................................................................
[3]
used [2]
(b) After correcting all syntax errors, the pseudocode is translated into program code which
compiles without generating any errors.
6 A music player stores music in a digital form and has a display which shows the track being
played.
(a) Up to 16 characters can be displayed. Track titles longer than 16 characters will need to be
trimmed as follows:
• Words must be removed from the end of the track title until the resulting title is less than
14 characters.
• When a word is removed, the space in front of that word is also removed.
• Three dots are added to the end of the last word displayed when one or more words
have been removed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Bohemian Symphony B o h e m i a n . . .
Paperbook Writer P a p e r b o o k W r i t e r
Assume:
• Words in the original title are separated by a single space character.
• There are no spaces before the first word or after the last word of the original title.
• The first word of the original title is less than 14 characters.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [7]
The samples are to be stored in a text file. Each sample is converted to a numeric string and
32 samples are concatenated (joined) to form a single line of the text file.
Each numeric string is 8 characters in length; leading ‘0’ characters are added as required.
Example:
32 673 "00000673"
The example samples will be stored in the text file as a single line:
"000004560000004800037652...00000673"
(i) Identify one drawback of adding leading ‘0’ characters to each numeric string.
A
very large file is created as redundant zeros
...........................................................................................................................................
are stored
..................................................................................................................................... [1]
(ii) Suggest an alternative method of storing the samples which does not involve adding
leading ‘0’ characters but which would still allow each individual sample to be extracted.
Valves are separated by a
special character .
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [1]
(iii) State one drawback of the alternative method given in part (b)(ii).
The algorithm will become
complex as will
...........................................................................................................................................
extract individual values It takes longer
.....................................................................................................................................
.
[1]
BLANK PAGE
The system stores information for each club member: name, home address, email address, mobile
phone number, date of birth and exercise preferences.
Many classes are full, and the club creates a waiting list for each class. The club adds details of
members who want to join a class that is full to the waiting list for that class.
When the system identifies that a space is available in one of the classes, a new module will send
a text message to each member who is on the waiting list.
(a) Decomposition will be used to break the new module into sub-modules (sub-problems).
Identify three sub-modules that could be used in the design and describe their use.
Identify Member((
Sub-module 1 ...........................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
GetMember PhoneNumber()
Sub-module 2 ...........................................................................................................................
Gets the mobile number of the member
Use ...........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Create
message()
Sub-module 3 ...........................................................................................................................
Generates a text to member
message a
Use ...........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
[3]
(b) A different part of the program is represented by the following state-transition diagram.
Input-B | Output-W
Input-B
Input-B
START
S1 S3 S2 S5
Input-A
Input-A Input-A | Output-W
Input-B | Output-Y
Input-A | Output-X
S4
(i) Complete the table to show the inputs, outputs and next states.
Assume that the current state for each row is given by the ‘Next state’ on the previous
row. For example, the first Input-A is made when in state S1.
If there is no output for a given transition, then the output cell should contain ‘none’.
S1
Input-A none S3
Input-A Output-W S3
Input-B none S2
Input-B none 55
Input-A none S2
Input-A Output-X S4
[5]
(ii) Identify the input sequence that will cause the minimum number of state changes in the
transition from S1 to S4.
Input-By Input-A
..................................................................................................................................... [1]
The process is split into a number of stages. Each stage performs a different task and creates a
new file.
For example:
(a) Suggest a reason why the teacher’s program has been split into a number of stages and give
the benefit of producing a different file from each stage.
Easier to design , implement ,
feet , and modify each
Reason .....................................................................................................................................
Stage
-
...................................................................................................................................................
Easier to check the stage has produced the
Benefit ......................................................................................................................................
expected output
...................................................................................................................................................
[2]
(b) The teacher has defined the first program module as follows:
Module Description
DeleteSpaces() • called with a parameter of type string representing a line of
pseudocode from a student’s project file
• returns the line after removing any leading space characters
The following example shows a string before and after the leading
spaces have been removed:
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
ENDFUNCTION [6]
Module Description
DeleteComment() • called with a parameter of type string representing a line of
(already written) pseudocode from a student’s project file
• returns the line after removing any comment
Stage_2() • called with two parameters:
○ a string representing an input file name
○ a string representing an output file name
• copies each line from the input file to the existing output file having
first removed all leading spaces and comments from that line
• does not write blank lines to the output file
• outputs a final message giving the number of blank lines removed
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [8]
BLANK PAGE
BLANK PAGE
BLANK 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
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.