ProgrammingHardProduct company OA

What is printed?

What is printed?
printf("%#x %#o %x", 255, 8, -1 & 0xFF);
  1. A. 0xff 0o10 ff
  2. B. ff 10 ff
  3. C. 0xff 010 ff
  4. D. 0xff 010 ffffffff

Correct answer: C. 0xff 010 ff

The # flag adds the base prefix: 0x for hex and a leading 0 for octal (8 is 10 in octal, shown as 010). -1 & 0xFF keeps the low 8 bits, 255, printed as ff. '0o' is Python's octal prefix, not C's.

More C Programming questions

Exams that ask this topic