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?
- What is the decimal value of 0b1000?
- What is 255 in hexadecimal?
- What is 0xA in binary?
- What are the minimum numbers of bits needed to store the number 8?
- What does 0b01 + 0b10 equal?
- What is 0x01 AND 0x02? 0x01 OR 0x2? 0x01 EOR (XOR) 0x02?
- What is the value of 0x01 bitwise shifted left by 2?
- 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.