Past-paper question · 2017 May-June · Paper 22 · Q6(a)

Question 6(a) 2017 · May-June · Paper 22 · 9 marks

Original past-paper question for 6(A)
Original past-paper question for 6(A)
Original past-paper question for 6(A)
Reveal official mark-scheme answer Official mark-scheme answer for 6(A)Official mark-scheme answer for 6(A)

Official answer for Question 6

Part (a)

✓
Pseudocode solution included here for development and clarification of mark scheme.
✓
Programming language example solutions appear in the Appendix.
✓
FUNCTION ValidateRegistration(Registration : STRING) RETURNS
✓
BOOLEAN
✓
DECLARE UCaseChar, NumChar : INTEGER
✓
DECLARE NextChar : CHAR
✓
DECLARE ReturnFlag : BOOLEAN
✓
DECLARE n : INTEGER
✓
ReturnFlag ← TRUE
✓
ValidateRegistration ← True
✓
IF LEN(Registration) < 6 OR LEN(Registration) > 9
✓
//check
✓
length
✓
THEN
✓
ReturnFlag ← False
✓
ELSE
✓
FOR n ← 1 TO 3
✓
//check for 3 upper case alpha
✓
NextChar ← MID(Registration, n, 1)
✓
IF NextChar < 'A' AND NextChar > 'Z'
✓
THEN
✓
ReturnFlag ← False
✓
ENDIF
✓
ENDFOR
✓
FOR n ← 4 TO 5
✓
//check for 2 numeric
✓
NextChar ← MID(Registration, n, 1)
✓
IF NextChar < '0' AND NextChar > '9
✓
THEN
✓
ReturnFlag ← False
✓
ENDIF
✓
ENDFOR
✓
FOR n ← 6 TO LEN(Registration) //check remaining
✓
characters
✓
NextChar ← MID(Registration, n, 1)
✓
IF NextChar < 'A' AND NextChar > 'Z'
✓
THEN
✓
ReturnFlag ← False
✓
ENDIF
✓
ENDFOR
✓
ENDIF
✓
RETURN (ReturnFlag)
✓
ENDFUNCTION
✓
9608/22
✓
Cambridge International AS/A Level – Mark Scheme
✓
May/June 2017
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s17_ms_22.pdf →

Show text version of question

Question 6

Part (a)

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.
A
function, ValidateRegistration is needed to check that a given registration mark follows

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 (a)

Write program code to implement the new function, ValidateRegistration.

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.

Programming language ............................................................................................................

Program code

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Question 11

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

..............................................................................................................................................

[9]

Question 12

Topic relevance

Why this question appears here

82% assigned-topic match · Programming › Constructs

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

Keep practising this topic