### CS27 : Number bases Before we focus on the Binary number system, we need to understand number bases. This topic looks at the meaning of number bases and exercises using binary, octal, denary and hexadecimal (oh, and a sprinkling of dozenal as well).

We are learning ...
So that we can ...
• Represent numbers in different number bases
- Binary
- Denary
• Convert from one number base to another
- Binary <−> Denary
• Understand how computers use different numbers bases
- Hexadecimal is used to represent binary
- Use of binary and hexadecimal in representation of colours, MAC addresses, assembly language and machine code.

 CGP The Revision Guide Page 67, 70, 71 CGP Exam Practice Workbook Page 77, 79, 80  What's all this?

 ACTIVITY 1Representing numbers I   O   A   E

Before we start, let's look carefully at how humans and computers count.

Where we learn about the different ways that humans, computers and cartoon mice count Counting SystemsDenaryWe use our fingers to count like a scale with 10 different values (technically 11 if we start at zero!) ... This is why humans use the Base 10 or Denary number system. If we use all 10 fingers, we are actually showing one lot of 10 and 0 units. Our number system consists of 10 different values 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.BinaryComputers are made of electronic switches which means that they can only represent numbers using on and off or just 2 different values. This is why computers use the Base 2 or Binary number system. It consists of only 2 values, 0 and 1.  Answer the following questions in full sentences.
1. Look at the image of Mickey Mouse - how many fingers (and thumbs) does he have?
2. How many different values could he represent using his fingers (ignore zero)?
3. What base would he count in?
4. What values would their be in his number system?
5. What would the base be called? (think geometric shapes ...) ACTIVITY 2How much is 1101? I   O   A   E

This seems like an odd question doesn't it? Surely it's one thousand, one hundred and one! Yes, but only in Base 10! All the values in a number do is tell you how many of each place value there are in the value of the number. In Base 10, it's units, tens, hundreds, thousands etc - each place value is worth 10 times the previous one (Base 10, see?) This is what we are used to.

Watch the presentation (go full screen to make it easier to read) ...

Thinking in any other number base than 10 is really hard - we naturally try to convert the number into base 10 to make it make sense to us - if we were the same as Mickey and had only 8 fingers, we would struggle to think in anything other than Base 8 (octal, if you didn't already know) and we'd count very differently. Task 2.1 Practice converting different bases to denary
Where we learn how to convert values in different number bases to denary On the worksheet

When you are ready, attempt the worksheet called Number conversion. Print out the completed worksheet single sided and hand it in or stick it in your notebooks for assessment. Image of Mickey Mouse from http://pngimg.com/

 ACTIVITY 3Binary / denary conversion I   O   A   E

For your examination, you will need to be confident converting binary numbers to and from denaryIt's common to convert to and from a byte - 8 bits. Consider the example below. Working in Base 2 makes it easy to simplify this table (thankfully) by removing the 'Place', 'Factor' and 'Worth' rows as in the example below. There is only ever one lot of each place value in binary unlike other bases - this actually makes binary the easiest base to work with! You just have to remember that each place is worth twice the previous, slot in the binary number and add up the places which have a '1' in them. Task 3.1 Binary to denary conversion
Where we learn how to convert binary numbers to their denary value In your notebooks / on paper

Attempt to answer the following in your notebooks. Show all you working. The first one has been done for you - make sure that you look back over the examples if you are struggling, or ask for help!
1. Convert 011000112 to denary. 2. Convert 000000112 to denary.
3. Convert 110000112 to denary.
4. Convert 010011112 to denary.
5. Convert 111100002 to denary.
6. Convert 000000002 to denary.
7. Convert 001100112 to denary.
8. Convert 111111112 to denary.
9. Convert 010101012 to denary.
10. Convert 101010102 to denary. Task 3.2 Denary to binary conversion
Where we learn how to convert denary numbers into their binary value

This is a little more complicated. Your teacher will show you a method before you begin the exercise. In your notebooks / on paper

Attempt to answer the following questions in your notebook, showing all your working. The first one has been done for you. If you are struggling, ask for help!
1. Convert 18710 to binary. 2. Convert 1210 to binary.
3. Convert 1510 to binary.
4. Convert 3210 to binary.
5. Convert 4510 to binary.
6. Convert 7910 to binary.
7. Convert 010 to binary.
8. Convert 10210 to binary.
9. Convert 15610 to binary.
10. Convert 25510 to binary. ACTIVITY 4Hexadecimal I   O   A   E

We nearly always write binary numbers in groups of eight bits called one byte. Here is the problem ...
• Computers work in binary
• Humans work in denary
• Binary numbers are considerably longer than their equivalent denary number
• Binary numbers are hard to remember
• Humans make mistakes
Here are some solutions ...
• Break the binary number down into smaller parts
• Represent each part in another number base
It therefore means that we can only use bases which neatly represent the place values of binary to do this. So ... We could group the bits in 2's and use Base 4 but this only makes the number half the length - can we do better? We could group the bits in 3's and use Base 8 but 8 bits doesn't divide into 3s neatly ... We could group the bits in 4's and use Base 16 - this seems to work OK, except that each group of 4 bits has a range of 0 to 15 and we know that we can't use 2 digits to represent a single digit in a number, so what do we do??? Yeah - but why invent new
ones when we can use some we already have? Where we learn how to convert between binary and hexadecimal

Your teacher will show you the method for converting binary to hexadecimal and vice versa. In your notebooks / on paper

When you are ready, answer the following questions in your notebook, showing all your working. The first one has been done for you. Ask for help if you are struggling.  In your notebooks / on paper

There is no mystery about hexadecimal to binary conversion - it's just the opposite to binary to hex. Try the following exercises in your book. The first one has been done for you.
1. Convert 5C16 to binary. 2. Convert 1416 to binary.
3. Convert F916 to binary.
4. Convert 0A16 to binary.
5. Convert 1016 to binary.  Hungry for more?

Research the use of hexadecimal numbers in ...
• Hyper Text Markup Language (HTML);
• Media Access Control (MAC) addresses;
• Assembly programming language.
Watch the following YouTube video which explains why we don't count in dozenal.

Find some binary jokes to share with the class next lesson.

References
Images of Mickey Mouse from http://pngimg.com/

FAQ

Q : What other bases are commonly used?
A : The only number bases commonly used by computer scientists are Base 2 (binary), Base 10 (denary) and Base 16 (Hexadecimal). Base 8 (octal) used to be used in the early days of computing machines because they used 6-bit bytes which split neatly into two octal nybbles.

Q : Do you need to know the prefixes like 0x, 0d, and 0b?
A : Absolutely not for the examination, but definitely if you want to be a programmer!

Q : How do I convert numbers quickly in an exam?
A : Err, practise, practise, practise. Play the 'binary game' from the assessment task, play 2048, learn how to pronounce hexadecimal numbers.