3.3 Fundamentals of data representation

 Focus

3.3 focuses on fundamentals of data representation. Click on the links above to navigate to specific sections you wish to revise. Each topic should have some reading material, video, exam questions as well as some exemplar answers. 

 

Videos

I have added the videos below to make it easier to understand number systems as a whole and conversions between them. There are some videos that I have uploaded and others created by OCR as well as other teachers.

   

 

Exam questions, mark scheme and exemplars

Exam question with mark scheme

 

hexadecimal 

hex new

 

Key points:

1. When doing conversions i.e. from binary to hex, always check your workings. The first image shows that the student hasn't used the right conversion method and, in addition, they are using the letter D to represent 11. For the second nibble, they have the value 6 and this should be 7 as they have missed a 1. The correct answer should be B7. 

2. The second image makes better use of this and they have added the values correctly. They could have simplified this by using 8421 but this method works equally well if you know the values of Hex.

 

3.3.1 Number bases

Binary

A computer is a very sophisticated device consisting of hardware and software. The hardware is the physical components that we can touch and the software is the coded instructions responsible for controlling the hardware.

A computer, at its most basic level, stores and processes data. The data is sent to the computer using input devices and the instructions are temporarily stored in short-term memory (RAM) and permanently using long-term (secondary) storage. It consists of millions of electronic circuits that can store one of two values by either allowing electricity to flow (1), or not (0). It does this using millions of transistors that act like a switch and the more switches we use, the more combinations of 1s and 0s, which can be used to store more values. You can think of transistors being responsible for controlling the flow of power to another part of the circuit. In addition, this is used to make logic gates which in turn enables different circuits to be built.

A single transistor switch can be in an on state to represent 1 or off state to represent 0. This number system is called binary. A 1 or a 0 is called a binary digit, or in short a bit. A group 8 bits will make a byte and half of this is called a nibbleBinary, as a numbering system, is used to represent imagestextsound and video. The computer or any other digital device converts all data formats into binary before storing them.

 

This page will go through how values are represented in binary and the conversion between different numbering systems.   

 

Further reading on transistorshttp://www.explainthatstuff.com/howtransistorswork.html | https://forum.allaboutcircuits.com/threads/difference-between-general-switch-and-transistor-as-a-switch.99221/ | https://electronics.howstuffworks.com/diode2.htm

 

Decimal (Denary) 

This is the number system that we use as humans. It consists of the following numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. It is also known as base 10. To identify the base of a number system, you simply find out how many digits there are.

The table below shows the structure for decimal.

10^2 10^1 10^0
Hundreds Tens Units
5 0 5

 

We now know the value above is 505 because of the following:

  • 5 x 100 (hundreds) 
  • 0 * 10 (tens)
  • 5 x 1 (units)
  • Total : 500 + 0 + 5 = 505

We can use the same technique to convert decimal numbers to binary and binary numbers back to decimal. 

 

Decimal to binary

Binary is a number system consisting of a 0 and a 1. It is base two as we only have two digits. The table below shows 8 bits (one byte) and the values it is representing. The bit, furthest to the right is called the least significant bit and the bit, furthest left is called the most significant big. This is highlighted within the table.

Step 1:

Create a table with eight columns. Start from the right-hand side with the value 1, keep doubling the value, as you move to the left until you get to 128.  

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1

 

Step 2

Our table is created and we are now going to convert 50 into binary. We will start with the most significant bit. We are going to ask the following questions: 

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1
 0 1  1  0  0 1 0

  • Does 128 fit into 50? If the answer is no, we put a 0
  • Does 64 fit into 50? No, so we put a 0
  • Does 32 fit into 50? Yes, so we put a 1 underneath 32 and subtract 32 from 50 = 18
  • Does 16 fit into 18? Yes, so we put a 1 underneath 16 and subtract 16 from 18 = 2 
  • Does 8 fit into 2? No, so we put a 0 underneath 8
  • Does 4 fit into 2? No, so we put a 0 underneath 4
  • Does 2 fit into 2? Yes, so we put a 1 underneath 2 and subtract 2 from 2 = 0
  • Does 1 fit into 0? No, so we put a 0 underneath 1

The denary number 50 converted into binary is 00110010.

 

Binary to decimal 

To convert a binary number into decimal, you will need to use the same table and follow the straight forward process outlined below. We need to make sure we use our table, put the binary numbers and count all the ones. The steps below will go through converting 10100000 into denary. 

Step 1:

Create a table with eight columns. Start from the right-hand side with the value 1, keep doubling the value, as you move to the left until you get to 128.  

128 64 32 16 8 4 2 1

 

Step 2:

Start with the right hand-side and put each binary number below the headings.   

128 64 32 16 8 4 2 1
 1  0  1  0  0  0  0  0

 

Step 3:

This is the stage where we look to find all the ones, we make a note of the heading it's under and add these values together. I have highlighted, using the table above, where the ones are.

The answer is: 128 + 32 = 160. To recap, 10100000 is 160 in denary.

 

Hexadecimal

Hexadecimal is a number system that is aimed at system designers and programmers. It is a number system ranging from 0 - 9 and A - F. It is base 16 which means that it is getting bigger 16 times. It is easy to write, remember and human-friendly. In Hexadecimal numbering system, each hex can represent 4 binary bits i.e. one nibble. This allows for large numbers to be represented using fewer digits compared to binary so that it is easier to remember.

It is used in the following areas:

  • Memory locations (you will get to know these better if you ever get a Blue Screen of Death)
  • Wi-Fi and Ethernet mac address
  • Hex colours 

The table below shows the hexadecimal values and their equivalence in binary as well as denary.

 

 Denary Binary  Hex 
 0 0000
 1 0001
 2 0010
 3 0011
 4 0100
 5 0101
 6 0110
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

 

Hexadecimal to decimal

Step 1:

Create a table with three columns. Start from the right-hand side with the value 1, which is 16 to the power 0, followed by 16 to the power 1 and 16 to the power of 2. If the number you are trying to convert is four digits then an extra column will be required. We are going to convert 80 hex into decimal.

256 16 1

 

Step 2:

Start with the right hand-side and put each hex value as you see it.

256 16 1

 

Step 3:

Multiply the hex digit by the column value. Answer: (16 * 8 = 128) + (0 * 1 = 0). This means that 80 hex is 128 decimal. We can use the same method if the hex digits are greater than 9, meaning letters are used to represent values from 10 (A) to 15 (F).

AB into decimal. We can easily identify that we have 2 hexadecimal digits and as each digit is equivalent to 4 nibble it means that AB is used to represent 8 bits.

256 16 1
A B

Answer: (10 * 16 = 160) + (11 * 1 = 11) =  171

 

Decimal to hexadecimal

Step 1:

We are going to use the same table as above and try to convert the denary value 100 to hexadecimal.   

256 16 1
 0 6 4

 

Step 2:

Our table is created and we are now going to convert 100 in decimal to hexadecimal. We will start with the most significant nibble. We are going to ask the following questions: 

  • Does 256 fit into 100? If the answer is no, we put a 0
  • Does 16 fit into 100? Yes, so we find out how many times, in this case it is 6 which gives us 96. If we subtract 96 from 100, we will have 4 left. 
  • Does 1 fit into 4? Yes, in this case 4 times and we don't have any remainder 

 

To summarise, 100 in decimal is 64 in hexadecimal. 

 

Binary to hexadecimal

We know that 1 hexadecimal digit can represent 4 bits i.e. a nibble. To convert an 8 bit binary number, we can break it up into two nibbles and workout the hex value. The steps below will show you how to convert 10101010 into hexadecimal. 

Step 1

Create a table with 8 columns and put 8421 8421 in each column.

8 4 2 1 8 4 2 1
1 0 1 0 1 0 1 0

 

Step 2

Try to place the 8 bit binary number underneath the headings.

 

Step 2

We are not going to count the nibble on the left first, i.e. the first 4 bits. Every time we see a 1, we add the column heading. This means we have 8 + 2 = 10. As we are converting this to hex, the number 10 has to be represented as A. The second nibble is 8 + 2 = 10. The second nibble is also A. This means that 1010 1010 binary is equal to AA in hex.

 

FAQ

  • Do we need to use 8 bits? Answer: at GCSE level we only need to use 8 bits which is a byte. This means that 2 to the power of 8 (bits) will result in 256, which is the biggest value we can represent. If we wanted to represent a bigger value then we would need to use more bits which would consist of doubling 128, 256, 512 etc.

  • Why can 8 bits represent up to 256 and not 255? Answer: the extra number is due to 0. The number 0 is also counted as a value

  • Is there a quicker way of doing the binary conversion? Answer: the quickest way to do it is to imagine that you have a coin for each bit (heading). For example, one 128, one 64, one 32, one 16, one 8, one 4, one 2 and one 1. You are then going to imagine using these values to make the decimal value. You can only use each coin once.

  • Is there any other methods that I can use to convert binary to denary? Answer: Yes, there are other methods such as dividing by 2. This  website explain the process in more detail. In short, you divide the denary number by 2, if there is no remainder then you put a 0, if there is a remainder you put a 1. You continue with this until you get to zero. The remainder should have 1 or 0, you reverse this and it should give you the binary number. The example below clearly shows this. We start with the number 156 and we divide this by two. There isn't any remainder so we put a zero. We continue by dividing 78 by 2, again, this results in a zero. The number 39 divided by two will have a remainder so we put a 1 in the remainder column. We continue until we get to zero. The final answer will be: 10011100.

aid5981 v4 900px Convert from Decimal to Binary Step 3 Version 4Source: wikihow.com

 

  • Why do we use binary? Answer: It is easier to build a circuit because a single switch as it can represent to states.

 

 

 

Login Form

Take me to the top
Template by JoomlaShine