P is a 16-bit signed integer. The 2's complement representation of P is…
2024
P is a 16-bit signed integer. The 2's complement representation of P is (F87B)₁₆. The 2's complement representation of 8*P is
- A.
(C3D8)₁₆
- B.
(187B)₁₆
- C.
(F87B)₁₆
- D.
(987B)₁₆
Attempted by 31 students.
Show answer & explanation
Correct answer: A
In binary arithmetic, multiplying a signed integer by 8 (which is 23) is exactly equivalent to shifting the bits to the left by 3 positions (<< 3).
Convert P from Hexadecimal to Binary:
P = (F87B)16
F = 1111
8 = 1000
7 = 0111
B = 1011
P = (1111 1000 0111 1011)2
Shift Left by 3 Bits (P X 23):
When shifting a 16-bit number left by 3 bits, the 3 leftmost bits drop off, and 3 zeros are introduced on the right side:
Original:
1111 1000 0111 1011Shifted:
1100 0011 1101 1000
Convert back to Hexadecimal:
Group the resulting binary string into sets of 4 bits from left to right:
1100 = C
0011 = 3
1101 = D
1000 = 8
Result = (C3D8)16