Designing, Creating & Refining Algorithms
1. This question has 2 part(s).
1.1. One encryption method is a Caesar cipher.
This Caesar cipher moves each letter of the alphabet one place to the right.
The following table shows the original letters in the first row, and the new letters in the second row.

For example, if the message read: HELLO
This would be stored as: IFMMP
The following pseudocode algorithm takes a string of uppercase letters as input and uses the Caesar cipher to encrypt them.
The functions used in the algorithm are described in the table:
Function | Description |
ASC(character) | Returns the ASCII value for character e.g. ASC("A") returns 65 |
CHR(ASCIIvalue) | Returns the single character for ASCIIvalue e.g. CHR(65) returns "A" |
subString(Value, Number) | Returns the Number of characters starting at position Value (where 0 is the first character) |
Complete the pseudocode algorithm to perform a Caesar cipher.
01 message = input("Please enter your string") 02 newMessage = "" 03 messageLength = message.length 04 for count = 0 to............................ 05 ASCIIValue = ASC(message.subString(...............,1)) 06 ASCIIValue = ASCIIValue + .......... 07 if ASCIIValue >90 then 08 ASCIIValue = ................................ – 26 09 endif 10 newMessage = .................... + CHR(ASCIIValue) 11 next count1.2. The algorithm needs adapting. An extra line (line 12) is needed to output the encrypted message.
Write line 12 to output the encrypted message in pseudocode or programming code.
Ai এর মাধ্যমে
১০ লক্ষ+ প্রশ্ন ডাটাবেজ
প্র্যাকটিস এর মাধ্যমে নিজেকে তৈরি করে ফেলো
উত্তর দিবে তোমার বই থেকে ও তোমার মত করে।
সারা দেশের শিক্ষার্থীদের মধ্যে নিজের অবস্থান যাচাই
No related questions found