Learn with Yasir

Share Your Feedback

Python Operators MCQs – Practice and Progress for Beginners

Test your understanding of Python operators with these beginner-friendly MCQs. Practice key concepts like arithmetic, comparison, logical, bitwise, and assignment operators with instant answers and explanations.

Topic: operators


📝 Multiple Choice Questions

🟢 Beginner

Q1. What is the output of `print(7 / 2)`?

print(7 / 2)
  • 🟢 A. 3
  • 🔵 B. 3.5
  • 🟠 C. 3.0
  • 🔴 D. 4
Answer

3.5

True division (/) always returns a float in Python 3.


Q2. What does `print(5 == 5.0)` output?

print(5 == 5.0)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. TypeError
  • 🔴 D. None
Answer

True

Python considers numeric values equal regardless of type (int vs float).


Q3. What is the output of `print(3 != '3')`?

print(3 != '3')
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. TypeError
  • 🔴 D. None
Answer

True

Different types (int vs str) are not equal in Python.


Q4. What is the value of `x` after `x = 5; x **= 3`?

x = 5
x **= 3
  • 🟢 A. 8
  • 🔵 B. 15
  • 🟠 C. 125
  • 🔴 D. Error
Answer

125

Exponentiation assignment: x = x ** 3 → 5^3 = 125.


Q5. What does `x = 10; x %= 3; print(x)` output?

x = 10
x %= 3
print(x)
  • 🟢 A. 1
  • 🔵 B. 3
  • 🟠 C. 0
  • 🔴 D. 10
Answer

1

Modulus assignment: x = x % 3 → remainder of 10/3 is 1.


Q6. What does `print('ell' in 'hello')` output?

print('ell' in 'hello')
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. Error
Answer

True

Membership operator checks for substring presence.


Q7. What is the result of `print(3 not in [1, 2, 4])`?

print(3 not in [1, 2, 4])
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. Error
Answer

True

3 is not present in the list, so 'not in' returns True.


Q8. What is the output of the following Python code?

x = 10
y = 5
x = x + y
y = x - y
x = x - y
print(x, y)
  • 🟢 A. 5 0
  • 🔵 B. 5 -5
  • 🟠 C. 10 5
  • 🔴 D. 5 10
Answer

5 10

This code swaps the values of x and y without using a temporary variable.


Q9. What is the output of the following expression?

x = 10
y = 5
print(x % y)
  • 🟢 A. 2
  • 🔵 B. 5
  • 🟠 C. 0
  • 🔴 D. 1
Answer

0

The modulus operator returns the remainder of 10 divided by 5, which is 0.


Q10. What is the output of the following Python code?

x = 5
y = 10
result = x > 3 or y < 5
print(result)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. SyntaxError
  • 🔴 D. None of these
Answer

True

The expression evaluates to True because x > 3 is True (even though y < 5 is False).


Q11. What is the output of x = 10; x //= 3?

x = 10; x //= 3
  • 🟢 A. 3
  • 🔵 B. 3.33
  • 🟠 C. 3.5
  • 🔴 D. 4
Answer

3

The floor division operator // returns the largest integer less than or equal to the division result.


Q12. What is the output of the following Python code?

num = 4
result = num in [1, 3, 4]
print(result)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. None
  • 🔴 D. Error
Answer

True

The 'in' operator checks for membership and returns True since 4 is in the list.


🟡 Intermediate

Q1. What is the result of `10 // 3 * 2`?

10 // 3 * 2
  • 🟢 A. 6
  • 🔵 B. 6.666
  • 🟠 C. 4
  • 🔴 D. 7
Answer

6

Floor division (//) happens first (10//3=3), then multiplication (3*2=6).


Q2. What does `print(10 <= 5 or 3 > 2)` return?

print(10 <= 5 or 3 > 2)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. SyntaxError
  • 🔴 D. None
Answer

True

The second condition (3 > 2) is True, making the entire OR expression True.


Q3. What is the output of `print(not (True and False))`?

print(not (True and False))
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. None
  • 🔴 D. Error
Answer

True

Inner expression (True and False) evaluates to False, then NOT False becomes True.


Q4. What is the output of `print(5 is 5.0)`?

print(5 is 5.0)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. Error
Answer

False

Different memory objects despite equal value (int vs float).


Q5. What does `a = [1, 2]; b = a; print(a is b)` return?

a = [1, 2]
b = a
print(a is b)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. None
Answer

True

b references the same list object as a (same memory location).


Q6. What does `print(10 << 2)` return?

print(10 << 2)
  • 🟢 A. 20
  • 🔵 B. 40
  • 🟠 C. 5
  • 🔴 D. 12
Answer

40

Left shift: 10 * 2^2 = 40 (binary 1010 shifted left becomes 101000).


Q7. What does `print((2 + 3) * 4 ** 2)` output?

print((2 + 3) * 4 ** 2)
  • 🟢 A. 80
  • 🔵 B. 100
  • 🟠 C. 400
  • 🔴 D. 144
Answer

80

Parentheses first (2+3=5), then exponent (4^2=16), then multiplication (5*16=80).


Q8. What is the output of `print(True + False + 10)`?

print(True + False + 10)
  • 🟢 A. 11
  • 🔵 B. 10
  • 🟠 C. True
  • 🔴 D. Error
Answer

11

Boolean values are subclass of int (True=1, False=0), so 1 + 0 + 10 = 11.


Q9. What does `print(10 < 9 < 8)` return?

print(10 < 9 < 8)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. Error
Answer

False

Chained comparison: equivalent to (10 < 9) and (9 < 8), both False.


Q10. What is the output of the following expression?

2 ** 3 + 4 // 2 - 1
  • 🟢 A. 8
  • 🔵 B. 9
  • 🟠 C. 10
  • 🔴 D. 11
Answer

9

The expression evaluates as (8) + (2) - 1 = 9 due to operator precedence.


Q11. What is the difference between 'and' and 'or' operators in Python?

  • 🟢 A. and returns True if both operands are True and or returns True if either operand is True
  • 🔵 B. and returns True if either operand is True and or returns True if both operands are True
  • 🟠 C. and returns False if both operands are False and or returns False if either operand is False
  • 🔴 D. both A and C are correct
Answer

both A and C are correct

The 'and' operator requires both conditions to be True, while 'or' requires at least one to be True.


🔴 Advanced

Q1. What does `2 ** 3 ** 2` evaluate to?

2 ** 3 ** 2
  • 🟢 A. 64
  • 🔵 B. 512
  • 🟠 C. 12
  • 🔴 D. SyntaxError
Answer

512

Exponentiation is right-associative: evaluates as 2 ** (3 ** 2) = 2^9 = 512.


Q2. What does `print(False or not True and True)` evaluate to?

print(False or not True and True)
  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. None
  • 🔴 D. Error
Answer

False

Operator precedence: NOT first (not True=False), then AND (False and True=False), then OR (False or False=False).


Q3. What is the output of `print(5 & 3)`?

print(5 & 3)
  • 🟢 A. 7
  • 🔵 B. 1
  • 🟠 C. 0
  • 🔴 D. 15
Answer

1

Bitwise AND: 0101 (5) & 0011 (3) = 0001 (1).


Q4. What is the result of `print(2 + 3 * 4 ** 2)`?

print(2 + 3 * 4 ** 2)
  • 🟢 A. 80
  • 🔵 B. 50
  • 🟠 C. 20
  • 🔴 D. 98
Answer

50

Order: exponentiation (4**2=16), then multiplication (3*16=48), then addition (2+48=50).


🧠 Practice & Progress