May/June 2026 Paper 22

2026 · 6 questions · 26 parts · 75 marks

0/75 marks
0Correct0Partial0Wrong26Unattempted
Filters0 active
6(a)String HandlingHard8 marks
A program is being developed to encrypt a message. The following terms are used in the encryption technique to be used:
termdefinition
plain textThe original message before it is encrypted.
cipher textThe encrypted version of the plain text.
The encryption method to be used is based on the algorithm for the Caesar Box Cipher. All plain text messages to be encrypted must be 25 characters in length or less. If a message is less than 25 characters in length, then spaces are added to the end to make the padded plain text the required length.
A square grid of five columns and five rows is used. The padded plain text message is put into the grid row by row. The cipher text is obtained by reading the grid column by column.
For example, for the plain text This is a message (17 characters, including spaces), the padded plain text (using ∆ to show a space) is This∆is∆a∆message∆∆∆∆∆∆∆∆. The grid filled, row by row, with the padded plain text:
This∆
is∆a∆
messa
ge∆∆∆
∆∆∆∆∆
The cipher text is obtained by reading the grid column by column: Timg∆hsee∆i∆s∆∆sas∆∆∆∆a∆∆
The programmer has defined the first program module as:
moduledescription
AddPadding()user prompt for and input of plain text • check plain text contains between 1 and 25 characters inclusive • re-input of plain text until it contains between 1 and 25 characters • if required, additional space characters are added to the end of the plain text to ensure it contains exactly 25 characters • return of amended plain text
Write pseudocode for module AddPadding().
AddPadding() function
0 words
6(b)(i)Two Dimensional ArraysMedium2 marks
The programmer has defined a global 2D array Grid to be used to create the cipher text.
Complete the pseudocode statement used to declare the global 2D array Grid.
0 words
6(b)(ii)Two Dimensional ArraysHard8 marks
The programmer has defined an additional program module as follows:
moduledescription
PopulateGrid()called with one parameter of type string representing the correctly padded plain text • populate the array Grid using the plain text so that it can be used at a later point to create the cipher text • output the contents of the array Grid so it is displayed row-by-row
Using the original example for the padded plain text, PopulateGrid("This∆is∆a∆message∆∆∆∆∆∆∆∆"), the output would be:
pseudocode
Thisis amessage
Write pseudocode for module PopulateGrid().
PopulateGrid() procedure
0 words