Data Representation& Programming

By Mona Kumari|Updated : June 24th, 2021

Data Representation

  1. INTRODUCTION TO NUMBER SYSTEMS

A number is made up of a collection of digits having two parts; integer and fraction, both are separated by a radix point (⋅). The number is represented as:

 

Data Representation

  1. INTRODUCTION TO NUMBER SYSTEMS

A number is made up of a collection of digits having two parts; integer and fraction, both are separated by a radix point (⋅). The number is represented as:

byjusexamprep

Here,

r = radix or base of the number system

n = number of digits in the integer part

m = number of digits in fractional part

dn–1 = most significant digit (MSD)

d-m = least significant digit (LSD)

On the basis of number of different symbols used, number systems are classified as:

∙   Decimal number system

∙   Binary number system

∙   Octal number system

∙   Hexadecimal number system

1.1.   Decimal number system:

The decimal number system is a radix-10 number system as it uses 10 digits from 0 to 9. These are 0,1,2,3,4,5,6,7,8, and 9. All the higher numbers after ‘9’ are represented in terms of these 10 digits only. The radix point is known as the decimal point.

The weights of different digits in a mixed decimal number, starting from the decimal point are 100, 101, 102, and so on for the integer part and 10-1, 10-2, 10-3, and so on for the fractional part. The value of a decimal number can be expressed as a sum of various digits multiplied by their place values or weights.

 

Example :

Let’s we have (453)10 is a decimal number then, 

byjusexamprep

We can say that ‘3’ is the least significant digit (LSD) and ‘4’ is the most significant digit (MSD).

1.2.   Binary number system:

It has base or radix ‘2’ i.e. it has two numbers 0 and 1 and these base numbers are called “Bits”. In this number system, group of four bits is known as “Nibble” and group of eight bits is known as “Byte”.

4 bits = 1 Nibble, 8 bits = 1 Byte

All larger binary numbers are represented in term of ‘0’ and ‘1’.  The radix point is known as the binary point. These symbols are known as bits (binary digits). It is a positional number system; the weight of bit is defined by its position with base 2.

 

Starting from the binary point, the weights of different digits in a mixed binary number are 20, 21, 22, and so on for the integer part and 2-1, 2-2, 2-3, and so on for the fractional part.

Example 1: 

The decimal number representation of (101101.10101) is?

Solution:  

(101101.10101)2

1 × 25 + 0 × 24 + 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 + 1 × 2–1 + 0 × 2–2 + 1 × 2–3 + 0 × 2–4 + 1 ×2–5 

= 32 + 0 + 8 + 4 + 0 +byjusexamprep

= (45.65625)10

1.3.   Octal number system:

It has a base of ‘8’ and it possess 8 distinct symbols (0, 1, 2...,7). It is a method of grouping binary numbers in a group of three bits. The independent digits are 0,1,2,3,4,5,6,7. All the higher order number are expressed as a combination of these on the same pattern as the one followed in case of binary and decimal number system described in previous sections. In the octal number system, the radix point is known as the octal point.

The weights for different digits in the octal number system are 80, 81, 82, and so on for the integer part and 8-1, 8-2, 8-3, and so on for the fractional part.

Example : 

Convert (367.721)8 into decimal system.

Solution: 

(367.721)8 = 3 x 82 + 6 x 81 + 7 x 80 + 7 x 8–1 + 2 x 8–2 + 1 x 8–3

                                 = 192 + 48 + 7 + 0.875 + 0.03125 + 0.00195

                                = (247.908)10

1.4.   Hexadecimal number system:

The base for this system is “16”, which requires 16 distinct symbols to represent the numbers. Its 16 basic digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. It is a method of grouping 4 bits. The decimal equivalent of A, B, C, D, E, and F are 10, 11, 12, 13, 14, and 15, respectively.

 

The weights of different digits in a mixed hexadecimal number are 160, 161, 162, and so on for the integer part and 16-1, 16-2, 16-3, and so on for the fractional part.

Example 5:    

Convert (3A.2F)16 into decimal system.

Solution: 

(3A ⋅ 2F)16 = 3 × 161 + 10 × 160 +2 × 16–1 + 15 × 16–2   

                                          byjusexamprep

                            = (58.1836)10

  1. CONVERSION BETWEEN DIFFERENT NUMBER SYSTEM

        Computer system process binary data, but the information given by the user may be in the form of decimal number, hexadecimal number, or octal number. So, it is required to study the conversion of numbers from one number system to another.

Table 1: Counting in different number system

 

Decimal Number System

Hexadecimal Number System

Octal Number System

Binary Number System

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

0

1

2

3

4

5

6

7

10

11

12

13

14

15

16

17

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111

 

2.1. OTHER BASE SYSTEM TO DECIMAL 

2.1.1. Binary to Decimal Conversion

A binary number can be converted to decimal equivalent by multiplying each binary digit by its positional weightage.

Example : 

Convert (11101.1011)2 into decimal.

byjusexamprep

Solution:

2.1.2. Octal to Decimal Conversion

An octal number can be converted to decimal equivalent by multiplying each octal digit by its positional weightage.

Example :  Convert (6327.4051)8 into equivalent decimal number.

                   Solution:

(6327.4051)8 

= 6 ×83 +3 × 82 + 2 × 81 +7 × 80 + 4 × 8–1 + 0 x 8–2 + 5 × 8–3 + 1 ×8–4

= (3287.5100098)10

Thus,

(6327.4051)8 = (3287.5100098)10

          2.1.3. Hexadecimal to Decimal Conversion

A hexadecimal number can be converted to decimal equivalent by multiplying each hexadecimal digit by its positional weightage.

           Example 8:

           Convert (5C7)16 into decimal

           Solution:

                                byjusexamprep

Candidates can practice 150+Mock Tests with BYJU'S Exam Prep Test Series for exams like GATE, ESE, NIELIT from the following link:

Click Here to Avail Electronics Engineering Test Series (150+ Mock Tests)

Get unlimited access to 24+ structured Live Courses all 150+ mock tests to boost your GATE 2021 Preparation with Online Classroom Program:

Click here to avail Online Classroom Program for Electronics Engineering

Thanks

Sahi Prep Hai To Life Set Hai.

 
Download BYJU'S Exam Prep, Best gate exam app for Preparation

Comments

write a comment

Follow us for latest updates