Python Quiz

211. What is the output of the following code?

x = [1, 2, 3]
y = x
x.append(4)
print(y)
212. Which of these operations will NOT create a shallow copy of a list `a`?
213. What is the output of:

print(bool(0), bool([]), bool(None))
214. Which built-in module can be used to serialize Python objects?
215. What is the output of:

print([i**2 for i in range(3)])
216. What is the purpose of the `with` statement in Python?
217. Which of these will raise a `TypeError`?
218. What is the output of:

def func(a, b=2, c=3):
    return a + b + c

print(func(1, c=10))
219. Which of the following statements is true about Python sets?
220. What does the `finally` block do in exception handling?

Explore Programming Topics