ProgrammingHardTCS NQT · Infosys
uint8_t a = 16; a = a * a; What is a?
- A. 0
- B. 256
- C. 16
- D. 32
Correct answer: A. 0
16 * 16 is 256 in int, and converting 256 to uint8_t gives 0. The product is never stored in full in an 8-bit variable.
More C Programming questions
- uint32t t = 2000000000u + 2000000000u; What is t?
- char buf[10]; char a = buf + 2, b = buf + 9; What does printf("%td", b - a) print?
- struct P { int x, y; } arr[4]; struct P p = arr; p += 2; What is p - arr?
- #define MIN(a,b) ((a)<(b)?(a):(b)). What does printf("%d", MIN(MIN(3,1),2)) print?
- int x = 5; printf("%d", x > 3 ? x - 3 : x + 3); What is printed?
- What does printf("%d", (4, 5) 2) print?