Unit 4 Function 5th semester New Syllabus June 13, 2024June 26, 2024BIM NotesLeave a Comment on Unit 4 Function Unit 4 Function 1 / 7 How do you define a function in Python? A) function func(): B) def func(): C) define func(): D) func def(): 2 / 7 What will be the output of the following code:def greet(name="World"): return "Hello, " + nameprint(greet()) A) Hello, World B) Hello, C) Error D) Hello, None 3 / 7 What will be the output of the following code:def foo(): x = 10foo()print(x) A) 10 B) None C) Error D) 0 4 / 7 Which keyword is used to modify the value of a global variable inside a function? A) global B) nonlocal C) extern D) globalvar 5 / 7 What is a lambda function in Python? A) A function defined with the lambda keyword B) A function defined with the def keyword C) A function with no return value D) A function that takes no arguments 6 / 7 What will be the output of the following code:add = lambda x, y: x + yprint(add(2, 3)) A) 5 B) 6 C) 23 D) Error 7 / 7 What will be the output of the following code:def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)print(factorial(3)) A) 6 B) 3 C) 9 D) 1 Your score isThe average score is 0% 0% Restart quiz