C Practice Test on Operators

This “C Practice Test on Operators” providing set of technical and objective type questions on Operators to test your programming skills.


1. What is the Output of following Code?
#include<stdio.h>
int main(void)
{
int x=0 , y=3 ;
x+1 ? –x : ++y ;
printf(“%d,%d”, x,y);
return 0;
}

 
 
 
 

2. What is the Output of following Code?
#include<stdio.h>
int main()
{
int a;
a=sizeof(!5.6);
printf(“%d”,a);
return 0;
}

 
 
 
 

3. What is the Output of following Code?
#include<stdio.h>
int main()
{
int a = 8;
printf(“%d , %d”, a << 1,a << 2);
return 0;
}

 
 
 
 

4. What is the Output of following Code?
#include<stdio.h>
main()
{
int a =5;
a = a++ + ++a ;
printf(“a : %d\n”,a);
}

 
 
 
 

5. What is the Output of following Code?
#include<stdio.h>
main()
{
int a=5;
printf(“%d,%d,%d”,++a, a++ , –a);
}

 
 
 
 

6. What is the Output of following Code?
#include<stdio.h>
main()
{
int x=3,y=7,z;
z = ++x * y– ;
x = y– + ++z ;
y = z– + x++ ;
printf(“%d,%d,%d”,x,y,z);
}

 
 
 
 

7. What is the Output of following Code?
#include<stdio.h>
int main()
{
int x ;
x = (10,20,30), 40;
printf(“%d”,x);
return 0;
}

 
 
 
 

8. What is the Output of following Code?
#include<stdio.h>
main()
{
int x=5 , y = 0 , a,b;
a = ++y || ++x ;
b = –y && ++x ;
printf(“%d,%d,%d,%d\n”,x,y,a,b);
}

 
 
 
 

9. What is the Output of following Code?
#include <stdio.h>
main()
{
int a = 10, b = 5, c = 3;
b != !a;
c = !!a;
printf(“%d\t%d”, b, c);
}

 
 
 
 

10. Which of the following is not compound assignment operator?

 
 
 
 

Question 1 of 10

Share this