- Convert 42 from decimal to binary
42=101010
- Convert 11011 from binary to decimal
11011=27
- Add the following binary numbers: 11010 + 101111
11010 + 101111 = 1001001
- Convert -6 from decimal to 4-bit 2's complement
-6 = 1010
Common mistakes on the 2's complement inversion:
- n-bit 2's complement numbers must have exactly n bits (perhaps with leading 0s)
- "flip the bits" means replace 0s with 1s and 1s with 0s in each bit position
- Remember to add 1 after flipping the bits