IGYR1 - CH1 - Binary
IGYR1 - CH1 - Binary
Representatio
n
Chapter 1 Session 1
What will be covered in the chapter?
❖ Binary Number system
❖ Hexadecimal Number System
❖ Binary number manipulations and negative
numbers
❖ Number system conversions
❖ Representation of images and sound
❖ Measuring data
❖ Data compression
Learning Objectives
❖ Differentiate between analogue data and digital data
❖ Understand the Binary Number system and its uses
26 25 24 23 22 21 20
Decimal to Binary Conversion
75
64 32 16 8 4 2 1
Run your race!
292
47
85
Binary to Decimal Conversion
100110
1 0 0 1 1 0
Convert to decimal number system
1101101
Convert to decimal number system
1101
Convert to decimal number system
1010001
SESSION 2
Learning Objectives
❖ Understand the Hexadecimal Number System and Octal
number System
❖ Discuss the uses of Hexadecimal number system
❖ Conversion of hexadecimal numbers to binary and vice
versa
❖ Conversion of hexadecimal numbers to Denary number
❖ Learn how the binary addition, left shift and right shift
works.
Hexa-decimal Number system
◈ Base = 16
◈ 16 unique characters to represent
values:
0-9, A-F
4 2 1 8 4 2 1
1 1 0 1 0 1 0
◈ Step 2: Add the numbers in a group that have a bit of value one :
4+2=6 8+2=10
◈ Step 3: Write the corresponding hexadecimal numbers for the obtained
value:
i.e, 6A
Hands on!
Convert to Hexadecimal:
1. 11010010100
2. 10010011111
3. 11100101010
Conversion of Hexadecimal to Binary
◈ Step 1: Write the corresponding 4 bit binary of each digit in the
hexadecimal number:
e.g.: C5 C 5
1 1 0 1 0 1 0 1
1 1 0 1 0 1 0 1
Hands on!
Convert to Binary:
1. 23A
2. 1D0
3. CAB
Conversion of Denary to Hexadecimal
◈ Step 1: Convert the denary number to binary
10610
64 32 16 8 4 2 1
1 1 0 1 0 1 0
◈ Step 2: Group the binary bits into groups of 4 from the right and write the binary
positional value:
4 2 1 8 4 2 1
1 1 0 1 0 1 0
◈ Step 3: Add the numbers in a group that have a bit of value one :
4+2=6 8+2=10
◈ Write the corresponding hexadecimal numbers for the obtained value:
i.e, 6A
Hands on!
1. 24
2. 89
3. 371
Conversion of Hexadecimal to Denary
◈ Step 1: Convert the Hexadecimal to corresponding binary
Binary Logical
Manipulation Shift
2’s
compliment
Binary Addition
Rules:
0+0=0
1+0=1
1+1=10
1+1+1=11
Let’s Practice
a. 00101001 c. 0 0 1 1 1 0 1 0
10111011 10111011
b. 01010101 d. 0 1 0 1 0 1 0 1
10000110 10000100
Logical Binary shifts
Left shift
Logical Binary shifts
Right shift
Effect of Logical Shifts
Multiplication
To multiply a number, left logical shift is used,
• to multiply by two, all digits shift one place to the left
• to multiply by four, all digits shift two places to the left
• to multiply by eight, all digits shift three places to the left
• and so, on
Effect of Logical Shifts
Division
To divide a number, the right logical shift is used.
to divide by two, all digits shift one place to the right
to divide by four, all digits shift two places to the right
to divide by eight, all digits shift three places to the right
and so on
Negative numbers
representation in binary
Steps :
1. Inverse every bit in the number whose negative is to be
represented.
2. Add 1 to the LSB.
3. The resultant binary is the negative representation of the
number.
Negative numbers
representation in binary
Eg: -35
Step 1 : binary equivalent of 35
Step 2 : inverse every bit
Step 3 : add 1 to the LSB
Eg 10010
SESSION 3
Learning Objectives
❖ Understand the representation of text in the
computer
❖ Understand how images are converted to binary
❖ Learn to calculate the memory space required by
a file(image & sound)
Representation of text in
binary
\ ASCII
Representation of text in
ASCII :
binary
• 7 bit
• 128 characters can be represented
• Extended ASCII is a 8 bit representation
• It can represent 256 characters
• A – Z – 65- 90
• a-z – 97 - 122
ASCII TABLE
• Resolution
• Metadata
• Colour depth
Converting images to binary
• Pixels
• Resolution
• Metadata
• Colour depth
Converting images to binary
• Pixels
• Resolution
• Metadata
• Colour depth
Converting images to binary
• Pixels
• Resolution
• Metadata
• Colour depth
Converting sounds to binary
• Sampling
• Sample rate
• Sample resolution
Lets understand
Converting sounds to binary
• Sampling
• Sample rate
• Sample resolution
Lets understand
Measuring Data Storage
How to calculate the size of an
image file
Elements you need to know to perform the calculation:
• No of images in the file
• Resolution of the image
• Colour depth of the image
Procedure:
• Find the pixels in the one image
• Find how many bits in total to represent the pixels
• Find the same for all images on the whole.
• Divide the result to bytes
• And then further divide with 1024 or its powers based on
the unit.
How to calculate the size of an
image file
1024 – KiB
Procedure:
• Find the pixels in the one image - 120x100 - 12000
• Find how many bits in total to represent the pixels – 12000 x 8= 96000
• Find the same for all images on the whole – 96000 x 5 = 480000
• Divide the result by 8 for the number of bytes – 480000 / 8 = 60000
• And then further divide with 1024 or its powers based on the unit. –
60000/1024 = 58.5 KiB
How to calculate the size of a
sound file
Elements you need to know to perform the calculation:
• Length of the sound track
• Sample rate
• Sample resolution of the track
Procedure:
• Find how many bits in total to represent the sample in one second
• Find the same for the length of sound track on the whole.
• Divide the result by 8 to represent it in bytes
• And then further divide with 1024 or its powers based on the unit.
Lets calculate the size of a sound file
Find the size of the sound track with the following information given:
1024 – KiB
Procedure:
• Find how many bits in total to represent the sample in one second
• Find the same for the length of sound track on the whole.
• Divide the result by 8 to represent it in bytes
• And then further divide with 1024 or its powers based on the unit.
Lets calculate the size of a sound file
Find the size of the sound track in MiB with the following information
given:
● Less storage
compression methods
Lossless Compression
Lossy Compression
Recap