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

Quiz: C Control Flow · Question 3 of 10

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int x = 0;
    if (x = 0) printf("yes");
    else printf("no");
    return 0;
}
  1. A.yes
  2. B.no
  3. C.Compile error
  4. D.0
Answer & explanation

Correct answer: no

x = 0 assigns 0, and 0 is false, so the else branch runs.

Can you get the rest right without peeking?

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

Start the quiz →