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 | |
|---|---|---|
| 1HELLO -> HLOEL | ARail fence with two rails: letters 1, 3 and 5 go on the top rail, letters 2 and 4 on the bottom rail. Reading the top row then the bottom row gives HLOEL. | |
| 2Top: A T C Bottom: T A K | BDEFEND -> DFNEED | |
| 3A transposition cipher keeps the same letters, so the ciphertext is just the plaintext letters in a new order. | CA grid for ATTACK on two rails. Reading the rows one after the other gives the ciphertext ATCTAK. | |
| 4To read off the rows, join the top rail and then the bottom rail to make the ciphertext. | DThe letters were changed by shifting them, which is a Caesar (substitution) cipher. A transposition cipher keeps the same letters and only changes their order. | |
| 5ATTACK -> DWWDFN | ETop: H L O Bottom: E L -> HLOEL | |
| 6Top: H E O Bottom: L L | FThe first three letters were put on the top rail. In a zigzag the letters alternate between the rails, so the top should be H L O and the bottom E L. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
transposition cipher — A cipher that keeps the same letters but rearranges their order by a rule, like writing them in a zigzag on two rails and reading off the rows.text = "HELLO"
rail1 = text[0::2]
rail2 = text[1::2]text = "HELLO"
rail1 = text[0::2]
rail2 = text[1::2]rail1 = "HLO"
rail2 = "EL"
cipher = rail1 + rail2half = (len(cipher) + 1) // 2
rail1 = cipher[:half]
rail2 = cipher[half:]plain = "HELLO"
cipher = "HLOEL"
print(sorted(plain) == sorted(cipher))