Turning Learners Into Developers
Codekilla
CODEKILLA
back to course
Lesson 114 / 114100%· free preview
Exam Prep2/2

Viva Questions

20 most-asked Python viva questions with one-line answers.

Common Python Viva Questions and Answers
  1. What is Python? High-level, interpreted, dynamically-typed, multi-paradigm language.
  2. Is Python compiled or interpreted? Both — source compiles to bytecode (.pyc), then interpreted by CPython VM.
  3. What's the difference between Python 2 and 3? Print is a function in 3, integer division uses //, strings are unicode by default. Python 2 EOL'd in 2020.
  4. What is GIL? Global Interpreter Lock — only one thread executes Python bytecode at a time. Limits true threading parallelism.
  5. What are Python's built-in data types? int, float, complex, bool, str, list, tuple, set, frozenset, dict, bytes.
  6. List vs tuple vs set? List: ordered + mutable. Tuple: ordered + immutable. Set: unordered + unique.
  7. Shallow vs deep copy? Shallow (copy.copy) shares nested refs; deep (copy.deepcopy) recursively duplicates.
  8. What is None? Python's null — singleton object representing "no value".
  9. What does pass do? Null statement — placeholder for empty blocks.
  10. break vs continue? break exits the loop; continue skips to next iteration.
  11. What is a module vs package? Module = a .py file. Package = directory with __init__.py.
  12. What is __name__ == '__main__'? Block runs only when file is executed directly, not imported.
  13. Why is dict lookup O(1)? Backed by a hash table.
  14. What is exception handling syntax? try / except / else / finally.
  15. Difference between range and xrange? Python 3 has only range (lazy generator). Python 2 had both.
  16. What are generators? Functions using yield — produce values on demand, save memory.
  17. What is recursion limit in Python? Default 1000 (use sys.setrecursionlimit(...) to change).
  18. Name 3 standard library modules. os, sys, math, random, datetime, json.
  19. What's f-string? f"{name}" — fast formatted string literal (Python 3.6+).
  20. Is Python case-sensitive? Yes — Name and name are different identifiers.
AI-powered recap

Quick recap quiz?

We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.

Ready to move on?
// example library
Want more hands-on snippets in Python?
Browse 3 runnable examples · across 1 chapter · short, copy-paste-friendly · grouped by topic
Explore examples
// deep-dive
Go deeper — hand-picked articles
Long-form guides, shortcuts, and mental models that won't fit in a single lesson.
Open Blog
// feedback.matters()
Did this lesson help you?