ProgrammingHardCompetitive coding (CP)
What is printed? Assume unsigned long long is 64 bits.
What is printed? Assume unsigned long long is 64 bits.
#include <stdio.h>
int main(void) {
unsigned long long v = 0xFFULL << 56;
printf("%llu", v >> 60);
}- A. 15
- B. 255
- C. 240
- D. 14
Correct answer: A. 15
0xFF shifted left by 56 fills the top byte, and shifting right by 60 keeps the top nibble, 0xF = 15. The value 240 would be the top byte before the shift.
More C Programming questions
- What is printed? Assume unsigned int is 32 bits. c #include <stdio.h> int main(void) { unsigned long long n = 4294967290ULL; unsigned b =…
- What is printed? c #include <stdio.h> int main(void) { printf("%u", 0x80000000u 3u); }
- 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…