Python Operators – Practice Questions (40)
Arithmetic Operators
1. What is the output of: print(10 + 5 * 2)
2. Find the result of: print((20 - 5) / 3)
3. What does the following code print? print(17 // 3)
4. Find the output: print(17 % 3)
5. What is the value of: print(2 ** 4)
6. Predict the output: print(25 / 5 + 3)
7. What is printed by: print(10 // 4)
8. Find the output: print(15 % 4 + 2)
9. What is the result of: print(5 * (3 + 2))
10. Evaluate the expression: print(100 - 10 * 3)
11. What is the output of: print(8 ** 2 // 4)
12. Find the result: print((10 + 20) % 7)
Relational Operators
13. What is the output? print(10 == 10)
14. Predict the result: print(15 != 10)
15. What does the following print? print(8 > 12)
16. Find the output: print(20 < 25)
17. What is the result of: print(10 >= 10)
18. Predict the output: print(5 <= 3)
19. What does this return? print(7 == 7.0)
20. Find the output: print(100 != 100)
21. What is printed? print(9 > 3 * 2)
22. Evaluate: print(18 / 2 == 9)
Logical Operators
23. What is the output? print(True and True)
24. Predict the result: print(True and False)
25. Find the output: print(False or True)
26. What does this print? print(False or False)
27. Evaluate: print(not True)
28. Find the output: print(not False)
29. What is the result? print(10 > 5 and 8 < 3)
30. Predict the output: print(5 == 5 or 3 > 10)
31. Evaluate the expression: print(not (10 < 5))
32. What does this return? print((5 > 2) and (2 > 1))
Assignment Operators
33. What is the value of x after execution?
x = 10
x += 5
34. Find the value of a:
a = 20
a -= 8
35. What is the value of b?
b=4
b *= 3
36. Predict the value of c:
c = 16
c /= 4
37. Find the final value of x:
x=5
x += 2
x *= 3
38. What is the output?
y = 10
y -= 4
print(y)
39. Find the value of z:
z=9
z /= 2
40. What is the final value of a?
a=6
a *= 2
a -= 3