My Report

Python Function Test – 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What will be the output of the following Python code?

L = [lambda x: x ** 2,
         lambda x: x ** 3,
         lambda x: x ** 4]

for f in L:
	print(f(3))

2. What will be the output of the following Python code?

min = (lambda x, y: x if x < y else y)
 min(101*99, 102*98)

3. What will be the output of the following Python code?

y = 6
z = lambda x: x * y
print z(8)

4. What will be the output of the following Python code?

lamb = lambda x: x ** 3
print(lamb(5))

5. Does Lambda contains return statements?

6. Lambda contains block of statements.

7. Python supports the creation of anonymous functions at runtime, using a construct called __________

8. Lambda is a statement.

9. What will be the output of the following Python code?

def writer():
	title = 'Sir'
	name = (lambda x:title + ' ' + x)
	return name

who = writer()
print(who('Arthur'))

10. What will be the output of the following Python code?

def f(x, y, z): return x + y + z
f(2, 30, 400)

 

Start practicing “1000 MCQs on Python”, and once you are ready, you can take tests on all topics by attempting our “Python Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.