ProgrammingEasyTCS NQT · Infosys pattern
What is printed?
What is printed?
int i;
for (i = 0; i < 10; i += 3)
printf("%d ", i);- A. 0 3 6 9
- B. 0 3 6 9 12
- C. 0 3 6
- D. 3 6 9
Correct answer: A. 0 3 6 9
i takes 0, 3, 6, 9; the next value 12 fails i < 10, so the loop stops after printing 9. Four iterations in all.
More C Programming questions
- What is printed? c int x = 10; int p = &x; int q = &p; q = 20; printf("%d", x);
- What is printed? c char s[20] = "Code"; strcat(s, "Hub"); printf("%zu", strlen(s));
- What is printed on a two's-complement machine? c printf("%d", ~5);
- What is printed by a C99 (or later) compiler? c printf("%d %d", -7 / 2, -7 % 2);
- What is printed? c char s = "Campus"; printf("%c%s", (s + 1), s + 4);
- What is printed? c printf("%d", printf("hello"));