Binary Numbers Quiz

Answers

  1. If you must use exactly 4 bits (binary digits), how many different patterns can you form? How might these patterns be used to represent numbers? Which numbers could they represent?
  2. 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:

    • The first 16 odd or even numbers
    • The first 16 prime numbers
    • The first 16 numbers in the Fibonacci Series
    • ...
    • Up to ANY 16 numbers (or distinct "items") that are required to be enumerated

  3. What is the significance of the following numbers?

    1. 255

      largest natural number that can be represented in 8 bits = 28 - 1

    2. 65535

      largest natural number that can be represented in 16 bits = 216 - 1

    3. 1048575

      largest natural number that can be represented in 20 bits = 220 - 1

    4. 4294967295

      largest natural number that can be represented in 32 bits = 232 - 1

  4. Convert the following binary numbers to decimal:

    1. 0110

      0 × 23 + 1 × 22 + 1 × 21 + 0 × 20

      4 + 2 = 610

    2. 1011

      1 × 23 + 0 × 22 + 1 × 21 + 1 × 20

      8 + 2 + 1 = 1110

    3. 11110000

      1 × 27 + 1 × 26 + 1 × 25 + 1 × 24 + 0 × 23 + 0 × 22 + 0 × 21 + 0 × 20

      128 + 64 + 32 + 16 = 24010

    4. 10101010

      1 × 27 + 0 × 26 + 1 × 25 + 0 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 0 × 20

      128 + 32 + 8 + 2 = 17010

  5. Convert the following binary numbers to hexadecimal:

    1. 1110

      11102 = E16

    2. 11011

      1 10112 = 1B16

    3. 110110101

      1 1011 01012 = 1B516

    4. 1010111101110010

      1010 1111 0111 00102 = AF7216

  6. Convert the following decimal numbers to binary and hexadecimal:

    1. 12

      8 + 4 = 1 × 23 + 1 × 22 + 0 × 21 + 0 × 20

      11002 = C16

    2. 15

      8 + 4 + 2 + 1 = 1 × 23 + 1 × 22 + 1 × 21 + 1 × 20

      11112 = F16

    3. 27

      16 + 8 + 2 + 1 = 1 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20

      110112 = 1B16

    4. 96

      64 + 32 = 1 × 26 + 1 × 25 + 0 × 24 + 0 × 23 + 0 × 22 + 0 × 21 + 0 × 20

      11000002 = 6016

  7. Perform the following unsigned binary additions:

    1. 1 + 1

      1 + 1 = 10 (check: 1 + 1 = 2)

    2. 1010 + 1111

      1010 + 1111 = 11001 (check: 10 + 15 = 25)

    3. 110111 + 11001

      110111 + 11001 = 1010000 (check: 55 + 25 = 80)

  8. If a program variable is to be used to store a unique number identifying any day in the year, how many bits will be required to store it?

    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.

  9. Multiply 0111 by 0011 (binary)

    0111 × 0011 = 10101 (check: 7 × 3 = 21)


[ Index ]

last updated: 26-Oct-06 Ian Harries <ih@doc.ic.ac.uk>