Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Which are the advantages of functions in python?
Correct Answer is : All of the mentioned
2. What are the two main types of functions?
Correct Answer is : Built-in function & User defined function
3. Where is function defined?
Correct Answer is : All of the mentioned
4. What is called when a function is defined inside a class?
Correct Answer is : Method
5. Which of the following refers to mathematical function?
Correct Answer is : sqrt
6. What is the output of below program?
def cube(x): return x * x * x x = cube(3) print x
Correct Answer is : 27
7. What is the output of the below program?
def C2F(c): return c * 9/5 + 32print C2F(100)print C2F(0)
Correct Answer is : 212
8. What is the output of the below program?
def power(x, y=2): r = 1 for i in range(y): r = r * x return rprint power(3)print power(3, 3)
Correct Answer is : 9
9. What is the output of the below program?
def sum(*args): '''Function returns the sum of all values''' r = 0 for i in args: r += i return rprint sum.__doc__print sum(1, 2, 3)print sum(1, 2, 3, 4, 5)
Correct Answer is : 6
10. Python supports the creation of anonymous functions at runtime, using a construct called __________
Correct Answer is : Lambda
11. What is the output of this program?
y = 6z = lambda x: x * yprint z(8)
Correct Answer is : 48
12. What is the output of below program?
lamb = lambda x: x ** 3print(lamb(5))
Correct Answer is : 125
13. Does Lambda contains return statements?
Correct Answer is : FALSE
14. Lambda is a statement.
Correct Answer is : FALSE
15. Lambda contains block of statements
Correct Answer is : FALSE
16. What is the output of below program?
def f(x, y, z): return x + y + zf(2, 30, 400)
Correct Answer is : 432
17. What is the output of below program?
def writer(): title = 'Sir' name = (lambda x:title + ' ' + x) return name who = writer()who('Arthur')
Correct Answer is : Sir Arthur
18. What is the output of this program?
L = [lambda x: x ** 2, lambda x: x ** 3, lambda x: x ** 4] for f in L: print(f(3))
Correct Answer is : 9
19. What is a variable defined outside a function referred to as?
Correct Answer is : A global variable
20. What is a variable defined inside a function referred to as?