C - Operators and Expressions Questions and Answers

Take Exam

Operators and expressions are the core of performing calculations and logic in C programs. This section features C programming questions and answers focusing on arithmetic, relational, logical, bitwise, and assignment operators. Designed for TCS, Infosys, and Capgemini aspirants, these MCQs test both concept clarity and coding accuracy. Practicing these C Operators and Expressions questions with answers helps you strengthen your understanding of how C executes and evaluates expressions—essential for both programming interviews and technical exams.

C - Operators and Expressions

Showing 10 of 65 questions

61.  Which of the following expressions will correctly swap two integers without using a temporary variable ?

  • (x ^ = y), (y^=x)
  • (x=y), (y = x)
  • (x ^ = y), (y ^ = x), x ^ = y)
  • x^=(y^x)
Show Answer Report

62.  What is the correct and fully portable way to obtain the most significant byte of an unsigned integer x ?

  • x & & 0xFF00
  • x >> 24
  • x >> (CHAR - BIT * (sizeof(int)-3))
  • x >> (CHAR _ BIT * (sizeof (int)-1))
Show Answer Report

63.  What is the value of the following expression ? i = 1; i << 1 %2

  • 2
  • -2
  • 1
  • 0
Show Answer Report

64.  For the following statements find the values generated for p and q ?  int p = 0, q = 1; p = q++; p = ++q p = q--; p = - - q; The value of p and  q are

  • 1, 1
  • 0, 0
  • 3, 2
  • 1, 2
Show Answer Report

65.  Which of the following is a better approach to do the operation i = i * 16;?

  • multiply i by 16 and keep it
  • shift left by 4 bits
  • add i 16 times
  • none of the above
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test