Preprocessors


  1. What will be the output of the following C code?
     #include <stdio.h>
    #define Winter
    int main()
    {
    #ifdef Winter
    printf("Winter\t");
    #undef Winter
    #endif
    #ifdef Winter
    printf("Summer\t");
    #endif
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Winter


  1. The “else if” in conditional inclusion is written by?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    #elif



  1. What will be the output of the following C code?
    #include <stdio.h>
    #define Cprogram
    int main()
    {
    int p = 21;
    #ifdef Cprogram
    p = 11;
    printf("%d", Cprogram);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Compilation Error

    main.c: In function ‘main’:
    main.c:8:30: error: expected expression before ‘)’ token
    printf("%d", Cprogram);
    ^
    main.c: At top level:
    main.c:6:0: error: unterminated #ifdef
    #ifdef Cprogram


  1. What will be the output of the following C code?
    #include <stdio.h>
    #define system 25
    int main()
    {
    int n = 25;
    #if system == n
    printf("Interview ");
    #endif
    #if system == 25
    printf("Mania\n");
    #endif
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Mania



  1. What will be the output of the following C code?
    #include <stdio.h>
    #define MINIMUM 21);
    #ifdef MINIMUM
    #define MAXIMUM 210
    #endif
    int main()
    {
    printf("%d %d\n", MAXIMUM, MINIMUM
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    210 21