ProgrammingModerateTCS NQT · Infosys

What is the value of (uint64_t)1 << 40?

  1. A. 0
  2. B. 1099511627776
  3. C. 1048576
  4. D. 256

Correct answer: B. 1099511627776

Casting to uint64_t before shifting keeps the bit. 2^40 = 1099511627776. Shifting a plain int by 40 would be undefined because the shift count exceeds its width.

More C Programming questions

Exams that ask this topic