GoalSay what a bit and a byte are, and how one character is stored with a code.
New words
bit · one binary digit, 0 or 1; the smallest piece of databyte · a group of 8 bitscharacter · a letter, digit, punctuation mark, symbol or spaceASCII · the code table that all computers share; it gives each character its own 8-bit code
Explanation
A bit is a single binary digit, 0 or 1. It is the smallest piece of data that a computer can store. Eight bits make a byte. One byte stores one character. A character can be a letter, a digit, a punctuation mark or even a space. All computers share one code table, called ASCII. In it each character has its own 8-bit code. Capital letters and small letters have different patterns. To make a byte easier to read, we often write it as two groups of four, such as 0100 0001. When you press A, the keyboard sends a signal, the computer changes it into 0100 0001, and a screen shows the letter A again.
Worked examples
Character
Byte
Character
Byte
A
0100 0001
a
0110 0001
B
0100 0010
b
0110 0010
C
0100 0011
c
0110 0011
D
0100 0100
d
0110 0100
E
0100 0101
e
0110 0101
space
0010 0000
!
0010 0001
Here is part of the ASCII table. Each byte has 8 bits. For example, the byte for B is 0100 0010.
Decoding means turning bits back into characters. The three bytes in the picture are C, A and B in the code table, so they spell CAB. Three characters need three bytes.
Capital A and small a differ in one bit only: the third bit from the left. That is why a computer can tell them apart.
Class activity
Secret bytes (2 players, paper and a pencil, or 8 coins). Use the code table in the lesson. Player 1 writes a short word using the letters A to E, such as BEAD, as one byte for each letter. Player 2 uses the table to decode it. Then swap roles. How many bytes did your word need? How many bits is that? Can you make a word with a capital letter and small letters?
Practice
1
How many bits are in one byte? How many bits are in 3 bytes?
8 bits make a byte. 3 bytes make 3 × 8 = 24 bits.
2
Use the code table to decode these three bytes.
B, E, D. The word is BED. (0100 0010 is B, 0100 0101 is E and 0100 0100 is D.)
3
Write the three bytes for the word Ace, with a capital A and small c and e.
A is 0100 0001, c is 0110 0011 and e is 0110 0101.
4
One of these two bytes is the small letter d. Which one is it?
The second one, 0110 0100. The first one is the capital D. The small letters begin 011.