All quizzes
Free quiz · 49 questions in the bank

Python quiz

Test your Python knowledge with a free interactive quiz — 49 questions with answers and explanations. No signup needed to play.

Question 1/12Score 0

What is the purpose of `if __name__ == "__main__":`?

In this round
  1. What is the purpose of `if __name__ == "__main__":`?
  2. How do you create a list comprehension for squares of 1–5?
  3. What does `None` represent in Python?
  4. What is a lambda function in Python?
  5. How do you handle exceptions in Python?
  6. What is the `self` parameter in Python class methods?
  7. How do you open a file safely in Python?
  8. What is the output of `bool([])` in Python?
  9. What does the `in` keyword check?
  10. How do you create a set in Python?
  11. What is PEP 8?
  12. What does `*args` allow in a Python function?
Gaps to close?
Read the curated Python notes — core concepts, patterns, interview prep.
Python notes

More quizzes

AccessibilityAlgorithmsAngularApache KafkaAWSBootstrap