(2.1) Convert:
(2.2) Fill in the blank entries in the following table, giving the decimal and hexadecimal representations of different powers of 2:
n | 2n (Decimal) | 2n (Hexadecimal) |
---|---|---|
9 | 512 | 0x200 |
19 | 524288 | 0x80000 |
14 | 16384 | 0x4000 |
16 | 65536 | 0x10000 |
17 | 131072 | 0x20000 |
5 | 32 | 0x20 |
7 | 128 | 0x80 |
(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 | 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) Without converting the number to decimal of binary, try to solve the following arithmetic problems, giving the answers in hexadecimal.
0x503c
+ 0x8
--------
0x5044
0x503c
- 0x40
--------
0x4ffc
0x503c
+ 64 (64 = 0x??)
--------
0x507c
0x50ea
+ 0x503c
--------
0x00ae
Give the missing decimal or binary representations of the following signed byte integers (type is char). Values are represented using two's complement. So the left most bit is the 'sign' bit.
The first two are provided as examples:
decimal | binary |
---|---|
7 | 0000 0111 |
-7 | 1111 1001 |
21 | 0001 0101 |
-21 | 11101011 |
42 | 0010 1010 |
-42 | 1101 0110 |