AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Ones and zeros

Week 6 · Unit 3: Computer storage · 3 lessons
3

Counting the bytes in a message

Computing 5: Unit 3, pp. 34–43
GoalWork out how many bytes and bits a message needs and say why all computers use the same code.
New words
encode · to turn a message into a code, such as bytesdecode · to turn a code back into the messagecharacter · a letter, digit, punctuation mark or spacestorage · the room that a computer has to keep data
Explanation

A message is stored as one byte for every character. Spaces and punctuation marks count as characters, too. To find the size of a message, count its characters. This is the number of bytes. Multiply by 8 to find the number of bits. For example, ‘Hi, Mum!’ has 8 characters: H, i, comma, space, M, u, m and !. That is 8 bytes, or 8 × 8 = 64 bits. Every computer uses the same code table. If they did not, the same pattern could show different letters on different computers, and messages would be spoiled.

press Astores 0100 0001shows A
Worked examples
‘Hello, Ana!’ has H, e, l, l, o (5), the comma (1), the space (1), A, n, a (3) and the exclamation mark (1). That is 5 + 1 + 1 + 3 + 1 = 11 characters, so 11 bytes and 11 × 8 = 88 bits.
CharacterByte
A0100 0001
space0010 0000
B0100 0010
A space is a character with its own byte. The text ‘A B’ has three characters, so it needs three bytes.
Suppose one computer sent 0100 0001 meaning A, but another computer used a different table and showed that pattern as another letter. The message would arrive spoiled. A shared code makes sure that every computer shows the same letter.
Class activity

Byte counting (pairs). Each partner writes a short sentence, such as a greeting, with a full stop at the end. Swap sentences. Count the characters, including the spaces and the full stop. Write the number of bytes and the number of bits. Check each other’s counts. Whose sentence needs the most bytes? Can you write a sentence of exactly 20 bytes?

Practice
1
How many bytes and how many bits does ‘OK, GO!’ need?
OK, GO!
2
A message is 20 bytes long. How many bits is it?
3
Which needs more storage, ‘HELLO’ or ‘HI THERE’? Give the number of bytes for each.
HELLOHI THERE
4
Why must all computers use the same code table for letters?