Which of the following operators can be used if a portion of a given bit…

2017

Which of the following operators can be used if a portion of a given bit pattern needs to be copied to a new word, while the remainder of the new word is filled with 0s?

Answer: B. Bitwise ANDThe correct option is B (Bitwise AND). To copy a portion of a bit pattern and clear the rest, we use a bitwise AND operation with a mask. Performing AND with…

  1. A.

    Logical AND

  2. B.

    Bitwise AND

  3. C.

    Bitwise OR

  4. D.

    Bitwise XOR

Attempted by 425 students.

Show answer & explanation

Correct answer: B

The correct option is B (Bitwise AND). To copy a portion of a bit pattern and clear the rest, we use a bitwise AND operation with a mask. Performing AND with 1 retains the original bit (X AND 1 = X), while AND with 0 forces the bits to 0 (X AND 0 = 0).

Explore the full course: Coal India Management Trainee

Loading lesson…