Friday, September 8, 2023

C Operators MCQs Set 2

C Operators MCQs Set 2

Important MCQs based on C Programming Operators. 


1. What does the % operator do in C?

a) Addition

b) Subtraction

c) Multiplication

d) Modulus


2. Which operator is used for logical NOT in C?

a) &

b) &&

c) !

d) ||


3. What is the result of the expression 5 + 3 * 2 in C?

a) 10

b) 16

c) 11

d) 13


4. What is the result of the expression 10 / 3 in C?

a) 3.3333

b) 3

c) 3.0

d) 4


5. Which operator is used to check if two values are equal in C?

a) ==

b) =

c) !=

d) ===


6. What does the ++ operator do when placed before a variable, like ++x?

a) Decrements the variable by 1

b) Multiplies the variable by 2

c) Increments the variable by 1

d) Doubles the value of the variable


7. Which operator is used to access the value stored at a memory address in C?

a) &

b) *

c) ->

d) .


8. What does the += operator do in C?

a) Subtracts the right-hand value from the left-hand value

b) Multiplies the left-hand value by the right-hand value

c) Adds the right-hand value to the left-hand value

d) Divides the left-hand value by the right-hand value


9. Which operator is used to shift the bits of a number to the left in C?

a) >>

b) <<

c) &

d) |


10. What does the ternary conditional operator ? : do in C?

a) It checks if a condition is true and returns 1 if true, 0 if false.

b) It assigns a value to a variable.

c) It performs addition.

d) It provides a shorthand way to write an if-else statement.


Correct Answers:


1. d) Modulus

2. c) !

3. c) 11

4. b) 3

5. a) ==

6. c) Increments the variable by 1

7. b) *

8. c) Adds the right-hand value to the left-hand value

9. b) <<

10 d) It provides a shorthand way to write an if-else statement.


< Back to Question Bank >

< Home >


No comments:

Post a Comment