PYnative

Python Programming

  • Learn Python
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Exercises
  • Quizzes
  • Code Editor
Home » Python » Quizzes » Python Operators and Expression Quiz

Python Operators and Expression Quiz

Updated on: August 26, 2025 | 51 Comments

This Python Operators and Expressions Quiz provides Multiple Choice Questions (MCQs) to test your knowledge of various Python operators, including:

  • Arithmetic Operators: For mathematical calculations
  • Comparison (Relational) Operators: For comparing values
  • Logical Operators: For combining conditional statements
  • Assignment Operators: For assigning values to variables
  • Bitwise Operators: For performing operations on individual bits
  • Identity Operators: For checking if two variables refer to the same object
  • Membership Operators: For testing if a sequence contains a specific value

Also, See:

  • Python Operators.
  • 15 Python Quizzes: each focusing on a specific topic
  • The quiz contains 25 questions. There is no time limit.
  • You will get 1 point for each correct answer. Solve 15 correctly to pass the test.

1. 4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators?

a = 4
b = 11
print(a | b)
print(a >> 2)
 
 

2. What will be the output of the following Python code?

print(5 % 2)
 
 
 
 

3. What will be the output of the following Python code?

x = 10
y = "2"
print(x + int(y))
 
 
 
 

4. In the expression result = a or b, what value is assigned to result if a is False and b is True?

 
 
 
 

5. What is the output of print(10 - 4 * 2)

 
 

6. What will be the output of the following Python code?

print(10 > 5 and "hello" == "world")
 
 
 
 

7. What will be the output of the following Python code?

x = 5
print(x > 3 and x < 10)
 
 
 
 

8. What is the output of print(2 * 2 ** 2 * 2)

 
 
 
 

9. What will be the output of the following addition (+) operator

a = [10, 20]
b = a
b += [30, 40]
print(a)
print(b)
 
 

10. What is the output of print(2 ** 3 ** 2)

 
 

11. Which operation has higher precedence: multiplication (*) or addition (+)?

 
 
 
 

12. What will be the output of the following code?

x = 6
y = 2
print(x ** y)
print(x // y)
 
 
 
 

13. What is the value of the following Python Expression

print(36 / 4)

 
 
 
 

14. What will be the output of the following Python code?

message = "Hello"
print('e' in message)
print('x' in message)
 
 
 
 

15. What will be the output of the following code?

x = 10
y = 50
if x ** 2 > 100 and y < 100:
    print(x, y)
 
 
 

16. What does the bitwise | operator do?

 
 
 
 

17. The expression x *= 5 is equivalent to which of the following?

 
 
 
 

18. Which of the following operators checks if two variables refer to the exact same object in memory?

 
 
 
 

19. Bitwise shift operators (<<, >>) has higher precedence than Bitwise And(&) operator

 
 

20. Which operator was introduced in Python 3.

 
 
 
 

21. What does the bitwise & operator do?

 
 
 
 

22. Which operator is used to check if a sequence (like a string or list) contains a specific element?

 
 
 
 

23. What will be the output of the following Python code?

result = 10 / 2 * 3
print(result)
 
 
 
 

24. What will be the output of the following Python code?

x = [1, 2, 3]
y = [1, 2, 3]
print(x == y)
print(x is y)
 
 
 
 

25. What will be the output of the following Python code?

a = "Python"
b = "3"
print(a + b * 2)
 
 
 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Basics, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Image

I’m Vishal Hule, the Founder of PYnative.com. As a Python developer, I enjoy assisting students, developers, and learners. Follow me on Twitter.

Related Tutorial Topics:

Python Python Basics Python Quizzes

All Coding Exercises:

C Exercises
C++ Exercises
Python Exercises

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 25+ questions
  • Each Quiz contains 25 MCQ
Exercises
Quizzes

Loading comments... Please wait.

In: Python Python Basics Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • 15 Python Quizzes
  • Python Online MCQ Test
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Multithreading and Multiprocessing Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

 Explore Python

  • Python Tutorials
  • Python Exercises
  • Python Quizzes
  • Python Interview Q&A
  • Python Programs

All Python Topics

Python Basics Python Exercises Python Quizzes Python Interview Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Coding Exercises

  • C Exercises
  • C++ Exercises
  • Python Exercises

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our:

  • Terms Of Use
  • Privacy Policy
  • Cookie Policy

Copyright © 2018–2025 pynative.com

Advertisement