ProgrammingVery hardGATE CS · Campus placements
uint32_t p = 65536u * 65537u; What is p?
- A. 65536
- B. 4295032832
- C. 65537
- D. 0
Correct answer: A. 65536
65536 * 65537 = 2^32 + 65536, and the product wraps modulo 2^32 to 65536. The raw product 4295032832 cannot be stored in uint32_t.
More C Programming questions
- int a[] = {1, 2, 3, 4, 5}; int p = a; p += 3; printf("%d", p--); What is printed?
- int x = 10; int px = &x; px += px 2; What is x?
- What is ~0u / 2 + 1 for a 32-bit unsigned int?
- What does (unsigned int)(-1) % 10 evaluate to on a platform with a 32-bit unsigned int?
- How many ways are there to write 5 as an unordered sum of 1s and 2s?
- void rev(char s) { char e = s + strlen(s) - 1; while (s < e) { char t = s; s++ = e; e-- = t; } } After rev("abcde") runs on a writable…