ProgrammingModerateTCS NQT · Infosys
What is the value of (uint64_t)1 << 40?
- A. 0
- B. 1099511627776
- C. 1048576
- 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
- uint64t computes 3 to the power 40 modulo 1000000007 with square-and-multiply, reducing after each multiplication. What is the result?
- uint32t x = 0x7FFFFFFFu; x = x 2u + 1u; What is x?
- For an unsigned integer x, which expression clears the lowest set bit of x?
- uint8t a = 0xF0, b = 0x3C; uint8t c = a & ~b; What is c?
- uint16t a = 3, b = 5; printf("%d", (a - b) > 0); prints what?
- uint32t p = 65536u 65536u; What is p?