C Operators MCQ

Operators are symbols that instruct the compiler to perform specific mathematical or logical functions. They can be categorized into Arithmetic, Relational, Logical, Bitwise, Assignment, and Miscellaneous operators.

Let’s gauge your understanding of C operators with this interactive quiz tailored for beginners! Each question is followed by the correct answer and an explanation to help reinforce your knowledge.

1. Which of the following is a modulus operator in C?

A) %
B) /
C) &&
D) ||

Answer:

A) %

Explanation:

The modulus operator (%) returns the remainder of a division operation.

2. Which operator is used for bitwise left shift?

A) <<
B) <\
C) <=
D) <

Answer:

A) <<

Explanation:

The << operator shifts bits of a number to the left.

3. What does the == operator do?

A) Assigns a value
B) Checks for inequality
C) Checks for equality
D) Performs an XOR operation

Answer:

C) Checks for equality

Explanation:

The == operator is used to compare two values for equality.

4. Which of the following operators has the highest precedence?

A) +
B) *
C) &&
D) ||

Answer:

B) *

Explanation:

The multiplication operator (*) has higher precedence than addition, logical AND, and logical OR.

5. What will be the value of x after executing this expression: x = 7 + 3 * 2;?

A) 13
B) 20
C) 16
D) 10

Answer:

A) 13

Explanation:

According to operator precedence, multiplication is performed before addition. Thus, the result is 13

6. Which operator is used for bitwise AND?

A) &&
B) &
C) |
D) ^

Answer:

B) &

Explanation:

The & operator performs a bitwise AND operation.

7. Which operator can be used to check if both conditions are true?

A) ||
B) &&
C) !
D) ^

Answer:

B) &&

Explanation:

The && operator is the logical AND, which checks if both conditions are true.

8. The != operator is __________.

A) Logical AND
B) Logical OR
C) NOT equal to
D) Equal to

Answer:

C) NOT equal to

Explanation:

The != operator checks if two values are not equal.

9. What is the result of the bitwise operation ~4?

A) 4
B) 5
C) -5
D) -4

Answer:

C) -5

Explanation:

The ~ operator inverts all the bits. For integer 4, the bitwise representation is 0100. Inverting the bits gives 1011, which represents -5 in Two’s Complement form.

10. What will be the result of 7 ^ 3?

A) 4
B) 10
C) 5
D) 6

Answer:

A) 4

Explanation:

The ^ operator is the bitwise XOR. The operation 7 (0111) XOR 3 (0011) results in 4 (0100).

11. Which operator is used for division?

A) %
B) /
C) \
D) //

Answer:

B) /

Explanation:

The / operator is used for division in C.

12. Which of the following is a post-increment operator?

A) i++
B) i–
C) ++i
D) –i

Answer:

A) i++

Explanation:

The i++ operator is the post-increment operator which increases the value of i by 1 after its current value is used.

13. Which operator assigns a value to a variable?

A) ==
B) =
C) :=
D) <=

Answer:

B) =

Explanation:

The = operator is used for assignment in C.


By the end of this quiz, you should have a better understanding of the various operators in the C language. Keep practicing and refining your skills to become proficient in using these operators in various programming scenarios!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top