Programming Languages
🟢 75 Verified MCQs • 5 Complete Chapters Active
⭐ Interview & Exam Grade
Python Programming: 5-Chapter Comprehensive Practice & 75 Verified MCQs
Master Python Programming with our complete 5-chapter question bank. Each verified MCQ provides four distinct options, verified solution keys, step-by-step technical rationale, and high-yield conceptual rules.
Curriculum Roadmap & Chapters Covered (All Live & Unlocked):
✓
Chapter 1: Memory Model, Data Types & Sequences (Q1 – Q15)
✓
Chapter 2: Dictionaries, Sets & Comprehensions (Q16 – Q30)
✓
Chapter 3: Functions, Lambdas, Decorators & Closures (Q31 – Q45)
✓
Chapter 4: OOP, Inheritance & Magic (Dunder) Methods (Q46 – Q60)
✓
Chapter 5: Generators, Iterators, Exceptions & File I/O (Q61 – Q75)
📝 Total Questions: 75 Verified MCQs
📚 Modules: 5 Complete Chapters
⏱️ Est. Practice Time: ~90 minutes
🎯 Target Benchmark: 80% (60/75 Correct)
Select Chapter to Practice:
Interactive Practice Dashboard
Answered: 0 / 75
Correct: 0
Accuracy: 0%
Streak: 🔥 0
Curriculum Track • Module 1 of 5
Chapter 1: Memory Model, Data Types & Sequences (Q1 – Q15)
Question 1 of 75
Chapter 1
Which of the following built-in Python data types is mutable?
Question 2 of 75
Chapter 1
What is the output of the following Python dictionary comprehension?
d = {x: x**2 for x in (1, 2, 3)}
print(d.get(4, 'Missing'))
d = {x: x**2 for x in (1, 2, 3)}
print(d.get(4, 'Missing'))
d = {x: x**2 for x in (1, 2, 3)}
print(d.get(4, 'Missing'))
Question 3 of 75
Chapter 1
What will be printed when executing the following Python slice operation?
s = 'RTSALL_PLATFORM'
print(s[6::-2])
s = 'RTSALL_PLATFORM'
print(s[6::-2])
s = 'RTSALL_PLATFORM'
print(s[6::-2])
Question 4 of 75
Chapter 1
Why does the identity operator 'is' return True for small integers (e.g., a = 250; b = 250; a is b), but may return False for large integers in standard CPython?
Question 5 of 75
Chapter 1
What happens in Python when defining a function with a default mutable argument like 'def append_item(val, items=[])'?
def append_item(val, items=[]):
items.append(val)
return items
print(append_item(1))
print(append_item(2))
Question 6 of 75
Chapter 1
What will be printed when creating and iterating through the following generator expression?
gen = (x * 2 for x in range(3))
print(type(gen), list(gen), list(gen))
gen = (x * 2 for x in range(3))
print(type(gen), list(gen), list(gen))
gen = (x * 2 for x in range(3))
print(type(gen), list(gen), list(gen))
Question 7 of 75
Chapter 1
Which module in Python's standard library provides high-performance container datatypes such as deque, Counter, OrderedDict, and defaultdict?
Question 8 of 75
Chapter 1
What is the difference between copy.copy() and copy.deepcopy() in Python when duplicating an object with nested lists?
Question 9 of 75
Chapter 1
What will be printed when running the following variable unpacking syntax in Python 3?
a, *b, c = [10, 20, 30, 40, 50]
print(b)
a, *b, c = [10, 20, 30, 40, 50]
print(b)
a, *b, c = [10, 20, 30, 40, 50]
print(b)
Question 10 of 75
Chapter 1
What is the output of the following set operation in Python?
s1 = {1, 2, 3, 4}
s2 = {3, 4, 5, 6}
print(s1 ^ s2)
s1 = {1, 2, 3, 4}
s2 = {3, 4, 5, 6}
print(s1 ^ s2)
s1 = {1, 2, 3, 4}
s2 = {3, 4, 5, 6}
print(s1 ^ s2)
Question 11 of 75
Chapter 1
Why cannot a list be used as a key in a Python dictionary?
Question 12 of 75
Chapter 1
What will be printed when running the following code?
x = [1, 2]
y = x
y += [3, 4]
print(x)
x = [1, 2]
y = x
y += [3, 4]
print(x)
x = [1, 2]
y = x
y += [3, 4]
print(x)
Question 13 of 75
Chapter 1
What is the scope resolution order in Python, commonly known by the LEGB acronym?
Question 14 of 75
Chapter 1
What does the '__slots__' declaration inside a Python class definition achieve?
class Point:
__slots__ = ('x', 'y')
def __init__(self, x, y):
self.x = x
self.y = y
Question 15 of 75
Chapter 1
What is the output of the following ternary expression?
val = 10 if 5 > 10 else 20
print(val)
val = 10 if 5 > 10 else 20
print(val)
val = 10 if 5 > 10 else 20
print(val)Curriculum Track • Module 2 of 5
Chapter 2: Dictionaries, Sets & Comprehensions (Q16 – Q30)
Question 16 of 75
Chapter 2
What is the time complexity of searching for a key in a standard Python dictionary in average vs worst case?
Question 17 of 75
Chapter 2
What will be the output of the following dictionary update using the pipe operator (introduced in Python 3.9)?
d1 = {'a': 1, 'b': 2}
d2 = {'b': 99, 'c': 3}
print(d1 | d2)
d1 = {'a': 1, 'b': 2}
d2 = {'b': 99, 'c': 3}
print(d1 | d2)
d1 = {'a': 1, 'b': 2}
d2 = {'b': 99, 'c': 3}
print(d1 | d2)
Question 18 of 75
Chapter 2
What is the result of evaluating: {x for x in 'abracadabra' if x not in 'abc'}?
{x for x in 'abracadabra' if x not in 'abc'}
Question 19 of 75
Chapter 2
What does 'collections.defaultdict(list)' do when accessing a non-existent key?
Question 20 of 75
Chapter 2
How does Python maintain dictionary insertion order since version 3.7?
Question 21 of 75
Chapter 2
What is the difference between set.discard(x) and set.remove(x) in Python?
Question 22 of 75
Chapter 2
What will be printed by the following dictionary comprehension?
names = ['Alice', 'Bob']
d = {name: len(name) for name in names}
print(d)
names = ['Alice', 'Bob']
d = {name: len(name) for name in names}
print(d)
names = ['Alice', 'Bob']
d = {name: len(name) for name in names}
print(d)
Question 23 of 75
Chapter 2
What happens when you pass a dictionary to the 'dict.fromkeys(keys, value)' method when 'value' is a mutable list []?
Question 24 of 75
Chapter 2
What is the output of: frozenset([1, 2, 2, 3])?
Question 25 of 75
Chapter 2
What is the return value of 'dict.popitem()' in Python 3.7+?
Question 26 of 75
Chapter 2
What will be printed when creating a set with duplicate unhashable nested elements?
s = {[1, 2], [1, 2]}
s = {[1, 2], [1, 2]}
Question 27 of 75
Chapter 2
What does 'collections.ChainMap(d1, d2)' do in Python?
Question 28 of 75
Chapter 2
What is the output of: {x: x % 2 == 0 for x in range(3)}?
Question 29 of 75
Chapter 2
Which method returns a set containing elements that are common to both set A and set B?
Question 30 of 75
Chapter 2
What is the time complexity of the 'in' membership check on a Python set of size N?
Curriculum Track • Module 3 of 5
Chapter 3: Functions, Lambdas, Decorators & Closures (Q31 – Q45)
Question 31 of 75
Chapter 3
What is a 'Closure' in Python?
Question 32 of 75
Chapter 3
What does the '@functools.wraps(fn)' decorator do when authoring custom decorators?
Question 33 of 75
Chapter 3
What is the restriction on anonymous functions created using the 'lambda' keyword in Python?
Question 34 of 75
Chapter 3
What does the single forward slash '/' indicate in a Python function parameter list: 'def fn(a, b, /, c, d):'?
Question 35 of 75
Chapter 3
What does an asterisk '*' by itself indicate in a function parameter list: 'def fn(a, *, b, c):'?
Question 36 of 75
Chapter 3
What is the result of running this closure?
def outer(x):
def inner(y):
return x + y
return inner
f = outer(10)
print(f(5))
def outer(x):
def inner(y):
return x + y
return inner
f = outer(10)
print(f(5))
def outer(x):
def inner(y):
return x + y
return inner
f = outer(10)
print(f(5))
Question 37 of 75
Chapter 3
What keyword is required to modify a variable in an enclosing (non-global) scope inside a nested function?
Question 38 of 75
Chapter 3
What will be printed when passing a function to map()?
nums = [1, 2, 3]
res = map(lambda x: x * 10, nums)
print(type(res))
nums = [1, 2, 3]
res = map(lambda x: x * 10, nums)
print(type(res))
nums = [1, 2, 3]
res = map(lambda x: x * 10, nums)
print(type(res))
Question 39 of 75
Chapter 3
What does the 'functools.lru_cache(maxsize=128)' decorator do?
Question 40 of 75
Chapter 3
What will be the output of the following reduce operation?
from functools import reduce
print(reduce(lambda a, b: a * b, [1, 2, 3, 4]))
from functools import reduce
print(reduce(lambda a, b: a * b, [1, 2, 3, 4]))
from functools import reduce
print(reduce(lambda a, b: a * b, [1, 2, 3, 4]))
Question 41 of 75
Chapter 3
What is the return value of a Python function that executes without reaching an explicit 'return' statement?
Question 42 of 75
Chapter 3
How can you unpack a dictionary of keyword arguments into a function call?
Question 43 of 75
Chapter 3
What happens when using a function decorator with syntax:
@my_decorator
def my_func(): …
@my_decorator
def my_func(): …
Question 44 of 75
Chapter 3
What is the type of '*args' inside a function definition: 'def fn(*args):'?
Question 45 of 75
Chapter 3
What will be printed by the following code?
def func(a, b=2, c=3):
return a + b + c
print(func(10, c=5))
def func(a, b=2, c=3):
return a + b + c
print(func(10, c=5))
def func(a, b=2, c=3):
return a + b + c
print(func(10, c=5))Curriculum Track • Module 4 of 5
Chapter 4: OOP, Inheritance & Magic (Dunder) Methods (Q46 – Q60)
Question 46 of 75
Chapter 4
What is the difference between '__str__' and '__repr__' in Python classes?
Question 47 of 75
Chapter 4
What algorithm does Python use to determine Method Resolution Order (MRO) in multiple inheritance?
Question 48 of 75
Chapter 4
What does the '@classmethod' decorator do compared to a regular instance method?
Question 49 of 75
Chapter 4
What magic method is called when an object is used as a context manager in a 'with' statement?
Question 50 of 75
Chapter 4
What is the purpose of 'super()' in Python class hierarchies?
Question 51 of 75
Chapter 4
What is the difference between '__init__' and '__new__' in Python?
Question 52 of 75
Chapter 4
What is 'Name Mangling' in Python when attribute identifiers begin with double underscores (e.g., '__secret')?
Question 53 of 75
Chapter 4
What does the '@property' decorator achieve?
Question 54 of 75
Chapter 4
What does the '__call__' magic method allow an instance of a Python class to do?
Question 55 of 75
Chapter 4
What is a 'Metaclass' in Python?
Question 56 of 75
Chapter 4
Which module in Python's standard library provides the '@dataclass' decorator (introduced in Python 3.7)?
Question 57 of 75
Chapter 4
What magic method must be implemented to support the 'len(obj)' function on custom objects?
Question 58 of 75
Chapter 4
What is the purpose of 'abc.ABC' and '@abc.abstractmethod' in Python?
Question 59 of 75
Chapter 4
What does '__getitem__' allow an object to do?
Question 60 of 75
Chapter 4
What built-in function checks whether an object is an instance of a class or a tuple of classes?
Curriculum Track • Module 5 of 5
Chapter 5: Generators, Iterators, Exceptions & File I/O (Q61 – Q75)
Question 61 of 75
Chapter 5
What keyword transforms a regular Python function into a generator function?
Question 62 of 75
Chapter 5
What does 'yield from iterable' do in Python 3.3+?
Question 63 of 75
Chapter 5
What block is guaranteed to execute whether an exception is raised or not in a try-except structure?
Question 64 of 75
Chapter 5
What is the recommended modern mode to open files for automatic cleanup in Python?
Question 65 of 75
Chapter 5
What is Exception Chaining in Python 3, using 'raise NewException from OriginalException'?
Question 66 of 75
Chapter 5
What does calling 'next(iterator, default)' do when the iterator is exhausted?
Question 67 of 75
Chapter 5
What is the purpose of the 'sys.intern()' function in Python?
Question 68 of 75
Chapter 5
Which module provides high-level object serialization into binary streams in Python?
Question 69 of 75
Chapter 5
What method on a generator object allows sending a value back into the generator where it was paused at a yield expression?
Question 70 of 75
Chapter 5
What is the difference between 'read()', 'readline()', and 'readlines()' on file objects?
Question 71 of 75
Chapter 5
What built-in exception is raised when an imported module or from-import name cannot be found?
Question 72 of 75
Chapter 5
What is the Global Interpreter Lock (GIL) in standard CPython?
Question 73 of 75
Chapter 5
What is the purpose of 'weakref' in Python?
Question 74 of 75
Chapter 5
What does the 'os.scandir()' function provide over 'os.listdir()' in file system traversal?
Question 75 of 75
Chapter 5
What will be printed when running this generator?
def countdown(n):
while n > 0:
yield n
n -= 1
print(list(countdown(3)))
def countdown(n):
while n > 0:
yield n
n -= 1
print(list(countdown(3)))
def countdown(n):
while n > 0:
yield n
n -= 1
print(list(countdown(3)))Explore Other Comprehensive 75-Question Subject Tracks
Continue your preparation across our active curriculum tracks. Every track provides 75 verified questions across 5 complete chapters.
🟢 100% Live Track
C Programming
75 Qs • 5 Chapters • Practice Now →
Active Track
📍 Python Programming
75 Qs • 5 Chapters (You are here)
🟢 100% Live Track
Data Structures
75 Qs • 5 Chapters • Practice Now →
🟢 100% Live Track
DBMS & SQL
75 Qs • 5 Chapters • Practice Now →
🟢 100% Live Track
Computer Networks
75 Qs • 5 Chapters • Practice Now →
🟢 100% Live Track
Operating Systems
75 Qs • 5 Chapters • Practice Now →
🟢 100% Live Track
Quantitative Aptitude
75 Qs • 5 Chapters • Practice Now →