Question 4
AQA Computer Science June 2025 Paper 1 (7517/1)A level13 marks
On the specification
- 4.1
- 4.5 Fundamentals of data representation4.13 Systematic approach to problem solving
- 4.2
- 4.13 Systematic approach to problem solving
Question text
4 Write a program that uses a transposition cipher to encrypt a string entered by the user. After the user enters the string to encrypt, they enter the number of columns to use. Different numbers of columns result in different encrypted versions of the same string. Any non-alphabetic characters in the string entered by the user are ignored and will not appear in the encrypted text. To encrypt the string, the characters from the user’s input are written into a grid (left to right, top to bottom) of cells which has the number of columns specified by the user. The characters are then read from the grid in a different order (top to bottom, left to right). Example 1 If the user enters the string hypothetically and 3 for the number of columns, then the encrypted version of that string will be hoeclyttayphil h y p o t h e t i c a l l y Example 2 If the user enters the string hypothetically and 5 for the number of columns, then the encrypted version of that string will be hhayelptloiytc h y p o t h e t i c a l l y Example 3 If the user enters the string How many, how rarely? and 4 for the number of columns, then the encrypted version of that string will be Haoronwewyrlmhay H o w m a n y h o w r a r e l y The spaces and punctuation characters have been removed in the encrypted string. Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 4.1 Your PROGRAM SOURCE CODE. [12 marks] 4.2 SCREEN CAPTURE(S) showing the results of testing the program by entering the string: Hello there, are you ok? and 4 for the number of columns. [1 mark] You are advised to spend no more than 20 minutes on this section. Enter your answers to Section C in your Electronic Answer Document. You must save this document at regular intervals. These questions refer to the Preliminary Material and the Skeleton Program, but do not require any additional programming. Refer either to the Preliminary Material issued with this question paper or your electronic copy.