Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Thursday, February 10, 2022

Number System Conversion

Number System Conversion




Introduction:


Numbers are central to the fields of mathematics and computer science, and a variety of number systems are employed to represent and work with them. Working with different numeric representations requires a thorough understanding of number system conversion. We will examine the idea of number system conversion in this article with a particular emphasis on the decimal, binary, octal, and hexadecimal systems. We will learn how to translate numbers between these systems and expand our knowledge of how they are used.


Number System Conversions

Numbers expressed in decimal are much more meaningful to us than are values expressed in any other number system. This is mainly because of the fact that we have been using decimal numbers in day-to-day life.  There are many methods or techniques that can be used to convert from one number base to another.

Number system Table

Binary

Octal

Decimal

Hexadecimal

0000

0

0

0

0001

1

1

1

0010

2

2

2

0011

3

3

3

0100

4

4

4

0101

5

5

5

0110

6

6

6

0111

7

7

7

1000

10

8

8

1001

11

9

9

1010

12

10

A

1011

13

11

B

1100

14

12

C

1101

15

13

D

1110

16

14

E

1111

17

15

F

 

a) Conversion from Decimal to Binary:

Rules:

i) Divide the decimal number by the base value of binary (2) and list the remainder.

ii) The process is continuing till the quotient becomes zero.

iii) Write the remainders left to right from bottom to top.

 

Example: a) Convert decimal 198 into Binary.

Remainder

2

198

0

2

99

1

2

49

1

2

24

0

2

12

0

2

6

0

2

3

1

2

1

1

 

0

 

Hence (198)10 = (11000110)2

Note: Write the answer in reverse order.

 

b)  Converting Decimal to Octal

Rules:

i) Divide the decimal number by the base value of Octal (8) and list the remainder.

ii) The process is continuing till the quotient becomes zero.

iii) Write the remainders left to right from bottom to top.

 

Example a) Convert the decimal number 528 into base value 8.

                                    Remainder

8

528


0

8

66

2

8

8

0

8

1

1

 

0

 

Thus, (528)10 = (1020)8

 

c)  Converting Decimal to Hexadecimal

Rules:

i) Divide the decimal number by 16 and list the remainder.

ii) The process is continuing till the quotient becomes zero.

iii) Write the remainders left to right from bottom to top.

Example: Convert decimal number 235 into Hexadecimal number.

16

235

11

16

14

14

 

0

 

Hexadecimal 14=E

Hexadecimal 11=B  [ Taken from the table]

Thus , (235)10 = (EB)16

 

d) Converting From Binary to Decimal

Rules:

i) Multiply each binary digit with its place value i.e positive powers of two with its positional weight.

ii) Add all the products.

Example: a) Convert Binary number 111111 into decimal no.

Binary no

1

1

1

1

1

1

Positional weight

5

4

3

2

1

0

=(1×25 + 1×24 + 1×23 + 1×22 + 1×21 + 1×20)

= 32 + 16 + 8 + 4 + 2 + 1

= 63

Thus, (111111)2= (63)10

 

e) Conversion from Binary to Octal.

Method -1:

i) Write the Binary number in group of 3 from right hand side.

ii) If any digits are inadequate for such group of 3, then add zeros before the number.

iii) Writes its corresponding value of octal from the table.

Example: Convert Binary number 10110 into Octal.

Binary number

10110

Grouped binary number

010

110

Corresponding octal value

2

6

 

So, (10110)2 = (26)8

 

Method -2:

First convert the Binary number into Decimal number

Now convert the decimal number into Octal number.

Example: Convert Binary number 10110 into Octal.

Binary number

1

0

1

1

0

Positional weight

4

3

2

1

0

 

Conversion:

= (1×24 + 0×23 + 1×22 + 1×21 + 0×20)

= 16+04+2+0

= 22

Therefore, (10110)2 = (22)10

Now,                                       Remainder

8

22


6

8

2

2

 

0

 

Hence, (10110)2 = (26)8

 

f) Conversion from Binary to Hexadecimal

Method -1 :

i) Write the binary number in group of 4 from right to left.

ii) If any digits are inadequate for such of group 4, then add 0 before the number as much is necessary.

iii) Write the equivalent Hexadecimal number from the table.

 Example: Convert Binary number 10110 into Hexadecimal.

Binary number

10110

Grouped binary number

0001

0110

Equivalent hexadecimal number

1

6

 

Therefore, (10110) 2 = (16)16

 

 Method -2

Convert the given binary number into Decimal number

Now convert decimal number into Hexadecimal number.

Example: Convert Binary number 10110 into Hexadecimal.

Binary number

1

0

1

1

0

Positional wight

4

3

2

1

0

 

= (1×24 + 0×23 + 1×22 + 1×21 + 0×20)

= 16 + 04 + 2 + 0

= 22

Therefore, (10110)2 = (22)10

Now,                                       Remainder

16

22


6

16

1

1

 

0

 

 

Therefore, (10110)2 = (16)16

 

g) Conversion from Octal to Decimal

Method:

i) Multiply each octal digit with its place value (8) with its positional weight.

ii) Add all the products.

Example: Convert octal number 435 into Decimal number.

Octal number

4

3

5

Positional weight

2

1

0

= (4 × 82 + 3 × 81 + 5 × 80)

= (4 × 64 + 3 × 8 + 5 × 1)

= (256 + 24 + 5)

= 285

Therefore, (435)8 = (285)10

 

h) Conversion from Octal to Binary

Method – 1

i) Write the equivalent 3 bits of binary number of octal from the table.

Example: Convert octal number 35 into Binary number.

Octal number

3

5

Equivalent binary number

011

101

 

Therefore, (35)8 = (011101)2

Method -2 :

First convert Octal number into Decimal number.

Now convert Decimal number into Binary number.

Example: Convert Octal number 35 into Binary number.

Octal number

3

5

Positional weight

1

0

= (3 × 81 + 5 × 80)

= 24 + 5

Therefore, (35)8 = (29)10

  

Now,                                       Remainder

2

29


1

2

14

0

2

7

1

2

3

1

2

1

1

 

0

 

Thus, (35)8 = (11101)2

 

i) Conversion from Octal to Hexadecimal

 Method-1:

i) Convert each octal digit into 3 bit of binary equivalent.

ii) Now, form the group of 4 digits of binary numbers from right hand side.

iii) Write the equivalent Hexadecimal value from the given table.

Example: Convert octal number 420 into Hexadecimal number.

Octal number

4

2

0

3 bit of binary equivalent

100

010

000

Group of 4 bits of binary digits

0001

0001

0000

Equivalent hexadecimal number

1

1

0

 

Thus, (420)8 = (110)16

Method -2:

i) First convert octal number into Decimal number.

ii) Now convert Decimal number into Hexadecimal number.

Octal no

4

2

0

Positional weight

2

1

0

= (4 × 82 + 2 × 81 + 0 × 80)

= 256+16+0

= 272

Thus, (420)8 = (272)10

Now,                                       Remainder

16

272


0

16

17

1

16

1

1

 

0

 

Therefore, (420)8 = (110)16

 

j) Conversion from Hexadecimal to Decimal

Method:

i) Multiply each hexadecimal digit with its place value(16) with its positional weight.

ii) Add all the products.

Example: Convert hexadecimal number AB2 into decimal.

Hexadecimal number

A

B

2

Positional weight

2

1

0

 

= (10 × 162 + 11 × 161 + 2 × 160) [A = 10, B = 11 taken from the table]

= (10 × 256 + 11 × 16 + 2 × 1)

= (2560 + 176 + 2)

= 2738

Thus, (AB2)16 = (2738)10

 

k) Conversion from Hexadecimal to Binary

Method – 1

i) Convert the Binary number in the group of 4 bits for each hexadecimal number.

ii) Provide base 2 to the result.

Example: Convert Hexadecimal number A2C into Binary.

Hexadecimal no

A

2

C

Equivalent binary number

1010

0010

1100

 

Therefore, (A2C)16 = (1010 0010 1100)2

Method -2

i) First convert Hexadecimal number into decimal.

ii) Then convert decimal number into Binary number.

Hexadecimal no

A

2

C

Positional weight

2

1

0

 

= (10 × 162 + 2 × 161 + 12 × 160) (A=10, C=12 taken from the table)

= (10 × 256 + 2 × 16 + 12 × 1)

= (2560 + 32 + 12)

= 2604

Therefore, (A2C)16 = (2604)10

Now,                                       Remainder

2

2604

0

2

1302

0

2

651

1

2

325

1

2

162

0

2

81

1

2

40

0

2

20

0

2

10

0

2

5

1

2

2

0

2

1

1

 

0

 

Thus, (A2C)16 = (101000101100)2

 

l) Conversion from Hexadecimal to Octal

Method -1

i) Convert each hexadecimal number into 4 bit of binary equivalent.

ii) Then form the group of 3 bits of binary digits from right hand side.

iii) If any digits are inadequate for such group of 3, then add zero before the number.

Now, write the equivalent octal value for each group from the table.

Example: Convert Hexadecimal number 183 into Octal.

Hexadecimal number

183

4 bits of binary equivalent

0001

1000

0011

 

3 bits of binary group

000

110

000

011

Equivalent octal number

0

6

0

3

 

Hence, (183)16 = (603)8

 

Method – 2

First convert Hexadecimal number into decimal number

Then convert decimal number into octal number.

Hexadecimal number

1

8

3

Positional weight

2

1

0

 

= (1 × 162 + 8 × 161 + 3 × 160)

= (256 + 128 + 3)

= 387

Thus, (183)16 = (387)10

Now,                                       Remainder

8

387

3

8

48

0

8

6

6

 

0

 

Therefore, (183)16 = (603)8

 

Convert as instructed (It carry 2 Marks) 

Specification Grid 2065

i) (235)8 into decimal

Octal number

2

3

5

Positional weight

 

 

 

 

= 2×82+3×81+5×80

= 2×64+3×8+5×1

= 128+24+5

= 157

Hence (235)8 = (157)10

 

ii) (BA5)16 into Binary.

Hexadecimal digit

B

A

5

Decimal equivalent digits

11

10

5

Binary equivalent digits

1011

1010

0101

 

Therefore, (BA5)16 = (101110100101)2

 

SLC 2065

i) (223)8 into decimal

Octal no

2

2

3

Positional weight

2

1

0

 

=2×82+2×81+3×80

=2×64+2×8+3×1

=128+16+3

=147

Therefore, (223)8 = (147)10

 

ii) (CA3)16 into binary

Hexadecimal no

C

A

3

Equivalent decimal digits

12

10

3

Equivalent binary digits

1100

1010

0011

 

Therefore, (CA3)16   = (110010100011)2

 

SLC Supplementary 2065

i) (756)8 into binary

Octal no

7

5

6

Equivalent binary no

111

101

110

 

 

 

 

Therefore, (756)8     = (111101110)2

 

ii) (1011011011)2 into Hexadecimal

Grouped binary no into 4 bit.

0010

1101

1011

Equivalent hexadecimal number

2

D

B

 

Hence, (1011011011)2 = (2DB)16

 

SLC 2066

i) (101)10 into binary

Divisor

Number

Remainder

2

101

 

2

50

1

2

25

0

2

12

1

2

6

0

2

3

0

2

1

1

2

0

1

Hence, (101)10 = (1100101)2

 

ii) (75)8 into decimal

Octal number

7

5

Positional weight

1

0

 

= 7×81+5×80

= 7×8+5×1

= 56+5

= 61

Therefore, (75)8 = (61)10

 

SLC 2068

i)  (108)10 into Binary

Reminder

2

108

0

2

54

0

2

27

1

2

13

1

2

6

0

2

3

1

2

1

1

 (108)10 = (1101100)2

 

ii) (173)8 into Binary

Octal number

1

7

3

Positional weight

2

1

0

 

= 1×82+7×81+3×80

= 1×64+7×8+3×1

= 64 + 56 + 3

= 123

 (173)8 = (123)10

 

SLC 2069

i) (684)10 into Octal

Reminder

8

684

 

8

85

4

8

10

5

8

1

2

 

0

1

 (684)10 = (1254)8

 

ii) (101011)2 into Decimal

Binary number

1

0

1

0

1

1

Positional weight

5

4

3

2

1

0

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

= 1×32 +0×16 +1×8+0×4+1×2+1×1

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

 (101011)2 = (43)10

 

SLC 2070

i) (BED)16 into Binary

Hexadecimal number

B

E

D

Equivalent binary number

1011

1110

1101

 

Therefore, (BED)16 = (101111101101)2

 

ii) (1010111)2 into octal

Binary number

1010111

Grouped binary no

001

010

111

Equivalent octal no

1

2

7

 

Therefore, (1010111)2 = (127)8

 

SLC 2071

i) 108)10 into binary

Reminder

2

108

 

2

54

0

2

27

0

2

13

1

2

6

1

2

3

0

2

1

1

2

0

1

 

 (108)10 = (1101100)2

 

ii. (765)8 into decimal

Octal no

7

6

5

Positional weight

2

1

0

 

= 7×82+6×81+5×80

= 448+48+5 = 501

 (765)8 = (501)10

 

SEE 2074

i)  (523)8 into base 2

Here,  

5 = 101

2 = 010

3 = 011

(523)8=(101010011)2

 

ii)  (2074)10 into hexadecimal

Reminder

16

2074

10=A

16

129

1

16

8

 

 

(2074)10 = (81A)16


Conclusion:

It's essential to comprehend number system conversion for a variety of mathematical and computer science applications. We have looked at how the decimal, binary, octal, and hexadecimal systems can be converted. You can quickly convert numbers between these systems by adhering to the provided step-by-step procedures. To improve your proficiency, keep in mind to practice these conversions.


No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages