Preprocessors


  1. What is the output of this C code?
    #include <stdio.h>
    #define calc(n, m) n / m + n
    int main()
    {
    int a = -16, b = 13;
    printf("%d ", calc(a + b, 13));
    printf("%d\n", calc(-13, 13));
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    -18 -14


  1. What will be the output of the following C code?
    #include <stdio.h>
    void fun();
    int main()
    {
    #define max 15
    fun();
    return 0;
    }
    void fun()
    {
    printf("%d\n", max * 15);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    225



  1. What will be the output of the following C code?
    #include <stdio.h>
    void fun();
    int main()
    {
    #define calc(p, q) p / q + p
    fun();
    }
    void fun()
    {
    printf("%d\n", calc(-10, 10));
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    -11


  1. What will be the output of the following C code?
    #include <stdio.h>
    #define calc(p, q) p / q + p
    int main()
    {
    int a = -10, b = 5;
    printf("%d\n", calc(a + b, 5));
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    -14



  1. What will be the output of the following C code?
    #include <stdio.h>
    #define fun(p, q) #p #q
    int main()
    {
    printf("%s\n", fun(a, b));
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    ab