ProgrammingHardTCS NQT · Infosys
uint8_t a = 200; a = a + a; What is a?
- A. 400
- B. 144
- C. 0
- D. 200
Correct answer: B. 144
a + a is 400 in int, and storing it in uint8_t gives 400 mod 256 = 144.
More C Programming questions
- Which statement about pointer relations in C is well defined?
- How many subsets of {0, 1, 2, 3, 4, 5} contain exactly three elements?
- #define DOUBLE(x) (x + x). What does printf("%d", DOUBLE(2) 3) print?
- uint8t x = 0x90; uint8t y = x & (uint8t)(x - 1); What is y?
- int f(int n) { if (n == 0) return 0; return n % 2 + f(n / 2); } What is f(37)?
- For unsigned int i = 3; i >= 0; i--, what happens to the loop body?