Class 12 Questions : Function Set 3 4

16.
Predict the output of thefollowing code fragment?

def func(message,num=1):
    print(message*num)
func('python')
func('easy',3)

 

17.
predict the output of the following code fragment?

def check(n1=1,n2=2):
          n1=n1+n2
          n2+=1
          print(n1,n2)
check()
check(2,1)
check(3)

 

18.
Predict the output for the following code.

total=0
def sum(arg1,arg2):
    total=arg1+arg2
    print("total=",total)
    return total
sum(10,20)
print("total:",total)	

 

19.
What will the following function return if it is called?

def add(a,b,c):
    print(a*b+c)

20.
What will the following function print when called?

def add(a,b,c):
    return(a+b+c)
    print(a+b+c)