ProgrammingHardTCS NQT · Wipro

What is printed?

What is printed?
#include <stdio.h>
int main(void) {
    unsigned x = 0x0F;
    x |= 0x40;
    x &= ~1u;
    printf("%u", x);
}
  1. A. 79
  2. B. 78
  3. C. 15
  4. D. 64

Correct answer: B. 78

Setting bit 6 gives 0x4F = 79, and clearing bit 0 gives 0x4E = 78.

More C Programming questions

Exams that ask this topic