Page 49 - Computer Science V2.0 Class 11
P. 49

1
                                                  0
                                                          2
                        2
                               1
                                    2
                                                                 1
                                                                        0
                    = (8) × 1 + 8 × (2 × 1 + 2 × 0 + 2 × 1) + (2 × 1 + 2 × 1 + 2 × 0)
                                           1
                                                                1
                                    2
                                3
                                                                        0
                                                         2
                        3 2
                                                   0
                    = (2 ) × 1 +2 × (2 × 1 + 2 × 0 + 2 × 1) +2 × 1 + 2 × 1 + 2 × 0
                        3 2
                                3
                                                                          0
                                               1
                                                     3
                                                                   1
                                    2
                                           3
                                                            2
                    = (2 )  × 1 + 2 × 2 × 1 +2 × 2 × 0 +2 × 1 +2 × 1 + 2 × 1 + 2 × 0
                                                          1
                                                                 0
                              5
                                            3
                                                   2
                    = 2 × 1 + 2 × 1 + 2 × 0 + 2 × 1 +2 × 1 + 2 × 1 + 2 × 0
                                     4
                       6
                 Thus, we find (156)  = (1101110)
                                  8           2
                         Find binary representation of (34) , (450) , and (301) .
                                                                    8
                                                          8
                                                    8
                 Binary to Hexadecimal Conversion
                 To convert a number from binary to hexadecimal, the sequence of steps is as follows:
                 1.   If the number of digits in the binary number is not a multiple of four, include the number with sufficient number
                    leading zeros to make the number of digits a multiple of four. For example, if the given number is (111011100) ,
                                                                                                                        2
                    we note that it has nine digits. We prefix it with three zeros to make its representation twelve (12=4x3) bits long:
                    (000111011100) .
                                   2
                 2.  Beginning from the leftmost (or rightmost) digit, form groups of four bits.
                 3.   Replace each 4-bit group by its corresponding hexadecimal digit. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 14, 15 as
                    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F respectively.
                 Example 9: Convert (111011100)  to its equivalent hexadecimal number.
                                               2
                             added three 0s
                    0 0 0 1  1  1  0  1 1  1  0  0
                      1        D         C
                    (111011100)  = (1DC) 16
                                2
                 To understand why the above method works, let us examine the following computations:
                    (111011100)
                                 2
                                                  4
                                            5
                                     6
                              7
                                                                2
                       8
                                                                              0
                                                                       1
                                                         3
                    = 2 × 1 + 2 × 1 + 2 x1 + 2 × 0 +2 × 1 + 2 × 1 + 2 x 1 + 2 × 0 + 2 × 0
                                               2
                                                                    2
                                4
                                                             3
                        4 2
                                    3
                                           4
                                                      4
                    = (2 )  × 1 + 2 × 2 × 1 +2 × 2 × 1 + 2 × 1 + 2 × 1 + 2 × 1
                                                                 4
                                                          0
                                                  1
                                                                                           4
                                                                                    0
                                4
                                                                                                         2
                        4 2
                                                                                                  3
                                                                             1
                                           2
                                                                     2
                    = (2 ) × 1 +2 × (2 × 1 + 2 × 0 + 2 × 0 + 2 × 0) + 2 × (2 × 1 + 2 × 0 + 2 × 0) + 2 × 1 + 2 × 1 + 2 × 1
                                    3
                                                                                                                   2
                                                                                                       0
                                                                                                            3
                                                                    1
                                                                                1
                                                                         2
                                                                                               1
                                                                                       0
                    = (16) × 1 + 16 × (2 × 1 + 2 × 0 + 2 × 0 + 2 × 0) + 16 × (2 × 1 + 2 × 0 + 2 × 0) + 16 × 1 + 16 × (2 × 1 + 2 x 1)
                                      3
                          2
                                  1
                                                            0
                                                    1
                                             2
                        2
                                1
                    = 16 × 1 + 16 × (13) + 16 × (12)
                                           0
                    = (1DC) 16
                 Hexadecimal to binary
                 To  convert  a  hexadecimal  number  to  binary,  replace  each  hexadecimal  digit  by  its  4-bit  expression  as  shown  in
                 example 10.
                 Example 10: (1DC)  to binary
                                 16
                       1          D         C
                       ↓          ↓         ↓
                      0001      1101      1100
                    (1DC)  = (000111011100)
                         16                 2
                          = (111011100) 2
                                                                                 Number Systems and Encoding Schemes  35
   44   45   46   47   48   49   50   51   52   53   54