ProgrammingVery hardProduct company OA
What is printed?
What is printed?
printf("%zu", sizeof("\1234"));- A. 2
- B. 5
- C. 3
- D. 6
Correct answer: C. 3
An octal escape takes at most three octal digits, so \123 is one character ('S' in ASCII) and the 4 that follows is a separate character. Two characters plus '\0' make 3 bytes. '2' reads all four digits as one escape.
More C Programming questions
- What is printed? c int a[8] = {0}; for (int i = 1; i < 8; i++) a[i] = a[i / 2] + (i % 2); printf("%d %d %d", a[5], a[6], a[7]);
- What is printed? c int a[] = {2, 1, 3, 2, 4, 1}, best = 0, s = 0, lo = 0; for (int hi = 0; hi < 6; hi++) { s += a[hi]; while (s > 6) s -=…
- What is wrong with this code? c char p = malloc(10); p++; free(p);
- What is printed? c int x = 5; #define x (x + 1) printf("%d", x);
- What is printed? c int c = 0; for (int i = 1; i <= 16; i = 2) for (int j = 0; j < i; j++) c++; printf("%d", c);
- What is printed? c int i, c = 0; for (i = 0; i < 10; i += i + 1) c++; printf("%d %d", c, i);