Vidyalelo
C Programming · all questions

Operators and Expressions
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

85

Questions

3/5

Page

Pick an option on a question to see the right answer and solution.

What will be the output?
void main(){ 
    int a=10, b=20;
    char x=1, y=0;
    if(a,b,x,y){ 
        printf("EXAM"); 
    } 
}

Select an option to see the answer and solution.

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;

Select an option to see the answer and solution.

What is the output of the following statements?
int i = 0;
printf("%d %d", i, i++);

Select an option to see the answer and solution.

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);

Select an option to see the answer and solution.

What will be the output of the following code fragment?
void main()
{
   printf("%x",-1<<4);
}

Select an option to see the answer and solution.

Find the output of the following program.
#include<stdio.h>
void main()
{
   int y=10;
   if(y++>9 && y++!=10 && y++>11)
      printf("%d", y);
   else
      printf("%d", y);
}

Select an option to see the answer and solution.

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);
}

Select an option to see the answer and solution.

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);
}

Select an option to see the answer and solution.

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);
}

Select an option to see the answer and solution.

Consider the following program fragment, and choose the correct one.
void main()
{
   int a, b = 2, c;
   a = 2 * (b++);
   c = 2 * (++b);
}

Select an option to see the answer and solution.

Which operator from the following has the lowest priority?

Select an option to see the answer and solution.

Identify the correct output of the following code:
void main()
{
   int w=10, x=5, y=3, z=3;
   if( (w < x ) && (y=z++) )
      printf("%d %d %d %d", w, x, y, z);
   else
      printf("%d %d %d %d", w, x, y, z);
}

Select an option to see the answer and solution.

Given b=110 and c=20, what is the value of 'a' after execution of the expression a=b-=c*=5?

Select an option to see the answer and solution.

what will be the output when following code is executed?
void main()
{
   int a=10, b;
   b = a++ + ++a;
   printf("%d %d %d %d", b, a++, a, ++a);
}

Select an option to see the answer and solution.

Which among the following statement is right?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    float a = 2.455555555555;
    printf("%f", a);
}

Select an option to see the answer and solution.

Which of the following % operation is invalid?

Select an option to see the answer and solution.

In the following C code, the union size is decided by?
union temp
{
    char a;
    int b;
    float c;
};

Select an option to see the answer and solution.

Modulus for float could be achieved by?

Select an option to see the answer and solution.

Which among the following has the highest precedence?

Select an option to see the answer and solution.