Welcome to this quiz on Python Operators!
Operators in Python allow us to perform operations on variables and values. This quiz will test your understanding of different types of operators, including arithmetic, comparison, logical, bitwise, assignment, and identity operators.
Each question is multiple-choice, and the answers are provided at the end. Let’s see how well you understand Python operators!
Table of Contents:
- Python quizzes for beginners series
Quiz Questions
1. What will be the output of 5 + 3 * 2
?
a) 16
b) 11
c) 13
d) 10
Answer
b) 11
2. Which operator is used for exponentiation in Python?
a) ^
b) **
c) %
d) //
Answer
b) **
3. What will 10 % 3
return?
a) 1
b) 3
c) 0
d) 10
Answer
a) 1
4. What is the result of 5 // 2
?
a) 2.5
b) 2
c) 3
d) 5
Answer
b) 2
5. What is the output of not (True and False)
?
a) True
b) False
c) None
d) SyntaxError
Answer
a) True
6. Which operator is used for floor division?
a) /
b) //
c) %
d) **
Answer
b) //
7. What is the result of 2 ** 3 ** 2
?
a) 64
b) 512
c) 9
d) 16
Answer
b) 512
8. What does 10 & 7
evaluate to?
a) 3
b) 2
c) 7
d) 10
Answer
b) 2
9. Which operator is used for bitwise OR?
a) |
b) &
c) ^
d) ~
Answer
a) |
10. What is the output of 10 | 4
?
a) 14
b) 10
c) 4
d) 6
Answer
a) 14
11. What will True + True
return?
a) 2
b) 1
c) True
d) False
Answer
a) 2
12. What is the result of 10 > 5 and 2 ?
a) True
b) False
c) None
d) Error
Answer
a) True
13. What does 10 == "10"
evaluate to?
a) True
b) False
c) None
d) Error
Answer
b) False
14. What is the result of not 0
?
a) True
b) False
c) 0
d) 1
Answer
a) True
15. Which operator is used to check if two variables reference the same object?
a) ==
b) is
c) in
d) and
Answer
b) is
16. What will 5 & 3
return?
a) 1
b) 3
c) 2
d) 5
Answer
c) 2
17. What will 5 | 3
return?
a) 5
b) 3
c) 7
d) 2
Answer
c) 7
18. What does ~5
evaluate to?
a) -5
b) -6
c) 6
d) 5
Answer
b) -6
19. What will 10 != 10
return?
a) True
b) False
c) None
d) Error
Answer
b) False
20. What will 8 >> 2
return?
a) 2
b) 4
c) 1
d) 8
Answer
a) 2