← Quiz: C Control Flow: all 10 questions
Quiz: C Control Flow · Question 1 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int x = 2;
switch (x) {
case 1: printf("A");
case 2: printf("B");
case 3: printf("C");
default: printf("D");
}
return 0;
}
- A.B
- B.BC
- C.BCD
- D.ABCD
Answer & explanation
Correct answer: BCD
No breaks: execution starts at case 2 and falls through to the end.
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 →