- Home
- All MCQs
All MCQs with Answers · Page 686
43,842 multiple choice questions from every subject, newest first. Switch on practice mode to hide the answers and test yourself.
What is the output of print({1, 2} - {2, 3}) in Python?
print({1, 2} - {2, 3})
Which functools helper preserves a wrapped function's name and docstring in a decorator in Python?
What is the output of print(round(2.5)) in Python?
print(round(2.5))
What does raise ... from e do in Python?
What is the output of the following Python code snippet?
a = [1, 2, 3]
b = a
b[0] = 99
print(a, b)
b = a
b[0] = 99
print(a, b)
What does __slots__ do in a class in Python?
What does the id() function return in Python?
What does json.dumps() return in Python?
Which special method makes an object usable in a for loop in Python?
How do you remove duplicates from a list while ignoring order in Python?
What is a closure in Python?
What is the output of the following Python code snippet?
a = [1, 2, 3]
a.insert(1, 9)
print(a)
a.insert(1, 9)
print(a)
What is the output of print(0 or 0) in Python?
print(0 or 0)
What is the output of the following Python code snippet?
import copy
a = [1, [2, 3]]
b = copy.copy(a)
b[1][1] = 99
print(a, b)
a = [1, [2, 3]]
b = copy.copy(a)
b[1][1] = 99
print(a, b)
What is the output of the following Python code snippet?
def f(x, lst=[]):
lst.append(x)
return lst
f(1)
print(f(2))
lst.append(x)
return lst
f(1)
print(f(2))
What does functools.partial do in Python?
How does Python define a block of code such as a loop body or function body?
What is the output of print(list(map(lambda x: x * x, [1, 2, 3]))) in Python?
print(list(map(lambda x: x * x, [1, 2, 3])))
Which special method makes len(obj) work in Python?
What is a frozenset in Python?
What is the output of the following Python code snippet?
sq = lambda x: x * x
print(sq(5))
print(sq(5))
What is the output of print(True + True) in Python?
print(True + True)