Cambridge International Advanced Subsidiary and Advanced Level
Cambridge International Advanced Subsidiary and Advanced Level
Cambridge International Advanced Subsidiary and Advanced Level
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.
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.
DC (ST/JG) 144340
© UCLES 2017 [Turn over
2
Description: ...................................................................................
.......................................................................................................
Input
Pseudocode example: ..................................................................
.......................................................................................................
Description: ...................................................................................
.......................................................................................................
....................
Pseudocode example: ..................................................................
.......................................................................................................
Description: ...................................................................................
.......................................................................................................
....................
Pseudocode example: ..................................................................
.......................................................................................................
[7]
(b) (i) AND and OR are two operators that may be used when implementing an algorithm.
An example of their use is given in the following pseudocode statement:
.......................................................................................................................................[1]
(ii) State the name given to the type of operators to which AND and OR belong.
.......................................................................................................................................[1]
(iii) Evaluate the expressions given in the following table when the variable values are as
follows:
FlagA TRUE
FlagB FALSE
FlagC TRUE
Expression Evaluates to
Using pseudocode, write a pre-condition loop to output all of the even numbers between 99
and 201.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
2 One of the security features of a multi-user computer system is a user login process. The user
must complete this successfully before they can access the resources of the system.
As part of the login process the user enters their user ID followed by a password. The system then
compares the password entered with the password held in a file.
(a) The steps involved in the login process are described as follows:
The description above is not detailed enough to allow a program to be written. The validation
checks must be expressed as a more detailed algorithm.
Give the name of the process of increasing the level of detail of the algorithm.
...............................................................................................................................................[1]
(b) An identifier table is created as the algorithm is developed. A section of the table is shown.
Complete the table.
........................................................................
PasswordInput ...................
........................................................................
........................................................................
UserIDFound ...................
........................................................................
........................................................................
PasswordValid ...................
........................................................................
[5]
(c) The validation checks described in part (a) are to be used as the basis for program code.
You should:
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[8]
This function will form a new string, OutString, from a given string, InString, by:
For example:
The first attempt at writing the pseudocode for this function is shown below.
For the built-in functions list, refer to the Appendix on page 14.
THEN
ENDIF
ENDFOR
............................................//return value
ENDFUNCTION
[11]
State three pieces of information that a structure chart can convey about a program design.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...................................................................................................................................................
[3]
Checkout
B A
Card Account
payment payment
Examples of the data items that correspond to the arrows are given in this table:
Use pseudocode to write the function header for the Card payment module.
...................................................................................................................................................
...............................................................................................................................................[3]
5 A multi-user computer system records user login information in a text file, LoginFile.txt. Each
time a user successfully logs into the system, the following information is recorded:
The data items are concatenated to form a single string. Each string is saved as a separate line in
the text file.
The example data in the preceding table would result in the following text line in the file:
"JimAA345608:30Jun012015"
The computer system can produce a list of the successful login attempts by a given user.
The file LoginFile.txt is searched for a given user ID and the corresponding data are copied
into a 2D array, LoginEvents.
A procedure, SearchFile, is needed to search the file and copy selected data to the array.
• the system initialises all elements of LoginEvents to an empty string " ", before it calls
SearchFile
• there will be no more than 1000 successful logins for a single user.
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.
Program code
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
....................................................................................................................................................[10]
© UCLES 2017 9608/23/M/J/17 [Turn over
10
A function, ValidatePassword, is needed to check that a given password follows these rules.
This function takes a string, Pass, as a parameter and returns a Boolean value:
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.
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................[10]
Give a valid string to check that the function returns TRUE under the correct conditions.
String1: ..............................................................................................................................
Modify the valid string given for String1 to test each rule separately.
String2: ..............................................................................................................................
Explanation: ......................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
String3: ..............................................................................................................................
Explanation: ......................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
String4: ..............................................................................................................................
Explanation: ......................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
String5: ..............................................................................................................................
Explanation: ......................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[5]
(ii) When testing a module, it is necessary to test all possible paths through the code.
.......................................................................................................................................[1]
(iii) A program consisting of several modules may be tested using a process known as
stub testing.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[2]
Appendix
Built-in functions (pseudocode)
In each function, if the function call is not properly formed, the function returns an error.
returns the character value representing the lower case equivalent of ThisChar.
If ThisChar is not an upper-case alphabetic character then it is returned unchanged.
Example: LCASE('W') returns 'w'
returns the integer value representing the remainder when ThisNum is divided by ThisDiv.
Example: MOD(10,3) returns 1
returns the integer value representing the whole number part of the result when ThisNum is divided
by ThisDiv.
Example: DIV(10,3) returns 3
Operators (pseudocode)
Operator Description
Concatenates (joins) two strings.
&
Example: "Summer" & " " & "Pudding" produces "Summer Pudding"
Performs a logical AND of two Boolean values.
AND
Example: TRUE AND FALSE produces FALSE
Performs a logical OR of two Boolean values.
OR
Example: TRUE OR FALSE produces TRUE
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 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.