COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
DATA REPRESENTATION
1.1 BINARY REPRESENTATION
Picture
WHAT IS BINARY ?
Computers use binary to represent all data and instructions. The internal working of a computer at its core is very much like a light switch, it can be ON or OFF, by putting lots of light switches together many combinations can be represented, in computing terms these various combinations can represent from colour on your screen to calculations to AI algorithms. Binary is a Base 2 number system that uses the numbers 1 and 0 to represent ON and OFF respectively.
​
A single binary digit is called a Bit, and multiple Bits have the following denotations:
Nibble - Four Bits (0000)
Byte - Eight Bits (00000000)
Kilobyte - 1024 bytes
Megabyte - 1024 Kilobytes
Gigabyte - 1024 Megabytes
Terabyte - 1024 Gigabytes
​Petabyte - 1024 Terabytes
Exabyte - 1024 Petabytes
Zettabyte - 1024 Exabyte
​Yottabyte - 1024 Zettabyte

(Note: In the computer industry the kilobyte, Megabyte and so on are known as 1024, however some people may argue that because the work kilo is used then it should be 1000, a new tern kibibyte was introduced to represent the 1024 value, however this is not widely recognised and the original representation as in this list above are normally used)
ASCII
A byte can be used to represent letters, symbols and numbers as shown in the example below.
A byte can be used to represent letters, symbols and numbers as shown in the example below.

0 1 0 0 0 0 0 1 = A
0 1 0 0 0 0 1 0 = B
0 0 1 0 1 1 0 0 = 44

ASCII - American Standard Code for Information Interchange is the international agreed standard for the coding scheme used to represent the alphabet and other characters in binary. 

ACSII uses one byte to represent its assigned values therefore it can only represent 256 (2^8) unique characters, whilst this is fine for the English language some languages have many more characters, such as Chinese which has over 50,000 characters. Therefore these could not be represented using just one byte, so another binary coding system was developed called Unicode. There are various formats of Unicode and various ways in which representations are assigned but for the relevance at this level we can view Unicode as a 16 bits/two byte system, meaning (2^16) 65536 unique representations can be made. 
VIDEO BY: CRASH COURSE
THE NUMBER SYSTEM
The number system we all know has Units, Tens, Hundreds, Thousands and so on, we call this traditional number system the Denary number system. The binary number system has 1s, 2s, 4s, 8s, 16s, 32s and so on.

If one byte is used then we can represent 256 unique values. ​It is easy to work out how many representations can be made with a certain number of Binary digits by:
  • As each bit can be one of 2 values, either a 0 or a 1 we can calculate the amount of unique values that can be represented by 2 ^ n or 2 to the power ( ^ ) of the number (n) bits used. For example if we only used 3 bits the 2^3 = 8, we know we can only represent 8 combinations, as seen below.
Picture
Like in traditional math if you take the value from each column and multiply it by the column header you get the total value of the number. In the example to the left we have (1 x 32) + (1 x 8) + (1 x 4) = 44
So Binary 00101100 is equivalent to Denary 44
Note: If the right most(least significant) binary digit is a 1 then binary value must be representing an odd number.
Make sure you list binary logically. As can be seen from the 8 examples listed; there is a clear pattern when Binary is listed in a logical way. The left most column will always have the pattern of 1 0 1 0 and so on, the next column will always have the pattern 00 11 00 11 and so on, the next four 0s then four 1s and this pattern continues. It is good practice to always list Binary using this method, and check n^2 to ensure no representation has been missed. ​
Binary > Numeric Equivalent
0 0 0   = 0
0 0 1   = 1
0 1 0   = 2
0 1 1   = 3
1 0 0   = 4
1 0 1   = 5
1 1 0   = 6
​1 1 1   = 7
Picture
1: How many representation/combinations can be made using 7 Binary digits?
2: What Denary Number does 01010101 represent?
3: What is a quick way to know if the binary represents an odd or an even number?
4: IF 01000010 represents the letter B, what would represent the letter C?
5: So far we have looked a the binary up to 8 Bits long, the 8th Bit is in the 128s column, if we used 9 Bits what would the value of the column of the 9th Bit be?
6: Fill in the blanks:
  • Denary is a base .......... system
  • Binary is a base .......... system
  • .................... is a commonly used standard to represent up to .......... different characters. Another standard that is use to represent 1000s more characters is called ....................
Picture
BINARY ADDITION
It is simple to just convert a Binary representation to Denary, add the Denary values then convert back to Binary, however Binary addition is also easy if you follow the rules below:
  • Zero plus Zero = 0
  • Zero plus One = 1
  • One plus One = 0 and carry a 1
  • Three Ones = 1 plus carry a 1​​
Picture
Number 1 = 11
Number 2 = 6
Answer = 18​

Starting from the right(least significant bit) of the binary
  • 1 + 1 = 0 and carry 1 (shown in red in the 2s column)
  • 1 + 1 + 1 = 1 and carry 1 (shown in red in the 4s column)
  • 1 + 1 =  0 and carry 1 (shown in red in the 8s column)
  • 1 + 1 =  0 and carry 1 (shown in red in the 16s column)
  • 1 + 0 = 1
  • Answer 1 0 0 1 0 which is 18
Picture
ABOUT BINARY
1: Convert Binary below:
  • The numeric value of 10101010 is .......... 
  • The ASCII letter represented by 01001101 is .......... 
2: The rules for binary addition are listed below. Fill in the blanks.
  • Zero plus Zero = ..........
  • Zero plus One = ..........
  • One plus One = ........................................
  • One plus One plus One = ........................................
​3:Why was the Unicode system introduced?
4:Using 4 bits and in a logical way, list the binary values of 0 to 15.
​

​BINARY ADDITION
5: Add the following numbers. Show your working including the carry overs.
​(1 mark: Correct answer, 1 mark: Correct workings)​
  • 01111101 + 01100010
  • 11010010 + 00000110
  • 01100110 + 00100001
  • 10101010 + 01000111
  • 01000111 + 01110000
  • ​10101010 + 10101010
Picture
BINARY SUBTRACTION
Binary subtraction is also simple, again you could simply work out the binary values, convert to denary, do the addition in your normal way then convert back to binary. However, by using the same borrowing method that you would in normal math you can quickly do binary subtraction without the need to convert.

Remember in binary the column to the left of another column is double its neighbours value. 
64 : 32 : 16 : 8 : 4 : 2 : 1.
So for example; the 8 is the same as two 4s, so in a scenario where we have two 4s (8) minus one 4, the answer would be 4 (Two 4s minus one 4 = 4).

The example here shows 10 - 7
​Binary 1 0 1 0 - 0 1 1 0
BINARY MULTIPLICATION
To multiply binary number you can simply use the same method you would in normal mathematics, multiply each number on the second row with the top row and shift the units each time.
Starting from the right
  • 1 x 0 = 0
  • 1 x 0 = 0
  • 1 x 1 = 1
  • 1 x 0 = 0
  • Next row shift the units and repeat. Just like normal maths
Picture
LARGE BINARY NUMBERS
At this level you should not be expected to deal with binary numbers larger than 16 bits. Note that many Computer Science examination boards do not allow a calculator. Also, remember that the 16th bit is 2^15 not 2^16, because the first bit is 2^0 = 1, second 2^1 and so on. Also note that this is an unsigned representation, see negative number representation for further information of binary values that are assigned different properties.
So far we have mainly looked at binary in its 8 bit representation however, binary does not need to stay in the 1 byte format for example the number 38195 can be represented with one unsigned 16 bit binary number.
Picture
NEXT: HEXADECIMAL
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.