0% found this document useful (0 votes)
10 views5 pages

Assignment 1.1A Year 9

Uploaded by

Ermias Mekuria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Assignment 1.1A Year 9

Uploaded by

Ermias Mekuria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

CAMBRIDGE LOWER SECONDARY COMPUTING 9: ASSIGNMENT 1.

1A

Name Date

Assignment 1.1A: Correct the algorithm

This pseudocode algorithm should help a user to decrypt a message. When a letter is encrypted, it is
changed to a different character. Using this table here, the ‘p’ is replaced with a question mark (?). If you
don't know the code, you cannot read the message.
The code used is given in the table. The letter is in the first row and the encrypted character is in the
second row. For example, the letter ‘a’ is encrypted as the character ‘0’.
a b c d e f g h i j k l m n o p q r s t u v w x y z

0 1 2 3 4 5 6 7 8 9 + - = / * ! ? \ # ( ) & % $ @ |

OUTPUT "Enter the encrypted character"


INPUT character
IF character = "0" THEN
OUTPUT "a"
ELSEIF character = "1" THEN
OUTPUT "b"
ELSEIF character = "2" THEN
OUTPUT "c"
ELSEIF character = "3" THEN
OUTPUT "d"
ELSEIF character = "4" THEN
OUTPUT "e"
ELSEIF character = "5" THEN
OUTPUT "f"
ELSEIF character = "6" THEN
OUTPUT "g"
ELSEIF character = "7" THEN
OUTPUT "h"
(Continued)
1

CAMBRIDGE LOWER SECONDARY COMPUTING 9: ASSIGNMENT 1.1A

ELSEIF character = "8" THEN


OUTPUT "i"
ELSEIF character = "9" THEN
OUTPUT "j"
ELSEIF character = "+" THEN
OUTPUT "k"
ELSEIF character = "-" THEN
OUTPUT "l"
ELSEIF character = "=" THEN
OUTPUT "m"
ELSEIF character = " " THEN
OUTPUT "n"
ELSEIF character = "*" THEN
OUTPUT "o"
ELSEIF character = "!" THEN
OUTPUT "p"
ELSEIF character = "?" THEN
OUTPUT "q"
ELSEIF character = "\" THEN
OUTPUT "r"
ELSEIF character = "#" THEN
OUTPUT "r"
ELSEIF character = "(" THEN
OUTPUT "t"
ELSEIF character = ")" THEN
OUTPUT "u"
ELSEIF character = "&" THEN
OUTPUT "v"
ELSEIF character = "%" THEN
OUTPUT "w"

(Continued)

CAMBRIDGE LOWER SECONDARY COMPUTING 9: ASSIGNMENT 1.1A

ELSEIF character = "$" THEN


OUTPUT "x"
ELSEIF character = "|" THEN
OUTPUT "y"
ELSEIF character = "@" THEN
OUTPUT "z"
ENDIF

Complete the following tasks.


1 Test the algorithm with the encrypted message: #4-42(8*/.
Work out using the table what the output should be, and then test it with the algorithm.
? (question mark) and ! (exclamation mark) also need to be encrypted.
Select a character to encode each of these and write it in the following table. Make sure
neither of the characters you choose have already been used.
? !

5 Change the algorithm to allow your two selected characters to be entered and the correct
symbol (? or !) to be output.
3

You might also like