CPSC120A
Fundamentals of Computer Science I

Activity 20

Exploring how computers represent and store data with binary numbers.

Binary

We have discussed how to convert a binary number to a decimal number. This is useful for understanding a number given to you in binary. However, converting from a decimal number to binary is just as important. In this activity you will practice converting numbers from decimal to binary.


  1. What is the binary number 0.1011 × 1010 in decimal?

  2. Which of the following can be represented exactly using a Python float value?

    1. 1 / 3

    2. 1 / 4

    3. π

    4. 1234567890.0

    5. 12345678901234567890.0

  3. What is the decimal equivalent of the hexadecimal number 11A?

  4. What is the decimal equivalent of the hexadecimal number BEEF?

  5. What is the binary equivalent of the decimal number 24? Use as few bits as possible in your answer.

  6. What is the binary equivalent of the decimal number 512? Use as few bits as possible in your answer.

  7. What is the binary equivalent of the decimal number 7? Use as few bits as possible in your answer.

  8. What is the binary equivalent of the decimal number -7? Use as few bits as possible in your answer.