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 | |
|---|---|---|
| 11=go to the | A2 Sam, 2 Alex | |
| 21 shop, 1 park, 1 beach | BA code table entry: the short code 1 stands for the repeated phrase 'go to the' | |
| 3Build the code table by giving the repeated phrase 'good morning' the short code 2 | CThe compressed text, where every repeat of the phrase has been replaced by its short code | |
| 4Replace both repeats of 'good morning' in 'good morning Sam, good morning Alex' using code 2 | DThe second 'the cat' was not replaced with code 1, so a repeat was left in full and no extra space was saved | |
| 5Table: 1=the cat Text: 1 sat, the cat ran | EThe code table is missing, so nobody can tell that 3 stands for a phrase | |
| 6Text: 3 is fun, 3 is easy (no code table stored) | F2=good morning |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
dictionary compression — Give each repeated word or phrase a short code, store the code table once, then replace every repeat with its code so the data takes up fewer characters.TABLE: # = "the cat"
TEXT: "the cat sat, the cat ran"
SMALL: "# sat, # ran"original ← 30
compressed ← 12
saved ← original - compressedphrase ← "the cat"
code ← "#"
saved ← LENGTH(phrase) - LENGTH(code)text ← "the cat sat, the cat ran"
small ← REPLACE(text, "the cat", "#")code ← "#"
phrase ← "the cat"
table[code] ← phrase