- Home
- All MCQs
All MCQs with Answers · Page 738
45,334 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([x for x in [1, 2, 3] if x > 1]) in Python?
print([x for x in [1, 2, 3] if x > 1])
What does time.time() return 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 print(dict.fromkeys(['a', 'b'])) in Python?
print(dict.fromkeys(['a', 'b']))
What is the output of print(len(max(['a', 'abc', 'ab'], key=len))) in Python?
print(len(max(['a', 'abc', 'ab'], key=len)))
What is the output of the following Python code snippet?
fs = [lambda: i for i in range(3)]
print([f() for f in fs])
print([f() for f in fs])
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 Python implementation uses a just-in-time (JIT) compiler for speed?
Which class provides a high-level interface for thread and process pools in Python?
Which built-in module lets you work with SQLite databases in Python?
What is the output of the following Python code snippet?
from datetime import date
print((date(2024, 1, 8) - date(2024, 1, 1)).days)
print((date(2024, 1, 8) - date(2024, 1, 1)).days)
What is the difference between bytes and bytearray 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])))
Which module runs external commands and captures their output in Python?
Which function is recommended for measuring elapsed time precisely in Python?
What is the output of the following Python code snippet?
try:
[].pop()
except IndexError:
print('IndexError')
[].pop()
except IndexError:
print('IndexError')
What is composition in OOP in Python?
What is the output of the following Python code snippet?
from pathlib import Path
print(Path('file.txt').suffix[1:])
print(Path('file.txt').suffix[1:])
What is a metaclass in Python?
What is the output of print([3, 1].sort() == [1, 3]) in Python?
print([3, 1].sort() == [1, 3])
Which library provides machine learning algorithms such as classification and regression in Python?
What is the output of the following Python code snippet?
class M:
@staticmethod
def mul(a, b): return a * b
print(M.mul(3, 4))
@staticmethod
def mul(a, b): return a * b
print(M.mul(3, 4))
What is the output of the following Python code snippet?
x, y = 'ab'
print(x)
print(x)