function_name[]call function_namefunction_name()function_name{}def function_name{}function function_name():def function_name():function_name() =>None0False(){}[]<>my_function(3) if def my_function(a): return a * 2?
36NoneErroryieldreturnoutputsendNone by defaultfunction(param1, param2)function(param1 + param2)function(param1, param2) and store resultdef add(x, y=5): return x + y if called as add(3)?
358lambda function_name():def function_name():lambda x: expressionfunc(x): return expressionmap(lambda x: x * 2, [1, 2, 3])def multiply(x): return x * 2print(lambda x: x * 2)| Qno | Answer (Option with the text) |
|---|---|
| 1 | C) To organize code into reusable blocks |
| 2 | C) function_name() |
| 3 | C) def function_name(): |
| 4 | B) Reuse code and enhance readability |
| 5 | A) None |
| 6 | A) Parentheses () |
| 7 | B) 6 |
| 8 | C) The function’s name and parameters |
| 9 | B) The default value of the argument is used (if defined) |
| 10 | B) The area where a function can be called and accessed |
| 11 | C) A value passed to the function when called |
| 12 | B) return |
| 13 | A) A function can have multiple return statements |
| 14 | B) It returns None by default |
| 15 | C) function(param1, param2) and store result |
| 16 | C) 8 |
| 17 | D) All of the above |
| 18 | C) Arguments |
| 19 | D) Both A and B |
| 20 | A) Yes, by returning a tuple |
| 21 | C) lambda x: expression |
| 22 | B) They can only have one expression |
| 23 | A) They simplify code for small tasks |
| 24 | A) map(lambda x: x * 2, [1, 2, 3]) |
| 25 | A) Yes, by separating parameters with commas |
| 26 | B) Organizing a program into separate, reusable modules |
| 27 | A) By calling functions from other modules |
| 28 | B) It allows for easier debugging and maintenance |
| 29 | B) Independent modules that can be developed and tested separately |
| 30 | B) It allows developers to work on separate modules simultaneously |