Skip to content

Latest commit

 

History

History
120 lines (63 loc) · 2.47 KB

Chapter-2.md

File metadata and controls

120 lines (63 loc) · 2.47 KB

2.1

####Question:

Perform the following number conversions:

A. 0x39A7F8 to binary

B. binary 1100100101111011 to hexadecimal

C. 0xD5E4C to binary

D. binary 1001101110011110110101 to hexadecimal

Answer

A.

Hexadecimal 3 9 A 7 F 8

Binary 0011 1001 1010 0111 1111 1000

B.

Binary 1100 1001 0111 1011

Hexadecimal C 9 7 B

C.

Hexadecimal D 5 E 4 C

Binary 1101 0101 1110 0100 1100

D.

Binary 10 0110 1110 0111 1011 0101

Hexadecimal 2 6 E 7 B 5

2.2

Question

Fill in the blank entries in the following table, giving the decimal and hexadecimal representations of different powers of 2:

Answer

314,15 314,156=19,634 .16+12 (C)

19,634 =1,227.16+2 (2)

1,227 =76.16+11 (B)

76=4.16+12 (C)

4=0.16+4 (4)

From this we can read off the hexadecimal representation as Ox4CB2C.

n $$ 2^n(decimal) $$ $$ 2^n(hexadecimal) $$
9 512 0x200
19 524288 0x80000
14 16384 0x4000
16 65536 0x10000
17 131072 0x20000
5 32 0x20
7 128 0x80

2.3

Question

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

Answer

Decimal Binary Hexadecimal
0 0000 0000 0x00
167 1010 0111 0xA7
62 0011 1110 0x3E
188 1011 1100 0xBC
55 0011 0111 0x37
136 1000 1000 0x88
243 1111 0011 0xF3
82 0101 0010 0x52
172 1010 1100 0xAC
231 1110 0111 0xE7

2.4

Question

Without converting the numbers to decimal or binary, try to solve the following arithmetic problems, giving the answers in hexadecimal. Hint: Just modify the methods you use for performing decimal addition and subtraction to use base 16.

Answer

A. 0x503c + 0x8 = 0x5044

B. 0x503c - 0x40 = 0x4ffc

C. 0x503c + 64 = 0x507c

D. 0x50ea - 0x503c = 0xad