Question 6(b) 2017 · May-June · Paper 22 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (b)
Question 5
- Correct length (between 6 and 9 characters)
- 3 capital letters followed by«
- 2 numeric characters followed by«
- between 1 and 4 capital letters
Show text version of question
Question 6
Part (b)
Question 6
A computerised vehicle licensing system stores details about vehicles and their registration marks
(number plates or license plates).
To be valid, a vehicle registration must comply with the following rules:
- It must be between six and nine characters long.
- Characters 1 to 3 are upper case alphabetic characters.
- Characters 4 to 5 are numeric characters.
- Remaining characters are upper case alphabetic.
these rules. This function takes a string, Registration as a parameter and returns a Boolean value:
- TRUE if it is a valid registration
- FALSE otherwise.
Part (b)
The function is to be tested.
Give a valid string that could be used to check that the function returns TRUE under the correct conditions.
String1: .....................................................................................................................................
Modify your valid String1 to test each rule separately.
Explain your choice in each case.
String2: .....................................................................................................................................
Explanation: ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
String3: .....................................................................................................................................
Explanation: ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
String4: .....................................................................................................................................
Explanation: ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
String5: .....................................................................................................................................
Explanation: ..............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Question 13
Appendix
Built-in functions (pseudocode) In each function, if the function call is not properly formed, the function returns an error.
RIGHT(ThisString : STRING, x : INTEGER) RETURNS STRING
returns rightmost x characters from ThisString. Example: RIGHT("ABCDEFGH", 3) returns string "FGH"
LENGTH(ThisString : STRING) RETURNS INTEGER
returns the integer value representing the length of string ThisString. Example: LENGTH("Happy Days") returns 10
MID(ThisString : STRING, x : INTEGER, y : INTEGER) RETURNS STRING
returns string of length y starting at position x from ThisString. Example: MID("ABCDEFGH", 2, 3) returns string "BCD"
LCASE(ThisChar : CHAR) RETURNS CHAR
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'
UCASE(ThisChar : CHAR) RETURNS CHAR
returns the character value representing the upper case equivalent of ThisChar. If ThisChar is not a lower case alphabetic character then it is returned unchanged. Example: UCASE('h') returns 'H'
MOD(ThisNum : INTEGER, ThisDiv : INTEGER) RETURNS INTEGER
returns the integer value representing the remainder when ThisNum is divided by ThisDiv. Example: MOD(10,3) returns 1
DIV(ThisNum : INTEGER, ThisDiv : INTEGER) RETURNS INTEGER
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
Question 14
Question 15
Question 16
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.
Why this question appears here
91% assigned-topic match · Data types and structures › Data types and records
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s17_qp_22.pdf
