ProgrammingVery hardTCS NQT · Infosys

uint8_t a = 0xF0, b = 0x3C; uint8_t c = a & ~b; What is c?

  1. A. 0x30
  2. B. 0xC0
  3. C. 0xF0
  4. D. 0x0C

Correct answer: B. 0xC0

~b promotes to int and ANDing with a keeps only the bits set in a but clear in b. Those bits are 1100 0000, which is 0xC0.

More C Programming questions

Exams that ask this topic