Operators


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n = -7;
    if (!0 == 1)
    printf("Yes\n");
    else
    printf("No\n");
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Yes


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int num = 0;
    if (num = 0)
    {
    printf("It's zero\n");
    }
    else
    {
    printf("It's not zero\n");
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    It's not zero



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Compilation Error

    main.c: In function ‘main’:
    main.c:5:25: error: lvalue required as increment operand
    int q = (p % 10)++;


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int n = 12;
    int num = 2 == 3 && n++;
    printf("%d %d", num, n);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    0 12



  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int num1 = 7, num2 = -9, num3 = 3, num4;
    num4 = ++num1 && ++num2 || ++num3;
    printf("%d %d %d %d", num1, num2, num3, num4);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    8 -8 3 1