ProgrammingModerateTCS NQT · Wipro
What is printed?
What is printed?
#include <stdio.h>
int main(void) {
printf("%u", 1u << 31 >> 30);
}- A. 2
- B. 0
- C. 4
- D. 1
Correct answer: A. 2
Shifts associate left to right, so (1u << 31) >> 30 = 2^31 / 2^30 = 2.
More C Programming questions
- What is printed? c #include <stdio.h> int main(void) { char w[] = {"ab", "cd", "ef"}; char p = w + 2; printf("%c%c", (p)[0], p[-1][1]); }
- What is printed? c #include <stdio.h> int main(void) { unsigned v = 0x01020304u, total = 0; for (int i = 0; i < 4; i++) { unsigned b = (v…
- What is printed? Compute the XOR of all integers from 1 to 1000 with this program. c #include <stdio.h> int main(void) { unsigned x = 0…
- How many monotone lattice paths go from the top-left corner to the bottom-right corner of a 4 by 4 grid of cells (moves only right or…
- How many iterations does this loop run? c #include <stdio.h> int main(void) { int c = 0; for (int i = 10; i >= 0; i -= 3) c++…
- What is printed? c #include <stdio.h> int main(void) { printf("%d", (int)'x41' + '101'); }