Operators


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n1 = 5, n2 = 0, n3 = 7;
    n1 > n2 ? printf("%d", n3) : return n3;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Compilation Error

    main.c: In function ‘main’:
    main.c:5:38: error: expected expression before ‘return’
    n1 > n2 ? printf("%d", n3) : return n3;
    ^~~~~~


  1. What will be the output of the following C code?
     #include <stdio.h>
    void main()
    {
    int num1 = 2, num2 = 0, num3 = 6;
    int Res = num1 && num2 && num3++;
    printf("%d", num3);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    6



  1. What will be the output of the following C code?
     #include <stdio.h>
    void main()
    {
    int var1 = 2, var2 = 0, var3 = 6;
    int R = var1 && var2 || var3++;
    printf("%d", var3);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    7


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int p = 20, q = 10, r = 10;
    int s;
    s = p == (q + r);
    printf("%d", s);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    1



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int var1 = 16;
    double var2 = 3.26;
    int var3;
    var3 = var1 + var2;
    printf("%d", var3);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    19