1. Number Systems - Notes
1. Number Systems - Notes
Chapters:
----------------------------------------------------------------------------------------------------------------------------------------------
Any Form of Data Needs to be Converted into a Binary Format so that it can be processed by the
Computer.
The Basic Building Block in all Computers is the Binary Number System.
Binary System only consists of 1s and 0s.
Computers have millions and millions of tiny ‘switches’ with states of ‘On’ (Represented by 1s)
and ‘Off’ (Represented by 0s).
----------------------------------------------------------------------------------------------------------------------------------------------
The Typical Headings for a Binary Number with 8 Digits would be:
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Hexadecimal Number System:
The Typical Headings for a Binary Number with 5 Digits would be:
----------------------------------------------------------------------------------------------------------------------------------------------
3. Interconversion
Example:
Step 1 – Write Down the Denary Number
29 28 27 26 25 24 23 22 21 20
1 0 0 1 1 1 0 0 1 1
Step 4 – Write Value in the Lower Row Altogether
1001110011
Steps: Example:
62
Binary to Hexadecimal Conversion:
Steps: Example:
Step 2.5 – If the Last Group (Left Most Group) doesn’t 0010|0001|1111|1101
have 4 digits, put 0s in front of it so that it
has 4 digits.
Steps: Example:
Steps: Example:
Step 4 – Write Dinary Value in the Lower Row as 163 162 161 160
Hexadecimal Values 2 1 F D
Step 5 – Write the Values in the Final Row Altogether
21FD
Step 6 –The Values in the Final Hexadecimal Value
Steps: Example:
Step 4 – Multiply those Groups as 16x-1 where x 2 × 163|1 × 162|15 × 161|13 × 160
increases as it moves towards the left. 2 × 4096|1 × 256|15 × 16|13 × 1
8192|256|240|13
----------------------------------------------------------------------------------------------------------------------------------------------
Benefits of Hexadecimal:
A Single Hexadecimal Digit is equivalent to 4 Binary Digits whereas a Single Denary Digit is only equivalent
to 3.32 Binary Digit
Easier for Humans to Remember, Copy and Work with.
4 Uses of the Hexadecimal System:
Error Code
Error Codes are often shown as Hexadecimal
Values. These numbers refer to the memory
location of the error and are usually automatically
generated by the computer. The programmer needs
to know how to interpret the hexadecimal error
codes. Examples of error codes from a Windows
system are shown below:
Media Access Control (MAC) Address refers to a number that uniquely identifies a device on a network. It
refers to the Network Interface Card (NIC) which is part of the device and is rarely changed so that a particular
device can always be identified no matter where it is.
A MAC Address is made up of 48 (or 64) Bits which are shown as 6 groups of 2 Hexadecimal digits:
NN:NN:NN:DD:DD:DD Or NN – NN – NN – DD – DD – DD
Example:
In 24:1B:7A:77:A2:FD:
24:1B:7A, for example, shows that the device was produced by the Apple Corporation
77:A2:FD, for example, shows that the device was made in China, was a part of Batch 162 and was the
253rd Device to be Manufactured
IP Address
IP (Internet Protocol) Address is an address assigned to every device in the network. An IPv4 Address is
written as a 32-bit Hexadecimal or Decimal Number. Whereas, an IPv6 Address is written as a 128-bit Hexadecimal
or Denary Number. Note that the BitsIP Address = 2Number after v + 1. For Hexadecimal (:) is used and for Decimal (.) is used
HyperText Mark-Up Language (HTML) Colour Codes
HyperText Mark-up Language (HTML) is used when Writing and Developing Web Pages. HTML isn’t a
Programming Language but is simply a Markup Language. A Mark-Up Language is used in the Processing,
Definition and Presentation of Text.
A Hexadecimal Colour is represented by 6 bits: The first 2 bits for Red, the middle 2 bits for Green and the
last 2 bits for Blue.
#000000 = Black
#FF0000 = Red
#00FF00 = Green
#0000FF = Blue
#FFFF00 = Yellow
#FF00FF = Margenta
#00FFFF = Cyan
#FFFFFF = White
Switch to Light Mode to See the Actual Colour except White (#FFFFFF)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Logical Shift showcases the Multiplication and Division of Binary Numbers by a Power of 2.
If a Left Logical Shift occurs by ‘n’ number of digits, the Binary Number is Multiplied by 2n.
Example: If 000101012 (2110) is Multiplied by 24 (16), it will become 01010000. Note that a ‘1’ is removed due to an
Overflow Error as it would be a 9-digit Binary Number.
If a Right Logical Shift occurs by ‘n’ number of digits, the Binary Number is Divided by 2n.
Example: If 000101012 (2110) is Divided by 24 (16), it will become 00001010. Note that a ‘1’ is removed due to an
Overflow Error as it would be a 9-digit Binary Number.
7. 2’s Complement
To showcase Negative Numbers, we use 2’s Complement where the Place Value of the first digit from the
Left is its Orginal Place Value × -1.
The Maximum and Minimum Values that can be represented in 2’s Complement becomes 2n – 1 and -2n.
As a Number is Represented by an 8-bit Binary Number, the Place Value of the First Digit (from the Left) in a 2’s
Complement is equal to -128; and the Maximum and Minimum Values that can be represented are 127 and -128.