ProgrammingHardTCS NQT · Infosys
int x = 5, y = 3; What does printf("%d", x & y | 4 ^ 1) print?
- A. 1
- B. 4
- C. 5
- D. 6
Correct answer: C. 5
& binds tighter than ^, which binds tighter than |. So the expression is (5 & 3) | (4 ^ 1) = 1 | 5 = 5.
More C Programming questions
- unsigned int n = 3u; int k = -1; if (k > n) printf("yes"); else printf("no"); What is printed?
- Which type reliably holds the sum 1 + 2 + ... + 100000 = 5000050000?
- What is (uint32t)~0u >> 28?
- int g[2][3] = {1, 2, 3, 4}; What is g[1][1] + g[0][2]?
- uint8t a = 200; a = a + a; What is a?
- Which statement about pointer relations in C is well defined?