← Quiz: Files and Preprocessor: all 10 questions
Quiz: Files and Preprocessor · Question 9 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
#define DEBUG 1
int main(void) {
#if DEBUG
printf("on ");
#else
printf("off ");
#endif
printf("done\n");
return 0;
}
- A.off done
- B.on done
- C.on off done
- D.done
Answer & explanation
Correct answer: on done
The preprocessor keeps only the #if branch because DEBUG is 1; the #else part never reaches the compiler.
Can you get the rest right without peeking?
Take the timed Quiz: Files and Preprocessor quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →