ProgrammingHardTCS NQT · Infosys

uint8_t a = 16; a = a * a; What is a?

  1. A. 0
  2. B. 256
  3. C. 16
  4. D. 32

Correct answer: A. 0

16 * 16 is 256 in int, and converting 256 to uint8_t gives 0. The product is never stored in full in an 8-bit variable.

More C Programming questions

Exams that ask this topic