CS27 : Number bases


https://docs.google.com/presentation/d/1d_ID0LHqjulaSuitkFFJD9JTohSi8lpzTCqKIGjXxaE/preview
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 ...
  • About number bases.
So that we can ...
  • Represent numbers in different number bases
    - Binary
    - Denary
    - Hexadecimal
  • 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 GuidePage 67, 70, 71
CGP Exam Practice WorkbookPage 77, 79, 80

# Get Ready.png

What's all this?

ACTIVITY 1
Representing numbers
 I   O   A   E 

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


Task 1.1 Reading and questions
Where we learn about the different ways that humans, computers and cartoon mice count


Reading and notes


Read this passage and make notes in your notebook / folder.

Counting Systems

Denary

We 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.

Binary

Computers 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.

In your notebooks

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 2
How 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 3
Binary / 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 4
Hexadecimal
 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?




Task 4.1 Binary / Hexadecimal conversion
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.
  1. Convert 110101002 to hexadecimal.


  2. Convert 101111002 to hexadecimal.
  3. Convert 000000002 to hexadecimal.
  4. Convert 111111112 to hexadecimal.
  5. Convert 010101012 to hexadecimal. 

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.

Assessment Task (Homework)

Firstly ...

Play this Binary Game - you might get a privacy warning or be asked to state your age.  What level did you reach? Get your parent / guardian to sign your planner to confirm that you've had a go!

Next ...

Now make up a game to help you remember hexadecimal - maybe a matching card game?  Put your completed game in a plastic wallet and bring it into school to play with your peers; it might help them learn as well.

Grading rubric

MASTER : You got to level 10 on the binary game and got your parents / guardians to sign your planner. You have made a really cool game to help you learn all the hexadecimal numbers. 
APPRENTICE : You tried the binary game but didn't make much progress. You may not have got your planner signed. You have made a 'game' which is a list of all the hexadecimal numbers and their binary equivalent. 
NOVICE : You didn't get your planner signed so I have no idea whether you have done the binary game or not. You haven't really made a game, you just tell me what the hexadecimal number are.

Click to download revision cards
https://docs.google.com/document/d/1-u_k3TspkDA5tsRwHOh2dqzPdDGJCZdo5aOW9P3zBRU/export?format=pdf
Remember to print them single sided

# Flash cards.png
Click to load key word list to help you make your own flash cards 

https://goo.gl/forms/Xmx97HtNNL9KkUIz1
Try to get 5/5!




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.

How about trying to pronounce hexadecimal numbers?


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.