ProgrammingHardTCS NQT · Infosys
uint8_t sum = (uint8_t)(200 + 100); if (sum < 50) printf("yes"); else printf("no"); What is printed?
- A. no
- B. yes
- C. compile error
- D. undefined
Correct answer: B. yes
200 + 100 is 300, and converting to uint8_t gives 44. Since 44 is less than 50, the program prints yes.
More C Programming questions
- char msg[] = "abc"; printf("%c", msg[msg[0] - 'a' + 1]); What is printed?
- for (int i = 0; i < 10; i++) for (int j = 1; j < 10; j = 2) count++; How many times does count increase?
- What does printf("%d %d", 17 / 5, 17 % 5) print?
- int x = 0; if (x = 5) printf("y"); else printf("n"); What is printed?
- Which expression clears the lowest three bits of an unsigned char x?
- uint32t x = 0u; x -= 1; x = x / 2 + 1; What is x?