Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1encode("CAT") gives 3 1 20 | ADecoding needs the key. Without it you cannot tell which number stands for which letter. | |
| 2decode("3 1 20") gives CAT | Bencode(picture) gives 0 1 1 0 | |
| 3Encoding a black-and-white picture: black pixels become 1 and white pixels become 0 | CThis turns the word into a code, so it is encoding. Decoding should turn the code back into the word. | |
| 4Decoding with a key: the key says 1 means black and 0 means white, so the digits become a picture again | DUses the key to turn the number codes back into the word | |
| 5decode("CAT") gives 3 1 20 | ETurns the word CAT into number codes, so the information is now in code | |
| 6decode("3 1 20") without a key | Fdecode("0 1 1 0", key) gives picture |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
encode / decode — To encode is to turn information into a code. To decode is to turn the code back into the information, using a key. They are opposites.message ← "CAB"
code ← encode(message, key)code ← "3 1 2"
message ← decode(code, key)code ← "3 1 2"
message ← decode(code, key)picture ← [0, 1, 1, 0]
code ← encode(picture, key)code ← encode(message, key)
original ← decode(code, key)
output original