ProgrammingModerateTCS NQT · Accenture
What is printed?
What is printed?
#include <stdio.h>
enum { A, B = 5, C };
int main(void) {
printf("%d %d", C, A + B);
}- A. 6 6
- B. 6 5
- C. 5 5
- D. 5 6
Correct answer: B. 6 5
Enumerators after B continue counting from its value, so C = 6. A is 0, so A + B = 5.
More C Programming questions
- What is printed? c #include <stdio.h> int main(void) { int i = 0, n = 0; while (i++, i < 5) n++; printf("%d", n); }
- What is printed? c #include <stdio.h> int main(void) { int i = 0, c = 0; do { i++; if (i % 2) continue; c++; } while (i < 6); printf("%d"…
- After sorting by squared distance from the origin, with ties broken by x ascending, what is printed? c #include <stdio.h> #include…
- How many integers x in 1..255 have exactly four set bits? Compute with this program. c #include <stdio.h> int main(void) { int c = 0; for…
- What is printed? c #include <stdio.h> int main(void) { unsigned x = 0xDEAD; int c = 0; unsigned t = x & 0xAAAA; while (t) { c += t & 1u; t…
- How many comparisons does bsearch-style binary search make to find the key 6 in the sorted array 0 to 9? Compute with the program. c…