Home / C Programming / C Preprocessor :: C Preprocessor MCQs

C Programming :: C Preprocessor

  1. What will be output after executing following code?

    #include

    # define a 10

    void main()

    {

    printf("%d..", a);

    foo();

    printf("%d", a);

    }

    void foo()

    {

    #undef a

    #define a 50

    }

  2. A.

     10..50

    B.

     10..10

    C.

     0

    D.

     Error

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. The output of the following program is:

    #define f(g,g2) g##g2

    void main()

    {

    int var12=100;

    printf("%d", f(var,12));

    }

  4. A.

     Syntax error

    B.

     Runtime error

    C.

     g##g2

    D.

     100

    E.

     10012

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Find the output of the following program.

    #define INC(X) X++

    void main()

    {

    int x=4;

    printf("%d", INC(x++));

    }

  6. A.

     4

    B.

     5

    C.

     6

    D.

     Error

    View Answer

    Workspace

    Discuss Discuss in Forum