Computer AwarenessVery hardIBPS SO IT Officer

A program must clear the lowest 4 bits of a byte to 0 while keeping the upper 4 bits unchanged. With which mask, written in hexadecimal, should the byte be ANDed?

  1. A. 0F
  2. B. FF
  3. C. 00
  4. D. F0

Correct answer: D. F0

AND with 1 keeps a bit and AND with 0 clears it, so the mask is 1111 0000 = F0. ANDing with 0F would keep the low bits and clear the high ones instead.

हिंदी में

एक प्रोग्राम को बाइट के निचले 4 बिट 0 करने हैं और ऊपरी 4 बिट अपरिवर्तित रखने हैं। हेक्साडेसिमल में लिखे किस मास्क से बाइट का AND लेना चाहिए?

  1. A. 0F
  2. B. FF
  3. C. 00
  4. D. F0

उत्तर: D. 1 से AND बिट को रखता है और 0 से AND उसे मिटाता है, इसलिए मास्क 1111 0000 = F0 है। 0F से AND निचले बिट रखता और ऊपरी मिटा देता।

More Computer Awareness questions

Exams that ask this topic