- Home
- Subjects
- Data Science
- Python
Python MCQs · Page 10
595 multiple choice questions with answers in Data Science.
Which approach gives true CPU parallelism in standard CPython?
What is the output of print(bin(5)) in Python?
print(bin(5))
Python is best described as which type of language?
What does random.randint(1, 6) return in Python?
Which of the following is an immutable data type in Python?
What is the output of print({1, 2} - {2, 3}) in Python?
print({1, 2} - {2, 3})
Which functools helper preserves a wrapped function's name and docstring in a decorator in Python?
What is the output of print(round(2.5)) in Python?
print(round(2.5))
What does raise ... from e do in Python?
What is the output of the following Python code snippet?
a = [1, 2, 3]
b = a
b[0] = 99
print(a, b)
b = a
b[0] = 99
print(a, b)
What does __slots__ do in a class in Python?
What does the id() function return in Python?
What does json.dumps() return in Python?
Which special method makes an object usable in a for loop in Python?
How do you remove duplicates from a list while ignoring order in Python?
What is a closure in Python?
What is the output of the following Python code snippet?
a = [1, 2, 3]
a.insert(1, 9)
print(a)
a.insert(1, 9)
print(a)
What is the output of print(0 or 0) in Python?
print(0 or 0)
What is the output of the following Python code snippet?
import copy
a = [1, [2, 3]]
b = copy.copy(a)
b[1][1] = 99
print(a, b)
a = [1, [2, 3]]
b = copy.copy(a)
b[1][1] = 99
print(a, b)
What is the output of the following Python code snippet?
def f(x, lst=[]):
lst.append(x)
return lst
f(1)
print(f(2))
lst.append(x)
return lst
f(1)
print(f(2))
What does functools.partial do in Python?
How does Python define a block of code such as a loop body or function body?
What is the output of print(list(map(lambda x: x * x, [1, 2, 3]))) in Python?
print(list(map(lambda x: x * x, [1, 2, 3])))