Explore topic-wise MCQs in Python.

This section includes 2 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.

1.

Write a list comprehension to produce the list: [1, 2, 4, 8, 16 212].

A. [(2**x) for x in range(0, 13)]
B. [(x**2) for x in range(1, 13)]
C. [(2**x) for x in range(1, 13)]
D. [(x**2) for x in range(0, 13)]
Answer» B. [(x**2) for x in range(1, 13)]
2.

What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))?

A. [1|x for x in [1, 2, 3]]
B. [-1**x for x in [1, 2, 3]]
C. [x**-1 for x in [1, 2, 3]]
D. [x^-1 for x in range(4)]
Answer» D. [x^-1 for x in range(4)]