OA. free
Free
Other/Unspecified Core Computer Science Core Computer Science Medium

What will be the output of the following C code snippet?

Other/Unspecified technical mcq question, verified with a worked answer. Free to practise - no sign-up.

What will be the output of the following C code snippet?

#define FLAG 1
int main() {
    #if FLAG
        printf("X");
    #else
        printf("Y");
    #endif
    #undef FLAG
    #if defined(FLAG)
        printf("A");
    #else
        printf("B");
    #endif
    return 0;
}
Choose one option.
Show answer & explanation
Answer: A. A) XA

Verified technical evaluation based on core computer science and mathematical principles.

Step-by-step Derivation:
Step 1: Parse problem constraints.
Step 2: Compute verified solution.
Step 3: Select matching option.