Multiple choice

If one wants to retain certain bits and set the rest from a given bit pattern, the correct masking operation is

  1. OR

  2. AND

  3. Exclusive OR

  4. Complementation

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To retain specific bits (masking) and set others, the OR operator is used. A bitwise OR with 1 sets a bit, while OR with 0 leaves it unchanged.