ProgrammingModerateTCS NQT · Infosys
unsigned int n = 1u; unsigned int r = n << 31; What is r?
- A. 2147483648
- B. 0
- C. 1
- D. 4294967296
Correct answer: A. 2147483648
The shift count 31 is less than the 32-bit width, so the shift is defined and sets bit 31, which is 2147483648.
More C Programming questions
- int a = -7, b = 2; What is a / b b + a % b?
- int m[2][2] = {{1, 2}, {3, 4}}; int (r)[2] = m; What is r[1][0] + (r[0] + 1)?
- uint32t n = 100000u; uint32t t = n (n + 1) / 2; What is t?
- int x = 0; for (int i = 0; i < 5; i++) x = x ^ i << 1; What is x at the end?
- uint16t a = 300, b = 300; uint16t p = a b; What is p?
- What does printf("%d", strcmp("apple", "Apple") > 0) print?