Operators are fundamental building blocks in any programming language. They perform operations on variables and values. Dive deep into Python’s operators with these 15 Multiple Choice Questions.

## 1. Which of the following is an arithmetic operator in Python?

### Answer:

### Explanation:

// is the floor division operator in Python. It returns the quotient of the division, rounded down to the nearest whole number.

## 2. What will be the result of 9 % 4?

### Answer:

### Explanation:

% is the modulus operator, which returns the remainder of the division. 9 % 4 returns 3.

## 3. Which of the following operators has the highest precedence?

### Answer:

### Explanation:

** is the exponentiation operator, and it has the highest precedence among the options listed.

## 4. What does the == operator do?

### Answer:

### Explanation:

== is a comparison operator that checks for equality of values and returns True if they are equal, otherwise False.

## 5. What is the output of 2 ** 3?

### Answer:

### Explanation:

** is the exponentiation operator. 2 ** 3 calculates 2 raised to the power of 3, which is 8.

## 6. Which operator is used for bitwise XOR in Python?

### Answer:

### Explanation:

The ^ operator in Python is used for bitwise XOR operations.

## 7. Which of the following is a membership operator in Python?

### Answer:

### Explanation:

in is a membership operator in Python used to check if a value is present in a sequence (like a list or tuple).

## 8. What does the is operator do in Python?

### Answer:

### Explanation:

The is operator checks if both the operands refer to the same object in memory (i.e., they have the same memory location).

## 9. If a = 3 and b = 3, what will be the result of (a is b)?

### Answer:

### Explanation:

In Python, small integers (like 3) are cached. Both a and b refer to the same memory location, so (a is b) returns True.

## 10. Which operator is used for floor division?

### Answer:

### Explanation:

// is the floor division operator that returns the quotient of the division, rounded down to the nearest whole number.

## 11. Which operator is used to check if an object is NOT part of a sequence?

### Answer:

### Explanation:

not in is a membership operator used to check if an object is NOT part of a sequence.

## 12. What is the result of 10 & 7?

### Answer:

### Explanation:

The & operator performs a bitwise AND operation. 10 in binary is 1010 and 7 is 0111. The result of bitwise AND operation is 0010, which is 2 in decimal.

## 13. Which operator has the lowest precedence?

### Answer:

### Explanation:

Among the given options, the logical or operator has the lowest precedence.

## 14. What is the result of True or False and False?

### Answer:

### Explanation:

The and operator has higher precedence than or. Therefore, False and False is evaluated first and results in False. Then, True or False results in True.

## 15. What does the += operator do?

### Answer:

### Explanation:

The += operator adds the right operand to the left operand and assigns the result to the left operand. It’s shorthand for a = a + b.

By taking this quiz, you’ve reinforced your understanding of operators in Python. Continuously challenging yourself helps in better retention and understanding. Keep it up and happy coding!