Operators


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    3, 2


  1. What is the difference between the following 2 codes?
    //Program 1
    #include <stdio.h>
    int main()
    {
    int n3, n1 = 2, n2 = 3;
    n3 = n1++ + ++n2;
    printf("%d %d %d", n3, n1, n2);
    }

    //Program 2
    #include <stdio.h>
    int main()
    {
    int n3, n1 = 2, n2 = 3;
    n3 = n1++ + +++n2;
    printf("%d %d %d", n3, n1, n2);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Program 2 has syntax error, program 1 is not



  1. Relational operators cannot be used on ____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    structure


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int num = 12;
    if (num == num--)
    printf("TRUE 1\t");
    num = 10;
    if (num == --num)
    printf("TRUE 2\t");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    This is a sequence point problem and hence the result will be implementation dependent.



  1. Which among the following is NOT a logical or relational operator?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    =