- Home
- MCQs by exam
- Python Interview Advanced
- Data Science
Python Interview Advanced MCQs – Data Science
48 multiple choice questions typical of the Python Interview Advanced exam, with answers and explanations. Switch on practice mode to test yourself first.
What is the output of print(sum(i for i in [1, 2, 3])) in Python?
print(sum(i for i in [1, 2, 3]))
What is the output of print(sum(1 for c in 'banana' if c == 'n')) in Python?
print(sum(1 for c in 'banana' if c == 'n'))
What does del x do in Python?
What is the output of the following Python code snippet?
from itertools import permutations
print(len(list(permutations([1, 2, 3]))))
print(len(list(permutations([1, 2, 3]))))
What is the output of the following Python code snippet?
from functools import lru_cache
@lru_cache(None)
def fib(n):
return n if n
Which tool formats Python code automatically with an uncompromising style?
What is the output of print(pow(6, 2, 10)) in Python?
print(pow(6, 2, 10))
What does the gc module control in Python?
What is the time complexity of Python's built-in sort?
What does Optional[int] mean in a type hint in Python?
What is the output of the following Python code snippet?
from itertools import cycle, islice
print(list(islice(cycle([1, 2]), 4)))
print(list(islice(cycle([1, 2]), 4)))
What is the output of the following Python code snippet?
from collections import deque
d = deque([1, 2])
d.appendleft(0)
print(d)
d = deque([1, 2])
d.appendleft(0)
print(d)
Which class provides a high-level interface for thread and process pools in Python?
What is a race condition in Python?
What is the output of the following Python code snippet?
from itertools import accumulate
print(list(accumulate([1, 2, 3])))
print(list(accumulate([1, 2, 3])))
What is the right way to pause inside a coroutine without blocking the event loop in Python?
What is the output of the following Python code snippet?
from collections import deque
d = deque([1, 2, 3])
d.rotate(1)
print(d)
d = deque([1, 2, 3])
d.rotate(1)
print(d)
What does int | None mean in a type hint (Python 3.10+)?
Which collections type provides O(1) appends and pops from both ends in Python?
Which sorting algorithm does Python's sorted() use?
What is the output of print(sorted('listen') == sorted('silent')) in Python?
print(sorted('listen') == sorted('silent'))
What is the output of print(sum(x for x in range(5))) in Python?
print(sum(x for x in range(5)))