SWAYAM Assignment 9
SWAYAM Assignment 9
Programming in Python
Assignment 9 due: 20.04.24
1. Which of the following is a built-in function in Python?
• a. def
• b. lambda
• c. return
• d. yield
• Answer: def
2. Which of the following statements is true about functions in Python?
pythonCopy code
def add(x, y): return x+10, y+10 result = add(14, 15) print(result)
• a. (24, 25)
• b. (14, 15)
• c. 49
• d. Error
• b. my_function(a, b)
• c. my_function(a b)
• d. my_function(a b)
• Answer: b. my_function(a, b)
7. What is the output of the following code?
pythonCopy code
def outer_func(x, y): def inner_func(m, n): return m + n return inner_func(x, y) return x result =
outer_func(5, 10) print(result)
• a. 15
• b. 5
• c. 10
• d. 50
• Answer: a. 15
8. What is the purpose of the *args parameter in a function definition?
• b. lambda x: x + 1
• c. lambda(x): return x + 1
• d. function lambda(x): return x + 1
• Answer: b. lambda x: x + 1
10. What will be the output of the following code?
pythonCopy code
• a. Apple
• b. Mango
• c. Banana
• d. Kiwi
• Answer: a. Apple