You are on page 1of 57

Lesson 8: Representing

text
KS4 – Data representations
Starter activity

Are there enough bits?

Question 1 0000
0001
How many combinations of 1s and 0s can 0010
you make with just 4 bits? ?

Question 2

How many bits would be needed to


represent all 26 letters of the alphabet?
Starter activity

Are there enough bits?

Question 1 Answer 1

How many combinations of 1s and 0s can There are 16 combinations of 1s and 0s


you make with just 4 bits? that can be made with 4 bits.

Question 2 Answer 2

How many bits would be needed to You would need at least 5 bits to represent
represent all 26 letters of the alphabet? all 26 letters of the alphabet. 5 bits would
allow for 32 combinations.
Objectives

Lesson 8: Representing text


In this lesson, you will:
● Determine the maximum number of states that can be represented by a binary pattern
of a given length
● Explain how ASCII is used to represent characters, and its limitations
● Explain what a character set is
● Describe how character codes are commonly grouped and run in sequence within
encoding tables
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
A quick way to work out the number of
possible combinations is to take a look at
the place value headings.
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try an example.

How many combinations of 1s and 0s can


you make with 2 bits?
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try an example.

How many combinations of 1s and 0s can


you make with 2 bits?
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try an example.

How many combinations of 1s and 0s can


you make with 2 bits?
00
01
You could write them all out by hand.
10
11
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try an example.

How many combinations of 1s and 0s can


you make with 2 bits?
00
01
You could write them all out by hand.
10
This is fine when you are working with a 11
small number of bits, but what about
when you are working with higher
numbers?
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
There is another way.

Can you see a connection between the


number of combinations and the next
00
place value heading? 01
10
11
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
There is another way.

Can you see a connection between the


number of combinations and the next
00
place value heading? 01
10
The number of possible combinations is 11
equal to the number in the next place
value heading.
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try another example to see if the
pattern is correct.

How many combinations of 1s and 0s can


you make with 3 bits?
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try another example to see if the
pattern is correct.

How many combinations of 1s and 0s can


000
you make with 3 bits? 001
010
There are 8 combinations. 011
100
101
110
111
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try another example to see if the
pattern is correct.

How many combinations of 1s and 0s can


000
you make with 3 bits? 001
010
There are 8 combinations. 011
100
This matches the number in the next place
101
value heading. 110
111
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Using the place value headings is a really
quick way to determine the number of
possible combinations.
000
001
010
011
100
101
110
111
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Another method is to use a formula.

Formula:

Number of combinations of n bits = 2n


Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Another method is to use a formula.

Let’s use this formula with 2 bits.


Formula:

Number of combinations of n bits = 2n


Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Another method is to use a formula.

Let’s use this formula with 2 bits.

The value of n is replaced with the Formula:


number 2 because you are working with 2 Number of combinations of 2 bits = 22
bits.
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Another method is to use a formula.

Let’s use this formula with 2 bits.

The value of n is replaced with the Formula:


number 2 because you are working with 2 Number of combinations of 2 bits = 22
bits.

2 to the power of 2 is the same as

2×2
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Another method is to use a formula.

Let’s use this formula with 2 bits.

The value of n is replaced with the Formula:


number 2 because you are working with 2 Number of combinations of 2 bits = 2 × 2
bits.

2 to the power of 2 is the same as

2×2
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
2 × 2 is 4, therefore, 2 bits allows for 4
combinations of 1s and 0s.

This is the same result as before.


Formula:

Number of combinations of 2 bits = 4


Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try it for 4 bits.

Formula:

Number of combinations of 4 bits = 24


Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try it for 4 bits.

2 to the power of 4 is the same as

2×2×2×2 Formula:

Number of combinations of 4 bits = 24


Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
Let’s try it for 4 bits.

2 to the power of 4 is the same as

2×2×2×2 Formula:

Number of combinations of 4 bits = 16


The result of this calculation is 16.
Activity 1

Determining the number of combinations


128 64 32 16 8 4 2 1
You can decide which method you prefer.

The table is really handy when working


with 8 bits or less, but the formula would
Formula:
be more useful when working with a
higher number of bits. Number of combinations of n bits = 2n
Activity 1

Try the methods yourself

Use the activity sheet to try out your


preferred method.
Activity 2

Representing text

To represent all 26 letters of the alphabet,


you would need at least 5 bits.

This is because you would need 26


combinations of 1s and 0s to represent
each letter.

5 bits gives you 32 combinations, whereas


4 bits would only give you 16.
Activity 2

Representing text

What about other things that are needed


for writing?

● Lower-case letters
● Punctuation
● Spaces
● Numbers

How many characters do you think


there are on a keyboard?
Activity 2

Representing text

Standard English keyboards have around


104 characters available on them.

How many bits would be required


to represent 104 combinations?
Activity 2

Representing text

Standard English keyboards have around


104 characters available on them.

How many bits would be required


to represent 104 combinations?

7 bits.
Activity 2

7-bit ASCII

A coding system was created in the 1960s


called the ASCII character set.

Each letter required by the keyboard was


given a unique bit pattern.

A bit pattern is a combination of 1s and


0s that is used to represent data.
Activity 2

7-bit ASCII

The character set initially only used 7


bits.

For example,

A 10000012

B 10000102

C 10000112
Activity 2

7-bit ASCII

The ASCII character set was essential,


because it allowed the bit patterns to be
standardised across different devices.

ASCII was originally used for


telecommunication systems such as
teleprinters.
Activity 2

8-bit ASCII

8 bits (1 byte) are now used to store each


character in the ASCII character set.

The original coding system remains, with


each code having a preceding 0 bit.
Activity 2

8-bit ASCII

Take a look at the bit pattern for A 0100 0001


the letter C. Can you predict the
bit pattern for the letter D? B 0100 0010

C 0100 0011
Activity 2

8-bit ASCII

The bit pattern for each character A 0100 0001


increases by 1 each time.
B 0100 0010

C 0100 0011

D 0100 0100
Activity 2

8-bit ASCII

In your next task, you will see a copy of


the ASCII character set.

You will notice that similar items have


been grouped together.

Numbers, upper-case letters, and lower-


case letters are all grouped together to
make it easier to navigate the table.
Activity 2

ASCII tasks

Use the activity sheet and the ASCII


character set handout to help you
navigate the table and perform some
encoding and decoding.
Plenary

What are we missing?

The ASCII character set contains all of


the characters that can be found on a
standard English keyboard.

What else might need to be


represented as text by a computer?
Plenary

What are we missing?

The ASCII character set contains all of ● Other languages (eg Greek)
the characters that can be found on a ● Emojis
standard English keyboard. ● Special characters (eg ½)

What else might need to be


represented as text by a computer?
Plenary

Next lesson...

You will learn about another character


set called Unicode.

This has the capacity to represent many


more characters!
Plenary

Quiz time!

Let’s have a quick quiz to see what you


can remember from this lesson.
Plenary

How many bit patterns can you make with 4 bits?

8 16

32 4
Plenary

How many bit patterns can you make with 4 bits?

8 16

32 4
Plenary

How many bit patterns can you make with 5 bits?

8 16

32 4
Plenary

How many bit patterns can you make with 5 bits?

8 16

32 4
Plenary

How many bit patterns can you make with 8 bits?

8 64

128 256
Plenary

How many bit patterns can you make with 8 bits?

8 64

128 256
ASCII originally used 7 bits!
Plenary

How many characters does a standard English keyboard have?

100 101

103 104
Plenary

How many characters does a standard English keyboard have?

100 101

103 104
Plenary

True or false? Similar characters are grouped together in a


character set (eg all the numbers are together)

TRUE FALSE
Plenary

True or false? Similar characters are grouped together in a


character set (eg all the numbers are together)

TRUE FALSE
Plenary

01000001 is the ASCII code for the letter A. What is the ASCII
code for the letter B?

01000001 01000010

01000011 01000100
Plenary

01000001 is the ASCII code for the letter A. What is the ASCII
code for the letter B?

01000001 01000010

01000011 01000100
Plenary

01010100 is the ASCII code for the letter T. What is the ASCII
code for the letter U?

01010111 01011111

01010101 01011000
Plenary

01010100 is the ASCII code for the letter T. What is the ASCII
code for the letter U?

01010111 01011111

01010101 01011000
Summary

Next lesson

In this lesson, you… Next lesson, you will…

Learnt how text is represented using Learn about Unicode and file size
binary numbers calculation

You might also like