Examination Centre

This is an algorithm trace task. No implementation is required.

Read the algorithm below, which validates an Examination Centre number and determines whether it is an overseas or a UK Centre.

The function Len(code) returns the number of characters in code. For example, if code = JA3451,
Len(code) = 6.

The algorithm refers to the one dimensional array err, which has been dimensioned to five cells.

Each output starts on a new line.

(a) Write down the outputs from this algorithm when the following codes are input at line 1.

  1. MV394
  2. K93621
  3. Ab149
[5 Marks]

(b) During the tracing of the algorithm in (a), changes will have occurred to the contents of the array err and the variable error. For each of the three cases from (a), state the contents of the array err and the variable error as they are at the end of the algorithm.

When the algorithm has the code 2739 input at line 1, the lines:


are executed and the output is:

The string should be 5 characters long

This example of a test can be described more fully as shown below:


  • When the path is described, each IF line must show whether the IF test led to a (True) or (False) result.
  • When the path is described, For-Next loops should be repeated the appropriate number of times.
  • Where there is more than one output from a test, write each on a separate line in the Expected output box.

(c) Using tables in the same form as Table 2.1, write down the lines that are executed the expected output when the following codes are input to the algorithm.

  1. 6A349
  2. 87301
  3. 573AB
[13 Marks]

(d) Give three more inputs that would each lead to a new route through the algorithm. You should ensure that your choice covers any output conditions that have not been illustrated so far.
In each case specify the new type of test and appropriate test data.

Complete tables for each test in the same form as the table above. [9 Marks]

(e) In the algorithm, lines 36-41 contain a loop that outputs which, if any, of the last three characters are invalid. The output statement is acceptable for the fourth and fifth characters, but not for the third character. 

Write an amended version of lines 36-41 to remedy this problem. [2 Marks]

This task was worth 32 Marks.  It was a software development task and an implementation task that orginally appeared in OCR 2507 Task 2 Jun 2005.  All rights and copyright to OCR.  Please refer to the OCR Copyright Statement for further information.

IMAGE CREDIT: https://schoolsweek.co.uk/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.