Page 28 - ComputerScience_Class_11
P. 28
After removing leading 0s in the integer part
(10010111001001) 2
Example 2: Convert (4AB.2) to binary.
16
Answer:
4 A(10) B(11) . 2
0100 1010 1011 . 0010
Binary equivalent is (0100 1010 1011.0010) 2
After removing leading 0s in the integer part and trailing 0s in the fractional part
(10010101011.001) 2
1.2.11 Octal to Hexadecimal and Hexadecimal to Octal
The steps to be followed are:
1. To convert octal to hexadecimal, first convert octal to binary and then convert binary to hexadecimal using the steps
mentioned above.
2. Similarly, to convert hexadecimal to octal, convert hexadecimal to binary and then convert binary to octal as shown
above.
Note: The above conversion can be done by first converting number of one base to decimal and then the
decimal number to number of another base. Previous mentioned method has been followed in this book
as it makes calculation simpler.
Example 1: Convert (2517) to hexadecimal.
8
Answer: Converting Octal to Binary first 4 (2 ) 2 (2 ) 1 (2 ) Octal
1
0
2
2 5 1 7 0 1 0 0 × 4 + 1 × 2 + 0 × 1 = 2
010 101 001 111 1 0 1 1 × 4 + 0 × 2 + 1 × 1 = 5
0 0 1 0 × 4 + 0 × 2 + 1 × 1 = 1
Binary equivalent is (010101001111) 2 1 1 1 1 × 4 + 1 × 2 + 1 × 1 = 7
Converting Binary to Hexadecimal after Grouping 0101 0100 1111.
0
1
3
2
0101 0100 1111 8 (2 ) 4 (2 ) 2 (2 ) 1 (2 ) Hexa
5 4 15(F) 0 1 0 1 0 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 5
0 1 0 0 0 x 8 + 1 x 4 + 0 x 2 + 0 x 1 = 4
1 1 1 1 1 x 8 + 1 x 4 + 1 x 2 + 1 x 1 =15
(54F) 16
Example 2: Convert (621.04) to hexadecimal.
8
Answer: Converting Octal to Binary first
2
1
0
6 2 1 . 0 4 4 (2 ) 2 (2 ) 1 (2 ) Octal
110 010 001 . 000 100 1 1 0 1 × 4 + 1 × 2 + 0 × 1 = 6
Binary equivalent is (110010001.000100) 2 0 1 0 0 × 4 + 1 × 2 + 0 × 1 = 2
Grouping 4 bits 0 0 1 0 × 4 + 0 × 2 + 1 × 1 = 1
Converting Binary to Hexadecimal after ignoring 0 0 0 0 × 4 + 0 × 2 + 0 × 1 = 0
trailing 0s in fractional part and adding 3 0s 1 0 0 1 × 4 + 0 × 2 + 0 × 1 = 4
before 1
26 Touchpad Computer Science (Ver. 3.0)-XI

