Home / C Programming / Operators and Expressions :: Operators and Expressions

C Programming :: Operators and Expressions

  1. What will be the output?

    void main(){

    int a=10, b=20;

    char x=1, y=0;

    if(a,b,x,y){

    printf("EXAM");

    }

    }

  2. A.

     XAM is printed

    B.

     exam is printed

    C.

     Compiler Error

    D.

     Nothing is printed

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What number will z in the sample code given below?

    int z, x=5, y= -10, a=4, b=2;

    z = x++ - --y*b/a;

  4. A.

     5

    B.

     6

    C.

     9

    D.

     10

    E.

     11

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of the following statements?

    int i = 0;

    printf("%d %d", i, i++);

  6. A.

     0 1

    B.

     1 0

    C.

     0 0

    D.

     1 1

    E.

     None of these

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the output of the following statements?

    int b=15, c=5, d=8, e=8, a;

    a = b>c ? c>d ? 12 : d>e ? 13 : 14 : 15;

    printf("%d", a);

  8. A.

     13

    B.

     14

    C.

     15

    D.

     12

    E.

     Garbage Value

    View Answer

    Workspace

    Discuss Discuss in Forum


  • What will be the output of the following code fragment?

    void main()

    {

    printf("%x",-1<<4);

    }

  • A.

     fff0

    B.

     fff1

    C.

     fff2

    D.

     fff3

    E.

     fff4

    View Answer

    Workspace

    Discuss Discuss in Forum


  • Find the output of the following program.

    #include

    void main()

    {

    int y=10;

    if(y++>9 && y++!=10 && y++>11)

    printf("%d", y);

    else

    printf("%d", y);

    }

  • A.

     11

    B.

     12

    C.

     13

    D.

     14

    E.

     Compilation error

    View Answer

    Workspace

    Discuss Discuss in Forum


  • Find the output of the following program.

    #include<stdio.h>

    void main()

    {

    int y=10;

    if(y++>9 && y++!=11 && y++>11)

    printf("%d", y);

    else

    printf("%d", y);

    }

  • A.

     11

    B.

     12

    C.

     13

    D.

     14

    E.

     Compilation error

    View Answer

    Workspace

    Discuss Discuss in Forum


  • Determine output of the following program code.

    #include<stdio.h>

    void main()

    {

    int a, b=7;

    a = b<4 ? b<<1 : ++b>4 ? 7>>1 : a;

    printf("%d %d", a, b);

    }

  • A.

     3 7

    B.

     7 3

    C.

     8 3

    D.

     3 8

    E.

     None of these

    View Answer

    Workspace

    Discuss Discuss in Forum


  • Choose the correct output for the following program.

    #include<stdio.h>

    void main()

    {

    int a=10, b=11, c=13, d;

    d = (a=c, b+=a, c=a+b+c);

    printf("%d %d %d %d", d, a, b, c);

    }

  • A.

     50, 13, 11, 13

    B.

     50, 13, 24, 50

    C.

     13, 10, 24, 50

    D.

     50, 13, 24, 13

    E.

     13, 13, 24, 13

    View Answer

    Workspace

    Discuss Discuss in Forum


  • Consider the following program fragment, and choose the correct one

    void main()

    {

    int a, b = 2, c;

    a = 2 * (b++);

    c = 2 * (++b);

    }

  • A.

     a = 4, c = 8

    B.

     a = 3, c = 8

    C.

     b = 3, c = 6

    D.

     a = 4, c = 6

    E.

     b = 4, c = 6

    View Answer

    Workspace

    Discuss Discuss in Forum