adplus-dvertising

Welcome to the Mapping Functions and Modules MCQs Page

Dive deep into the fascinating world of Mapping Functions and Modules with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Mapping Functions and Modules, a crucial aspect of Python. In this section, you will encounter a diverse range of MCQs that cover various aspects of Mapping Functions and Modules, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Python.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Mapping Functions and Modules. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Python.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Mapping Functions and Modules. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Mapping Functions and Modules MCQs | Page 2 of 21

Explore more Topics under Python

Q11.
Which of the following numbers will not be a part of the output list of the code shown below?
def sf(a):
    return a%3!=0 and a%5!=0
m=filter(sf, range(1, 31))
print(list(m))
Discuss
Answer: (d).10
Q12.
The single line equivalent of the code shown below is:
l=[1, 2, 3, 4, 5]
def f1(x):
    return x<0
m1=filter(f1, l)
print(list(m1))
Discuss
Answer: (a).filter(lambda x:x<0, l)
Q13.
What is the output of the line of code shown below?
list(map((lambda x:x^2), range(10)))
Discuss
Answer: (c).[2, 3, 0, 1, 6, 7, 4, 5, 10, 11]
Q14.
What is the output of the line of code shown below?
list(map((lambda x:x**2), filter((lambda x:x%2==0), range(10))))
Discuss
Answer: (b).[0, 4, 16, 36, 64]
Q15.
The output of the two codes shown below is the same. State whether true or false.
[x**2 for x in range(10)]
list(map((lambda x:x**2), range(10)))
Discuss
Answer: (a).True
Q16.
What is the output of the following?
elements = [0, 1, 2]
def incr(x):
    return x+1
print(list(map(elements, incr)))
Discuss
Answer: (c).error
Q17.
What is the output of the following?
elements = [0, 1, 2]
def incr(x):
    return x+1
print(list(map(incr, elements)))
Discuss
Answer: (a).[1, 2, 3].
Q18.
What is the output of the following?
x = ['ab', 'cd']
print(list(map(upper, x)))
Discuss
Answer: (c).error
Q19.
What is the output of the following?
def to_upper(k):
    return k.upper()
x = ['ab', 'cd']
print(list(map(upper, x)))
Discuss
Answer: (d).error
Q20.
What is the output of the following?
def to_upper(k):
    return k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))
Discuss
Answer: (a).[โ€˜ABโ€™, โ€˜CDโ€™].

Suggested Topics

Are you eager to expand your knowledge beyond Python? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!