C Operators Questions and Answers

Take Exam

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

31. Find the output void main ( ) { int x=10, y=5, p, q; p=x>9; q=p ||(x=5, y=10); printf("%d %d %d", q,x,y); }

  • 1 10 5
  • 0 10 5
  • 1 5 10
  • Compilation error
Show Answer Report

32. Find the output void main( ) { int x=-2; x=-x-x+x; printf("%d", x); }

  • 0
  • 2
  • 4
  • None of these
Show Answer Report

33. Masking is a technique

  • To set a binary number or bit pattern to zero.
  • To set a binary number or bit pattern to one.
  • To set a binary number or bit pattern to zero to one and vice versa.
  • None of these
Show Answer Report

34. Find the output void main ( ) { int a, b, c; a=1, b=2, c=3; a=a?b:c; c=-b?a:c; printf("%d %d", a, c); }

  • 3 3
  • 2 3
  • 2 2
  • None of these
Show Answer Report

35. Find the output. void main ( ) { int x=2, y=1; y+=x<<=2; printf(%d %d", x,y); }

  • 2 9
  • 8 8
  • 3 8
  • 8 9
Show Answer Report

36. Find the output. void main ( ) { int x=-5u; int y=5; y=y>x?y/x:x/y; printf("%u",y); }

  • 13106
  • -1
  • 65535
  • 5
Show Answer Report

37. Find the output. void main ( ) { int a,b, sum=0; sum=(a=5,b=9, ++a+ ++b); printf("%d", sum);

  • 16
  • 5
  • 10
  • Compilation error
Show Answer Report

38. b++ executes faster than b+1 because

  • b++ uses register
  • Single machine instruction is required for b++
  • Both a and b are true
  • None of these
Show Answer Report

39. Find the output void main ( ) { int x,y,z; z=(x=3) && (y=7) &10; printf ("%d", z);

  • 0
  • 1
  • No output
  • None of these
Show Answer Report

40. Find the output. void main ( ) { int x,y,z; x=2; y=4; z=y++*x++ | y--; printf("%d", z); }

  • 13
  • 28
  • 24
  • 12
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test