ProgrammingHardTCS NQT · Accenture
What is printed? Assume uint8t is 8 bits.
What is printed? Assume uint8_t is 8 bits.
#include <stdint.h>
#include <stdio.h>
int main(void) {
uint8_t a = 5, b = 10;
uint8_t d = a - b;
printf("%d", d);
}- A. 251
- B. 250
- C. 5
- D. 255
Correct answer: A. 251
a - b is -5 as an int, and converting it to uint8_t gives 256 - 5 = 251.
More C Programming questions
- Seven people stand in a circle and every third person is removed until one is left. The recursion J(n, k) gives the 1-based survivor…
- What is printed? c #include <stdio.h> int main(void) { int a[] = {1, 2, 3, 4, 5, 6}, best = 0; for (int i = 0; i + 3 <= 6; i++) { int s =…
- What is printed? c #include <stdio.h> int main(void) { printf("%d", (-17 / 5) 5 + (-17 % 5) == -17); }
- How many leading zero bits does the 16-bit value 0x0123 have? Count them with this program. c #include <stdint.h> #include <stdio.h> int…
- What is printed? c #include <stdio.h> #include <stdlib.h> int cmp(const void a, const void b) { return atoi((const char const )a)…
- What is printed? c #include <stdio.h> #include <stdlib.h> int cmp(const void a, const void b) { const int x = a, y = b; if (x[0] != y[0])…