0% found this document useful (0 votes)
20 views72 pages

IGYR1 - CH1 - Binary

This document covers data representation, focusing on binary and hexadecimal number systems, conversions, and the representation of images and sound. It includes learning objectives, methods for converting between number systems, and techniques for calculating file sizes for images and sound. Additionally, it discusses data compression methods, including lossy and lossless compression, and their advantages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views72 pages

IGYR1 - CH1 - Binary

This document covers data representation, focusing on binary and hexadecimal number systems, conversions, and the representation of images and sound. It includes learning objectives, methods for converting between number systems, and techniques for calculating file sizes for images and sound. Additionally, it discusses data compression methods, including lossy and lossless compression, and their advantages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 72

Data

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

❖ Learn to convert Decimal Numbers to Binary and vice versa


❖ 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
Let’s Understand
Analogue data: Continuous stream of data
processed by human beings.

Digital data: discrete data that uses only two


values(states) 0,1.
Number systems
What are the characteristics of the number
system we use?
Binary Number system

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

◈ Can represent more values with less


symbols
Activity Time!
Advantages of using Hexadecimal numbers
◈ Shorter way of representing values
For example: number 1000 is 3E8
◈ Easy for programmer to read
Eg. Color codes #77BB08
◈ Easier to debug and locate errors in data
Conversion of Binary to Hexadecimal
◈ Step 1: 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 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

◈ Step 2: Combine the obtained binary to form a single number.

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!

Convert Decimal Hexadecimal:

1. 24

2. 89

3. 371
Conversion of Hexadecimal to Denary
◈ Step 1: Convert the Hexadecimal to corresponding binary

◈ Step 2: Convert the resultant binary to denary.


e.g., 1E
Addition

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

• Character set Unicode

\ 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

Try to decode these messages:


a) 01000011 01001111 01001110 01000110
01001001 01000100 01000101 01001110
01000011 01000101

a) 01101101 01100001 01101110 01100101


01110101 01110110 01100101 01110010
Activity
1 2 3
01010000 01010010
01000110 01000110
01000001 01000011 01000110 01001001
01010010 01000111
01010100 01001001 01010010 01010011
01001001 01010110
01000011 01000101 / 01010100 / 01010100
01000101 / 01000001
01001101 01000001 01001011 01001000 01001001
01001110 01000100 /
01000101 01010011 / 01001110 01000111
01000110 01001111
01010000 01000101 01010000 01010011 / 01000110
01010010 01000111
01000110 01000101 01000011 01001001 01010010
01000101 01010100
01010100 01010011 01010100
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 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

1024 x 1024 – MiB

1024 x 1024 x 1024 – GiB

1024 x 1024 x 1024 x 1024 – TiB


Lets calculate the size of a image file
Find the size of the image file in KiB with the following information given:

• No of images in the file - 5


• Resolution of the image – 120x100
• Colour depth of the image – 8

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:

• Length of the sound track – 25 seconds


• Sample rate - 44100 hz
• Sample resolution of the track – 8 bits
SESSION 4
Unit Conversions

1024 – KiB

1024 x 1024 – MiB

1024 x 1024 x 1024 – GiB

1024 x 1024 x 1024 x 1024 – TiB


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 in MiB with the following information
given:

• Length of the sound track – 25 seconds


• Sample rate - 44100 hz
• Sample resolution of the track – 8 bits
Data Compression
Data Compression
• A method that uses an algorithm to reduce the size of a file.
Data Compression - Advantages

● Less storage

● Transmission of data takes less time

● Bandwidth required for transmission is less


SESSION 5
Learning Objectives
❖ Understand Lossy compression

❖ Understand Lossless compression

❖ Discuss the effect and application of both

compression methods
Lossless Compression
Lossy Compression
Recap

You might also like