ProgrammingModerateTCS NQT · Infosys
unsigned char c = 0x80; c >>= 1; printf("%d", c); What is printed?
- A. 128
- B. 0
- C. 32
- D. 64
Correct answer: D. 64
0x80 shifted right by one is 0x40, which is 64. The value is promoted to int before the shift but fits unsigned char afterward.
More C Programming questions
- uint64t big = (uint64t)0xFFFFFFFF 2; What is big?
- enum { A, B = 5, C }; What is the value of C?
- How many integers from 1 to 100 are divisible by 3 or by 5?
- How many two-digit decimal numbers have digits summing to 9?
- The sorted array is {1, 3, 5, 7, 7, 9}. What is the index of the first element greater than 7?
- int n = 0; reading the expression as C does: What is the value of ~5 + 1?