ProgrammingVery hardTCS NQT · Infosys

uint16_t a = 300, b = 300; uint16_t p = a * b; What is p?

  1. A. 90000
  2. B. 24464
  3. C. 25536
  4. D. 0

Correct answer: B. 24464

The product 90000 is computed in int and then reduced modulo 65536, giving 24464. This is a common hidden overflow in 16-bit storage.

More C Programming questions

Exams that ask this topic