C Expressions (Arithmetic and Logical Operator) Interview Questions Quiz.

C Expressions

1 / 8

What is the o/p of below C Program?

#include<stdio.h>

int main()

{

     int a = 10;

     if (a == 10 && a++ == 11)

     {

          printf("TRUE: %d\n", a);

     }

     else

     {

          printf("FALSE: %d\n", a);

     }

}

2 / 8

What is the output of the below program?

#include<stdio.h>

int main()

{

     int a=2,b=4,c=3,d=0,x,y;

     x= (a=0) && (b=7);

     y=(c=5) || (d=0);

     printf("a=%d,b=%d,c=%d,d=%d,x=%d,y=%d\n",a,b,c,d,x,y);

     x=(a==0) && (b=10);

     y=(c==6) || (d=5);

     printf("a=%d,b=%d,c=%d,d=%d,x=%d,y=%d\n", a,b,c,d,x,y);

}

3 / 8

What is the output of below program?

#include<stdio.h>

int main()

{

     int var = 5;

     char ch = 'A';

     var = ch + 4;

     printf("%d %c %d %c\n", ch, ch, var, var);

}

4 / 8

What is the o/p of the below program?

#include<stdio.h>

int main()

{

     int x = 10++;

     int y = x++;

     printf("%d %d\n",x,y);

}

5 / 8

What is the o/p of the below program?

#include<stdio.h>

int main()

{

     int a = 5, b = 10, c, d;

     c = a > b;

     d = (a < b) && (c < a);

     printf("%d %d\n", c,d);

}

6 / 8

What could be the output of the below program?

#include<stdio.h>

int main()

{

     int x = 5, y = 5, z = 0;

     z = (x == 5) || ++y;

     printf("x=%d y=%d z=%d\n", x,y,z);

}

7 / 8

What is the output of the below Program?

#include<stdio.h>

int main()

{

     float f = 2.4;

     if(f == 2.4)

     {

          puts("true");

     }

     else

     {

          puts("false");

     }

}

8 / 8

What is the output of the below program?

#include<stdio.h>

int main()

{

     int i; char c; float f = 67.222;

     c = i = f;

     printf("%.3f %i %c\n", f,i,c);
}

Your score is

The average score is 34%

0%

Leave a Comment