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
- What is Python? High-level, interpreted, dynamically-typed, multi-paradigm language.
- Is Python compiled or interpreted? Both — source compiles to bytecode (
.pyc), then interpreted by CPython VM. - 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. - What is GIL? Global Interpreter Lock — only one thread executes Python bytecode at a time. Limits true threading parallelism.
- What are Python's built-in data types? int, float, complex, bool, str, list, tuple, set, frozenset, dict, bytes.
- List vs tuple vs set? List: ordered + mutable. Tuple: ordered + immutable. Set: unordered + unique.
- Shallow vs deep copy? Shallow (
copy.copy) shares nested refs; deep (copy.deepcopy) recursively duplicates. - What is
None? Python's null — singleton object representing "no value". - What does
passdo? Null statement — placeholder for empty blocks. breakvscontinue?breakexits the loop;continueskips to next iteration.- What is a module vs package? Module = a
.pyfile. Package = directory with__init__.py. - What is
__name__ == '__main__'? Block runs only when file is executed directly, not imported. - Why is
dictlookup O(1)? Backed by a hash table. - What is exception handling syntax?
try / except / else / finally. - Difference between
rangeandxrange? Python 3 has onlyrange(lazy generator). Python 2 had both. - What are generators? Functions using
yield— produce values on demand, save memory. - What is recursion limit in Python? Default 1000 (use
sys.setrecursionlimit(...)to change). - Name 3 standard library modules.
os,sys,math,random,datetime,json. - What's
f-string?f"{name}"— fast formatted string literal (Python 3.6+). - Is Python case-sensitive? Yes —
Nameandnameare 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
// deep-dive
Go deeper — hand-picked articles
Long-form guides, shortcuts, and mental models that won't fit in a single lesson.
// feedback.matters()
Did this lesson help you?
