- Home
- All MCQs
All MCQs with Answers · Page 684
43,842 multiple choice questions from every subject, newest first. Switch on practice mode to hide the answers and test yourself.
What does mypy do in Python?
What is the output of the following Python code snippet?
from functools import wraps
def d(f):
@wraps(f)
def wrapper(): return f()
return wrapper
@d
def hello(): pass
print(hello.__name__)
def d(f):
@wraps(f)
def wrapper(): return f()
return wrapper
@d
def hello(): pass
print(hello.__name__)
What does python -c 'print(1+1)' do?
Which tool is commonly used to manage multiple dependency sets and lock files in modern Python projects?
What is the output of the following Python code snippet?
d = {'a': 1, 'b': 2}
print(d.popitem())
print(d.popitem())
Which module computes hashes like SHA-256 in Python?
What is a memory leak candidate in Python even with garbage collection?
Which approach is generally faster for concatenating many strings in a loop in Python?
What is the output of print(1 << 3) in Python?
print(1
What is the output of the following Python code snippet?
d = {'a': 1, 'b': 2}
try:
for k in d:
d['c'] = 3
except RuntimeError:
print('RuntimeError')
try:
for k in d:
d['c'] = 3
except RuntimeError:
print('RuntimeError')
What does os.environ provide in Python?
What is the output of the following Python code snippet?
class A:
def __init__(self): print('A init')
class B(A):
def __init__(self): print('B init')
B()
def __init__(self): print('A init')
class B(A):
def __init__(self): print('B init')
B()
What does sys.argv contain in Python?
Which module offers object-oriented filesystem paths in Python?
What is the output of the following Python code snippet?
a = [1, 2, 3]
a.remove(2)
print(a)
a.remove(2)
print(a)
What does del a[0] do on a list a in Python?
What is the output of the following Python code snippet?
for i, c in enumerate('ab'):
print(c, i)
print(c, i)
What is the output of print((1, 2, 1, 3, 1).count(1)) in Python?
print((1, 2, 1, 3, 1).count(1))
What is the output of the following Python code snippet?
a = 256; b = 256
x = [1]; y = [1]
print(a is b, x is y)
x = [1]; y = [1]
print(a is b, x is y)
What is the data type of the value True in Python?
Which method reads the entire content of a file as a string in Python?
What does the await keyword do in Python?
What is the output of the following Python code snippet?
a = [1, 2, 3]
a.reverse()
print(a)
a.reverse()
print(a)
What is the output of print((lambda a, b: a * b)(2, 3)) in Python?
print((lambda a, b: a * b)(2, 3))