- Home
- All MCQs
All MCQs with Answers · Page 681
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 print(bool([])) in Python?
print(bool([]))
What is the output of the following Python code snippet?
a = [1, 2]
a += [3]
print(a)
a += [3]
print(a)
What is the output of the following Python code snippet?
class A:
def f(self): return 'A'
class B(A):
def f(self): return 'B'
print(B().f())
def f(self): return 'A'
class B(A):
def f(self): return 'B'
print(B().f())
Which class in the csv module reads rows as dictionaries in Python?
What is the output of the following Python code snippet?
import re
print(re.findall(r'[cb]at', 'cat bat rat'))
print(re.findall(r'[cb]at', 'cat bat rat'))
Which pandas function reads a CSV file into a DataFrame in Python?
Which method counts missing values per column in Python?
What does the dir() function do with no arguments in Python?
What is the output of print(list(map(str.lower, ['A', 'B', 'C']))) in Python?
print(list(map(str.lower, ['A', 'B', 'C'])))
What does python -m http.server do?
What does deque(maxlen=3) do when a fourth item is appended in Python?
What is the output of the following Python code snippet?
d = {'a': 2, 'b': 1}
print({v: k for k, v in d.items()})
print({v: k for k, v in d.items()})
Which is called first when creating an instance: __new__ or __init__ in Python?
What is a common use of a classmethod in Python?
What is the output of print('abc'[::2]) in Python?
print('abc'[::2])
What is the output of print(10 ** 100 < float('inf')) in Python?
print(10 ** 100
What is the output of the following Python code snippet?
from collections import namedtuple
P = namedtuple('Point', 'x y')
print(P(1, 2))
P = namedtuple('Point', 'x y')
print(P(1, 2))
What is the difference between loc and iloc in pandas in Python?
Which module offers a thread-safe FIFO queue in Python?
What is the output of print('xxhello'.lstrip('x')) in Python?
print('xxhello'.lstrip('x'))
What is the output of print('Programming'[::-1]) in Python?
print('Programming'[::-1])
What is the output of the following Python code snippet?
a = [1, 2, 3, 4]
a[1:3] = [5, 5]
print(a)
a[1:3] = [5, 5]
print(a)