- Home
- All MCQs
All MCQs with Answers · Page 687
43,842 multiple choice questions from every subject, newest first. Switch on practice mode to hide the answers and test yourself.
Which built-in returns a function's documentation string in Python?
What is the output of the following Python code snippet?
try:
1 / 0
except ZeroDivisionError:
print('Cannot divide by zero')
1 / 0
except ZeroDivisionError:
print('Cannot divide by zero')
What is the maximum value of an int in Python 3?
What is the output of print('42'.zfill(5)) in Python?
print('42'.zfill(5))
Which mode opens a file for appending text in Python?
What is the output of the following Python code snippet?
x = 3
print('big' if x > 5 else 'small')
print('big' if x > 5 else 'small')
What is the output of print(f'{3.14159:.2f}') in Python?
print(f'{3.14159:.2f}')
What is the output of the following Python code snippet?
def f(a, b):
return a * b
print(f(b=5, a=3))
return a * b
print(f(b=5, a=3))
What is the output of print([1, 2] * 2) in Python?
print([1, 2] * 2)
Which Python version introduced f-strings?
What exception is raised when the recursion limit is exceeded in Python?
What does the @dataclass decorator generate automatically in Python?
What is the difference between __str__ and __repr__ in Python?
Which statement about tuples and lists is correct in Python?
Which method splits a string into lines in Python?
What does the Zen of Python state is better than complex?
Who created the Python programming language?
What is the output of print([10, 20, 30, 40][1:3]) in Python?
print([10, 20, 30, 40][1:3])
What is the output of print(all([])) in Python?
print(all([]))
What is the output of the following Python code snippet?
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
def __repr__(self):
return f'Point({self.x}, {self.y})'
print(Point(1, 2))
def __init__(self, x, y):
self.x, self.y = x, y
def __repr__(self):
return f'Point({self.x}, {self.y})'
print(Point(1, 2))
What does asyncio.run() do in Python?
What does a docstring do in Python?
What is the output of the following Python code snippet?
d = {'a': 1}
print(d.get('z'))
print(d.get('z'))