Operators


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int p = 3, q = 2;
    int R = (q++) ? q == 1 && p : 1;
    printf("%d\n", R);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    0


  1. Which of the following is an invalid assignment operator?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    p /= 12; or p |= 12; and p %= 12; all are valid assignment operator.



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int p = 6, num, k, R = 0;
    scanf("%d", num);
    for (k = 0; k < num; k++)
    R += p;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    It will not print any output.


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    4 1



  1. What will be the final value of c in the following s statement? (Initial value: s = 2)
    s <<= 1;











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    s = 4;