Recall & Review
beginner
What are bitwise operations?
Bitwise operations are actions that work directly on the bits of numbers, like turning bits on or off, shifting them left or right.
Click to reveal answer
beginner
Why do we use bitwise operations in programming?
We use bitwise operations to work fast with data at the smallest level, save memory, and control hardware or flags efficiently.
Click to reveal answer
intermediate
How do bitwise operations help in setting or clearing flags?
Bitwise operations let us turn specific bits on or off without changing other bits, like flipping switches for different options.Click to reveal answer
intermediate
Give an example of a real-life situation where bitwise operations are useful.
In controlling devices like lights or sensors, each bit can represent a device state (on/off), so bitwise operations help manage them quickly.
Click to reveal answer
intermediate
What is the advantage of using bitwise operations over normal arithmetic for some tasks?
Bitwise operations are faster and use less memory because they work directly on bits, making them ideal for low-level programming.
Click to reveal answer
What does a bitwise AND operation do?
✗ Incorrect
Bitwise AND returns 1 only when both bits are 1, otherwise 0.
Why are bitwise operations important in embedded systems?
✗ Incorrect
Bitwise operations allow direct control of hardware bits, which is essential in embedded systems.
Which bitwise operation is used to turn off a specific bit?
✗ Incorrect
Bitwise AND with a mask that has 0 at the bit to clear turns that bit off.
What does shifting bits to the left do?
✗ Incorrect
Shifting bits left by one position multiplies the number by 2.
Which is NOT a reason to use bitwise operations?
✗ Incorrect
Bitwise operations often make code harder to read, but they save memory and improve speed.
Explain why bitwise operations are useful when working with flags or settings in a program.
Think about how switches work in real life.
You got /3 concepts.
Describe a situation where bitwise operations can make a program faster or use less memory.
Consider embedded devices or games.
You got /3 concepts.