Unit 4 Function

5th semester New Syllabus

Unit 4 Function

1 / 7

How do you define a function in Python?

2 / 7

What will be the output of the following code:
def greet(name="World"):
return "Hello, " + name

print(greet())

3 / 7

What will be the output of the following code:
def foo():
x = 10

foo()
print(x)

4 / 7

Which keyword is used to modify the value of a global variable inside a function?

5 / 7

What is a lambda function in Python?

6 / 7

What will be the output of the following code:
add = lambda x, y: x + y
print(add(2, 3))

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))

Your score is

The average score is 0%

0%


function (1)function (2)function (3)function (4)function (5)function (6)function (7)function (8)function (9)function (10)function (11)function (12)function (13)function (14)function (15)function (16)function (17)function (18)function (19)function (20)function (21)function (22)function (23)

function (24)function (25)

Leave a Reply

Your email address will not be published. Required fields are marked *