Skip navigation

This solution is for the book I am currently reading. All of my notes and solutions are available at Google Code.

Here is my work for problem 2.3:

A single byte can be represented by two hexadecimal digits. Fill in the missing 
entries in the following table, giving the decimal, binary and hexadecimal 
values of different byte patterns.

-------------------------------
Decimal   Binary    Hexadecimal
-------------------------------
    0    00000000       00
-------------------------------
   55
-------------------------------
  136
-------------------------------
  243
-------------------------------
         01010010
-------------------------------
         10101100
-------------------------------
         11100111
-------------------------------
                        A7
-------------------------------
                        3E
-------------------------------
                        BC
-------------------------------


1)
Decimal = 55
  55/16 = 3
  16 * 3 = 48
  56 - 48 = 7
 A) 55 = 3 * 16 + 7 (7)
  3/16 = 0
 B) 3 = 0 * 16 + 3 (D)
 Hexadecimal = 0x37
 Binary = 00010111

2)
Decimal = 136
    8 * 16 = 128
    136 - 128 = 8
  A) 136 = 8 * 16 + 8
    8/16 = 0
  B) 8 = 0 * 16 + 8
  Hexadecimal = 0x88
  Binary = 10001000


3)
Decimal = 243
    16 * 15 = 240
    243 - 240 = 3
  A) 243 = 15 * 16 + 3
  B) 15 = 0 * 16 + 15
  Hexadecimal = 0xF3
  Binary = 11110011

4)
Binary = 01010010
  Hexadecimal = 0x52
    = 5 * 16 + 2
    = 50 + 30 + 2
  Decimal = 82

5)
Binary = 10101100
  Hexadecimal = 0xAC
      = 10 * 16 + 12
      = 160 + 12
  Decimal = 172

6)
Binary = 11100111
  Hexadecimal = 0xE7
      = 14 * 16 + 7
      = 224 + 7
  Decimal = 231

7)
Hexadecimal = A7
  Binary = 10100111
      = 128+32+4+2+1
  Decimal = 167

8)
Hexadecimal = 3E
  Binary = 00111110
      = 2 + 4 + 8 + 16 + 32
  Decimal = 62

9)
Hexadecimal = BC
  Binary = 10111100
      = 4 + 8 + 16 + 32 + 128
  Decimal = 188

-------------------------------
Decimal    Binary    Hexadecimal
-------------------------------
    0    0000 0000       00
-------------------------------
   55    0001 0777       37
-------------------------------
  136    1000 1000       88
-------------------------------
  243    1111 0011       F3
-------------------------------
   82    0101 0010       52
-------------------------------
  172    1010 1100       AC
-------------------------------
  231    1110 0111       E7
-------------------------------
  167    1010 0111       A7
-------------------------------
   62    0011 1110       3E
-------------------------------
  188    1011 1100       BC
-------------------------------


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: