🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C Output Questions: all 10 questions

Quiz: C Output Questions · Question 10 of 10

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int i = 0, j = 0;
    if (i++ && j++) printf("yes ");
    printf("%d %d\n", i, j);
    return 0;
}
  1. A.yes 1 1
  2. B.1 1
  3. C.1 0
  4. D.0 0
Answer & explanation

Correct answer: 1 0

i++ gives 0 (false) and then makes i 1. Since the left side of && is false, j++ is skipped.

Can you get the rest right without peeking?

Take the timed Quiz: C Output Questions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →