- Home
- All MCQs
All MCQs with Answers · Page 680
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 the following Python code snippet?
from decimal import Decimal
print(Decimal('0.1') + Decimal('0.2'))
print(Decimal('0.1') + Decimal('0.2'))
Which sorting algorithm does Python's sorted() use?
What is pyproject.toml used for in Python?
What is the output of print({'a'} <= {'a': 1, 'b': 2}.keys()) in Python?
print({'a'}
What is the output of the following Python code snippet?
d = {'a': 3, 'b': 1, 'c': 2}
print(sorted(d, key=d.get))
print(sorted(d, key=d.get))
What is the output of the following Python code snippet?
class A:
@classmethod
def f(cls): return 'Cls'
print(A.f())
@classmethod
def f(cls): return 'Cls'
print(A.f())
What is the Singleton pattern in Python?
What is the output of print('hi'.encode()) in Python?
print('hi'.encode())
What is the output of print(sorted('listen') == sorted('silent')) in Python?
print(sorted('listen') == sorted('silent'))
What is the output of the following Python code snippet?
class A:
def __init__(self): self.x = 1
print(A().__dict__)
def __init__(self): self.x = 1
print(A().__dict__)
What is the end of life status of Python 2?
What is the default encoding for str.encode() in Python 3?
What is the output of print(sum(x for x in range(5))) in Python?
print(sum(x for x in range(5)))
Which module provides type hint helpers such as List, Optional and Union in Python?
What is the output of print(float('nan') == float('nan')) in Python?
print(float('nan') == float('nan'))
What is the output of print('{1} and {0}'.format(20, 10)) in Python?
print('{1} and {0}'.format(20, 10))
Which pandas method groups data for aggregation in Python?
What does @dataclass(frozen=True) do in Python?
What does asyncio.gather() do in Python?
What is broadcasting in NumPy in Python?
What is the output of the following Python code snippet?
x = 5
print(f'{x = }')
print(f'{x = }')
What does yield from do in Python?
What is the output of the following Python code snippet?
class CM:
def __enter__(self):
print('enter', end=' ')
def __exit__(self, *a):
print('exit')
with CM():
pass
def __enter__(self):
print('enter', end=' ')
def __exit__(self, *a):
print('exit')
with CM():
pass