C Operators Questions and Answers
Operators in C are symbols that perform operations on variables and values, forming the basis of all computational logic. Questions on C operators, including arithmetic, logical, relational, and bitwise operators, are common in programming questions and answers for campus placements and technical interviews. Companies like Infosys, Wipro, and TCS often include C operator problems in their online coding tests. This section provides in-depth C operator questions with solutions and explanations to help learners understand operator precedence, associativity, and expression evaluation.
C Operators
Showing 10 of
122 questions
101. Find the output void main ( ) { unsigned int i=2; i=(((i<<6)-1)^127||(i+3>>3)); printf("%u",i); }
- 27
- 0
- Garbage value
- Compilation error
102. Find the output void main ( ) { int i=1; i= i + 2*i++ + -i; printf ("i is now %d", is); }
- i is now 3
- i is now 4
- i is now 2
- None of these
103. Find the output void main ( ) { int x=10; printf(5d %d %d", x==10, x=20, x<20); }
- 1 20 0
- 1 20 1
- 0 20 1
- None of these
104. Find the output void main( ) { int a=3, b=4, c; c=b==4||a!=3; printf ("%d", c} }
- 0
- 1
- Compilation error
- None of these
105. Find the output void main ( ) { int a, b, c, d, e; e=++a&&++b||--c&&d++; printf("%d",e); }
- 0
- 1
- Error
- None of these
106. Find the output void main ( ) { int a=2, b=6, c=5; c*=a+b; printf ("%d", c); }
- 16
- 30
- 40
- None of these
107. Find the output printf ("5s", #CAcademy);
- CAAcademy
- Academy
- Compile time error
- Runtime error
108. Find the output void main ( ) { int i=-1, j=-1, k=0, 1=2, m; m=i++&&j++&&k++||1++; printf("%d %d %d %d", i,j,k, 1,m); }
- 0 0 0 0 0
- 0 0 1 3 1
- 1 1 1 3 1
- 0 -1 0 2 0
109. Find the output void main ( ) { int a=5, b=6, c=2, d; d=(a++, ++b, c++); printf("%d%d%d",d,a,ac); }
- 263
- 252
- 162
- 253
110. Unary operators are
- Operator dependant
- Position dependant
- Value dependant
- Both b and c