Binary Numbers Quiz
Answers
24 = 16, so there are 16 distinct patterns that can be formed.
Various representations, from notes: Sign & Magnitude, One's Complement, Two's Complement, Excess-n, Binary-Coded Decimal (BCD). Plus whatever other wacky schemes you can come up with...
Ultimately, the 16 bitpatterns could represent ANY 16 values desired:
largest natural number that can be represented in 8 bits = 28 - 1
largest natural number that can be represented in 16 bits = 216 - 1
largest natural number that can be represented in 20 bits = 220 - 1
largest natural number that can be represented in 32 bits = 232 - 1
0 × 23 + 1 × 22 + 1 × 21 + 0 × 20
4 + 2 = 610
1 × 23 + 0 × 22 + 1 × 21 + 1 × 20
8 + 2 + 1 = 1110
1 × 27 + 1 × 26 + 1 × 25 + 1 × 24 + 0 × 23 + 0 × 22 + 0 × 21 + 0 × 20
128 + 64 + 32 + 16 = 24010
1 × 27 + 0 × 26 + 1 × 25 + 0 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 0 × 20
128 + 32 + 8 + 2 = 17010
11102 = E16
1 10112 = 1B16
1 1011 01012 = 1B516
1010 1111 0111 00102 = AF7216
8 + 4 = 1 × 23 + 1 × 22 + 0 × 21 + 0 × 20
11002 = C16
8 + 4 + 2 + 1 = 1 × 23 + 1 × 22 + 1 × 21 + 1 × 20
11112 = F16
16 + 8 + 2 + 1 = 1 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20
110112 = 1B16
64 + 32 = 1 × 26 + 1 × 25 + 0 × 24 + 0 × 23 + 0 × 22 + 0 × 21 + 0 × 20
11000002 = 6016
1 + 1 = 10 (check: 1 + 1 = 2)
1010 + 1111 = 11001 (check: 10 + 15 = 25)
110111 + 11001 = 1010000 (check: 55 + 25 = 80)
28 < 365 < 29 so 9 bits are required
How many bits to store the year?
Careful - This is how the "Millenium Bug" got started! You need to store millenium and century as well as decade and year, so four decimal digits are required (however you choose to represent them). That will work okay for nearly the next eight thousand years.
0111 × 0011 = 10101 (check: 7 × 3 = 21)
last updated: 26-Oct-06 Ian Harries <ih@doc.ic.ac.uk>