Binary and Hexadecimal Numbers

Everyone is familiar with decimal numbers. However, computers use binary and hexadecimal representations of numbers. We also need to learn how to deal with bits, and bitwise operators.

Do you know the answers to the following questions?

  1. What is the decimal value of 0b1000?
  2. What is 255 in hexadecimal?
  3. What is 0xA in binary?
  4. What are the minimum numbers of bits needed to store the number 8?
  5. What does 0b01 + 0b10 equal?
  6. What is 0x01 AND 0x02? 0x01 OR 0x2? 0x01 EOR (XOR) 0x02?
  7. What is the value of 0x01 bitwise shifted left by 2?
  8. Suppose you are given a number x. How would you return a new number y which is equal to x but with its least significant bit equal to 0?

If you don’t know the answers to these questions, we recommend that you review the following material.