ProgrammingHardCompetitive coding (CP)
What is printed?
What is printed?
#include <stdio.h>
int main(void) {
printf("%u", 0x80000000u * 3u);
}- A. 6442450944
- B. 0
- C. 2147483648
- D. 1073741824
Correct answer: C. 2147483648
0x80000000 * 3 = 0x180000000, and reducing modulo 2^32 leaves 0x80000000 = 2147483648.
More C Programming questions
- What is printed by sizeof? c #include <stdio.h> int main(void) { char t[] = "a0b0c"; printf("%zu", sizeof t); }
- What is printed? c #include <stdio.h> int main(void) { int a[] = {10, 20, 30}; int p[] = {a, a + 1}; printf("%d", p[1] + (p + 2)); }
- What is printed? c #include <stdio.h> int main(void) { printf("%d", 1 << 30 >> 28); }
- What is printed? A sorted int array {1, 3, 5, 7} is searched with bsearch for the key 6. c #include <stdio.h> #include <stdlib.h> int…
- How many subsets of {1, 2, 3, 4, 5} sum to exactly 10? Compute with this program. c #include <stdio.h> int main(void) { int c = 0; for…
- What is printed? c #include <stdio.h> #include <stdlib.h> int cmp(const void a, const void b) { int x = (const int )a, y = (const int )b…