0% found this document useful (0 votes)
4 views15 pages

Data Representation Tutorial 1

This document provides an overview of various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between them. It explains the significance of each system in digital representation and outlines step-by-step procedures for conversions, including examples. The document emphasizes the importance of understanding these conversions for working with digital systems.

Uploaded by

asmitnath01
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)
4 views15 pages

Data Representation Tutorial 1

This document provides an overview of various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between them. It explains the significance of each system in digital representation and outlines step-by-step procedures for conversions, including examples. The document emphasizes the importance of understanding these conversions for working with digital systems.

Uploaded by

asmitnath01
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/ 15

Class 11

Data Representation……..tutorial_1
For Computer Science students’
Hopefully, all of you go through the previous uploaded materials. In this material we discuss about various number
systems, conversion from one number system to other.

The technique to represent and work with numbers is called number system. In digital representation, various number
systems are used. The most common number systems used are decimal, binary, octal and hexadecimal number system.

1. Decimal Number System(DEC):- The decimal number system (Base 10) is composed of 10 numbers or symbols (Deca
means 10, that is why this system is called decimal number system). It is also known as base – 10 number system as it has 10
digits.

The 10 symbols are:-

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Using these symbols as digits of a number, we can express any quantity.

Unfortunately, the decimal number system does not lend itself convenient implementation in digital systems. Every digital
systems uses the binary number system.

2. Binary Number System(BIN):- In the binary number system (Base 2) there are only two symbols 0 and 1. It is Base – 2
system.

Symbols: 0, 1

3. Octal Number System (OCT):- In the octal number system (Base 8) there are eight unique symbols. It is Base – 8 system.

Symbols: 0, 1, 2, 3, 4, 5, 6, 7

4. Hexadecimal Number System(HEX):- The hexadecimal system uses Base 16. Thus it has 16 possible symbols.

Symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

(Here actually A means 10 in decimal, B means 11, C means 12, D means 13, E means 14 and F means 15 in decimal)

Number Systems Conversions:-


The binary number system is the most important one in digital systems as it is very easy to implement in circuitry. The
decimal system is important because it is universally used to represent quantities outside a digital system.

In addition to binary and decimal number system, octal and hexadecimal number systems are also used in digital systems for
representing large binary numbers.

In a digital system, these number systems may be in use at the same time, so that an understanding of the system operation
requires the ability to convert from one number system to another.

Let’s see how to perform these conversions.


I am going to discuss you one method to easily remember these conversions from one number system to other.

There are mainly two situations,

(1) When you convert from decimal number system to any other number systems (means in left side – Decimal )

(2) Convert from any other number systems to decimal number system (means in right side – Decimal )

Decimal  Binary Binary  Decimal

Decimal  Octal Octal  Decimal

Decimal  Hexadecimal Hexadecimal  Decimal

For the above conversions, we will follow division by For the above conversions, we will follow

the base (of the number system on right side) way: following technique:

as follows:

For, Decimal  Binary Digit * (Base)position + Digit * (Base)position +……..

divide the number by 2 as Base of Binary is 2 Here Base indicates the base of the number system

Similarly for, Decimal  Octal present in left side of conversion

divide the number by 8 as Base of Octal is 2 see examples ……….

Similarly for, Decimal  Hexadecimal

divide the number by 16 as Base of Hexadecimal is 2

See examples…………
Decimal to Binary conversion:-
Example:- Convert 43 to its binary equivalent.

OR (43)10  (?)2

solution)

Divide the number by 2 (Base of the right hand side number system) note down the remainder then again divide the quotient
by 2 note down the remainder (obviously integer division)…… and that process will continue till the quotient become 0.

= ( 101011 )2
So, the answer is (43)10 = ( 101011 )2

Task: (i) (85)10  ( ? )2 [ Check with the answer (1010101)2 ]

(ii) (200)10  ( ? )2 [ Check with the answer (11001000)2 ]

Binary to Decimal conversion:-


Example:- Convert (101011)2 into its decimal equivalent

OR (101011)2  ( ? )10

Solution)

the binary number is  1 0 1 0 1 1 find out the position of


each digit

positions 5 4 3 2 1 0

[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see

= 1 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20

= 32 + 0 + 8 + 0 + 2 + 1

= ( 43 )10

So, ( 101011 )2 = ( 43 )10

Task: (i) (1010101)2  ( ? )10 [ Check with the answer (85)10 ]

(ii) (11001000)2  ( ? )10 [ Check with the answer (200)10 ]

Now, In similar way we convert other number systems. Let’s see:

Decimal to Octal Conversion:-


Example:- Convert 266 to its binary equivalent.

OR (266)10  (?)8

solution)

Divide the number by 8 (Base of the right hand side number system) note down the remainder then again divide the quotient
by 8 note down the remainder (obviously integer division)…… and that process will continue till the quotient become 0.

= ( 412 )8

So, the answer ( 266 )10 = ( 412 )8


Task: (i) (371)10  ( ? )8 [ Check with the answer (563)8 ]

Octal to Decimal Conversion:-


Example:- Convert (412)8 into its decimal equivalent

OR (412)8  ( ? )10

Solution)

the octal number is  4 1 2 find out the position of


each digit

positions 2 1 0

[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see

= 4 x 82 + 1 x 81 + 2 x 80

= 256 + 8 + 2

= ( 266 )10

So, ( 412 )8 = ( 266 )10

Task: (i) (372)8  ( ? )10 [ Check with the answer (250)10 ]

Decimal to Hexadecimal Conversion:-


Example:- Convert 578 to its hexadecimal equivalent.

OR (578)10  (?)16

solution)

Divide the number by 16 (Base of the right hand side number system) note down the remainder then again divide the
quotient by 16 note down the remainder (obviously integer division)…… and that process will continue till the quotient
become 0.

= ( 242 )16

So, the answer ( 578 )10 = ( 242 )16

Another Example:-

Example:- Convert 423 to its hexadecimal equivalent.

OR (423)10  (?)16
solution)

= ( 1A7 )16

So, the answer ( 423 )10 = ( 1A7 )16

Task: (i) (214)10  ( ? )16 [ Check with the answer (D)16 ]

(ii) (2478)10  ( ? )16 [ Check with the answer (9AE)16 ]

Hexadecimal to Decimal Conversion:-


Example:- Convert (242)16 into its decimal equivalent

OR (242)16  ( ? )10

Solution)

the hexadecimal number is  2 4 2 find out the position of


each digit

positions 2 1 0

[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see

= 2 x 162 + 4 x 161 + 2 x 160

= 512 + 64 + 2

= ( 578 )10

So, ( 242 )16 = ( 578 )10

Another Example:- Convert (98AC)16 into its decimal equivalent

OR (98AC)16  ( ? )10

Solution)

the hexadecimal number is  9 8 A C find out the position of


each digit

positions 3 2 1 0

[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see


= 9 x 163 + 8 x 162 + 10 x 161 + 12 x 160 [ As 10  A, 11  B, 12  C, 13  D, 14  E, 15  F in HEX]

= 36864 + 2048 + 160 + 12

= ( 39084 )10

So, ( 98AC )16 = ( 39084 )10

Task: (i) (5A2B)16  ( ? )10 [ Check with the answer (23083)10 ]

(ii) (3F4)16  ( ? )10 [ Check with the answer (1012)10 ]

NOW, you think about the conversion from Binary to Octal then !!!!!!!!

Yes, you should follow two steps:

First: Convert the number to its decimal equivalent (i.e. Binary  Decimal)

Then Second: Convert the Decimal result to octal equivalent.

Let’s see…

Binary to Octal Conversion:


Example:- Convert (100111010)2 into its Octal equivalent

OR (100111010)2  ( ? )8

Solution)

First, we convert binary to decimal i.e. (100111010)2  ( ? )10

the binary number is  1 0 0 1 1 1 0 1 0 find out the position of


each digit

positions 8 7 6 5 4 3 2 1 0

[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see

= 1 x 28 + 0 x 27 + 0 x 26 + 1 x 25 + 1 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20

= 256 + 0 + 0 + 0 + 32 + 16 + 8 + 0 + 2 + 0

= ( 314 )10

So, ( 100111010 )2 = ( 314 )10

Now, second: we convert the above decimal number to its octal equivalent. (i.e. Decimal  Octal)

means (314)10  (?)8


Divide the number by 8 (Base of the right hand side number system) note down the remainder then again divide the quotient
by 8 note down the remainder (obviously integer division)…… and that process will continue till the quotient become 0.

So, (314)10 = (472)8

Now, the answer ( 100111010 )2 = ( 472 )8

Octal to Binary Conversion:


Example:- Convert (472)8 into its binary equivalent

OR (472)8  ( ? )2

Solution) we follow two steps:

First: convert the octal number to its decimal equivalent (i.e. Octal  Decimal )

then Second: convert the decimal number to its equivalent binary (i.e. Decimal  Binary)

Let’s see…..

First: (472)8  ( ? )10 Octal  Decimal

the octal number is  4 7 2 find out the position of


each digit

positions 2 1 0

[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see

= 4 x 82 + 7 x 81 + 2 x 80

= 256 + 56 + 2

= ( 314 )10

So, ( 472 )8 = ( 314 )10

Second: Now, we convert the decimal number to its equivalent binary

i.e. (314)10  ( ? )2 Decimal  Binary


Divide the number by 2 (Base of the right hand side number system) note down the remainder then again divide the quotient
by 2 note down the remainder (obviously integer division)…… and that process will continue till the quotient become 0.

= (100111010)2

Now, the result (472)8  ( 100111010 )2

Similarly, we can convert Binary to Hexadecimal conversion.

Let’s see….

Binary to Hexadecimal Conversion:


Example:- Convert (10011101)2 to its hexadecimal equivalent.

OR (10011101)2  (?)16

solution)

First, we convert: Binary  Decimal i.e. (10011101)2  (?)10

the binary number is  1 0 0 1 1 1 0 1 find out the position of


each digit

positions 7 6 5 4 3 2 1 0

[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see

= 1 x 27 + 0 x 26 + 0 x 25 + 1 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20

= 128 + 0 + 0 + 16 + 8 + 4 + 0 + 1

= ( 157 )10

So, ( 10011101 )2 = ( 157 )10

Now, we convert (157)10 to its hexadecimal equivalent. i.e. Decimal  Hexadecimal


= (9D)16

So, the answer ( 10011101 )2 = ( 9D )16

Similarly, we can convert Octal to Hexadecimal also.

Octal to Hexadecimal Conversion:-


First we convert Octal to Decimal

Then we convert that Decimal number to its equivalent hexadecimal number.

Example: Convert (247)8 to its hexadecimal equivalent.

OR (247)8  (?)16

solution) First Octal  Decimal conversion:

the octal number is  2 4 7 find out the position of


each digit

positions 2 1 0

= 2 x 82 + 4 x 81 + 7 x 80

= 128 + 32 + 7

= ( 167 )10

So, ( 247 )8 = ( 167 )10

Now, we can convert ( 167 )10 to its hexadecimal equivalent i.e. Decimal  Hexadecimal

So, ( 167 )10 = ( A7 )16

So, the answer ( 247 )8 = ( A7 )16


Similarly, we can convert Hexadecimal to Octal also.

Hexadecimal to Octal conversion:-


First we convert Hexadecimal to Decimal

Then we convert that Decimal number to its equivalent Octal number.

Example: Convert (A7)16 to its Octal equivalent.

OR (A7)16  (?)8

solution) First Hexadecimal  Decimal conversion i.e. (A7)16  (?)10

the hexadecimal number is  A 7 find out the position of


each digit

positions 1 0

= 10 x 161 + 7 x 160 [ as A indicate 10 in decimal]

= 160 + 7

= ( 167 )10

So, ( A7 )16 = ( 167 )10

Now, we can convert (167)10  ( ? )8 i.e. Decimal  Octal

So, ( 167 )10 = ( 247 )8

So, the answer ( A7 )16 = ( 247 )8

NOW, there is an easy way to convert from Binary to Octal and Binary to
Hexadecimal………..see….

For that you should know the binary representation of 1 to 15 (for easy conversion):

first look at the binary equivalent of 1 to 15 decimal numbers:


Now, you can see from the table, to represent first two numbers (i.e. 0 and 1) in
binary only one bit is required ( as 21 = 2 )

Similarly, to represent first four numbers (i.e. 0, 1, 2, 3) in binary two bits are
required ( as 22 = 4 )

Similarly, to represent first eight numbers (i.e. 0, 1, 2, 3, 4, 5, 6, 7) in binary three


bits are required ( as 23 = 8 )

Similarly, to represent first sixteen numbers (i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,


12, 13, 14, 15) in binary four bits are required ( as 24 = 16 )

So, we represent the binary numbers as per our requirement as follows:

i.e. if we want to represent ‘0’ in two bits format then we write 00, for three bits we write 000 and for four bits we write
0000.

Similarly, if we write ‘2’ in binary  10 , if we want to write it in three bits format then 010, for four bits format it is 0010.

Don’t try to memorize the above………………just follow the following technique to remember:

suppose you want to write binary equivalent from 0 to 15 then how many numbers are there?

Yes…..it’s 16 numbers so, how many bits are requires?

Yes, 4 bits as 24 = 16

after deciding the number of bits follow following technique:


(i) first you write 0 and 1 alternatively in 1st bit position for all numbers……see

(ii) then you write two zero’s and two one’s alternatively in the 2nd bit position for all numbers ….see..

(iii) then you write four zero’s and four one’s alternatively in the 3rd bit
position for all numbers ….see..

(iii) then you write eight zero’s


and eight one’s alternatively in
the 4th bit position for all
numbers ….see
Okay students,

Now come to our discussion i.e.

Binary to Octal conversion (easier way):-

(11010110)2  ( ? )8

First you grouped the digits into groups of three bits starting from right hand side (i.e. LSB – Least Significant Bit)

See………… (if there is less than three digits in the left most group then insert zeros )

0 1 1 0 1 0 1 1 0
0 inserted as
there are two
digits in left
most group

now you can write the decimal equivalent of each group i.e.

0 1 1 0 1 0 1 1 0

3 2 6

So, the answer (11010110)2  ( 326 )8

Now, Octal to Binary conversion (easier way):-

(326)8  ( ? )2

Here, we represent each digit of the octal number in its binary equivalent of 3 bits form…..see….

3 2 6

011 010 110

So, the answer is (326)8  ( 11010110 )2 [ discard left most zeros’ while writing answer ]

Now, Binary to Hexadecimal conversion (easier way):-

(1010111010)2  ( ? )16

First you grouped the digits into groups of four bits starting from right hand side (i.e. LSB – Least Significant Bit)

See………… (if there is less than four digits in the left most group then insert zeros )

0 0 1 0 1 0 1 1 1 0 1 0
two 0 ‘s inserted
as there are two
digits in left
most group
now, you can write the decimal equivalent of each group i.e.

0 0 1 0 1 0 1 1 1 0 1 0

2 11 means 10 means
B in hex A in hex

So, the answer (11010110)2  ( 2BA )16

Hexadecimal to Binary conversion (easier way):-

(9F2)16  ( ? )2

Here, we represent each digit of the hexadecimal number in its binary equivalent of 4 bits form…..see….

9 F 2 [ F means 15 in decimal ]

1001 1111 0010

So, the answer is (9F2)16  ( 100111110010 )2 [ discard left most zeros’ while writing answer here
left most zero’s not present ]

Now, Octal to Hexadecimal Conversion ( easier way):-

(1646)8  ( ? )16

First, we convert the Octal number to its equivalent binary ( in 3 bits form)……

1 6 4 6

001 110 100 110

now, grouped the digits into groups of four bits starting from right hand side of the binary number

0 0 1 1 1 0 1 0 0 1 1 0

3 10 means A 6
So, the answer is (1646)8  ( 3A6 )16
Now, Hexadecimal to Octal Conversion ( easier way):-

(7F5C)16  ( ? )8

First, we convert the Hexadecimal number to its equivalent binary ( in 4 bits form)……

7 F 5 C

0111 1111 0101 1100

now, grouped the digits into groups of three bits starting from right hand side of the binary number ( discard left
most zero’s if any)

1 1 1 1 1 1 1 0 1 0 1 1 1 0 0

7 7 5 3 4

So, the answer is (7F5C)16  ( 77534 )8

Task: (i) (1948B)16  ( ? )8 [ Check with the answer (312213)8 ]

(ii) (1247662)8  ( ? )16 [ Check with the answer (54FB2)16 ]

(iii) (10101111101101)2  ( ? )8 [ Check with the answer (25755)8 ]

(iv) (1101111110010)2  ( ? )16 [ Check with the answer (1BF2)16 ]

(v) (3ED52)16  ( ? )2 [ Check with the answer (111110110101010010)2 ]

Read the whole materials carefully…..


and try to solve all given tasks
For any problem message or call me

You might also like