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
51. Find the output void main ( ) { int a=10, b=20; a=(a>5 || b=6? 40:50); printf("%d", a); }
- 40
- 50
- 10
- Compilation error
52. Arrange the operators ~, == &&, *,^ in the increasing order of precedence.
- ==,^,*&&,~
- &&, ^, ==,*, ~
- *,++,&&, ^, ~
- &&, ==, ^,*,~
53. Find the output void main ( ) { int x=16384, y=1; x<<=y; printf("%d",x); }
- 32768
- -32768
- 0
- Compilation error
54. Find the output. void main ( ) { printf("%x",-1<<4); }
- 0010
- 1010
- fff0
- ffff
56. Find the output void main ( ) { int p=3, q=-5, x=4, y=2, z; z=p+++ ++q*y/x; printf("%d', z); }
- 0
- 1
- -2
- None of these
57. Find the output void main ( ) { int x=7; x=(x<<=x%2) printf("%d",x); }
- 7
- 14
- 0
- Compilation error
58. Find the output void main ( ) { int a=2, b=5, c=1; printf(%d", (b>=a>=0?1:0); }
- 1
- 0
- Compilation error
- None of these
59. Find the output. void main ( ) { int x=1; if (x++>=x) printf("%d",x); else printf("%d", ++x); }
- 2
- 3
- Compilation error
- None of these
60. The correct order of evaluation for the expression a=b- =c*=5 is
- b-=c, (b-=c)*=5, a=(b-=c)*=5)
- c*=5, b-=(c*=5), a=(b-=(c*=5))
- b-=c, a=(b-=c), (a=(b-=c))c*=5
- None of these