Class 12 Questions : Function Set 3 3

11.
Which of these is not true about recursion?

a)Making the code look clean
b)A complex task can be broken into sub-problems
c)Recursive calls take up less memory
d)Sequence generation is easier than a nested iteration

 

12.
What is the output of the following piece of code?

def a(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return a(n-1)+a(n-2)
for i in range(0,4):
    print(a(i),end=" ")

a)0 1 2 3
b)An exception is thrown
c)0 1 1 2 3
d)0 1 1 2

13.
What would be the output of the following code?

 

def func(n):
   z="".join(n)
   print(z)

str1=["Hello","How","Are","You"]
func(str1) 

14.
What will following code print?

 

def addEm(x,y,z):
	print(x+y+z)
def(prod(x,y,z)
	return(x*y*z)
a=addEm(6,16,26)
b=prod(2,3,6)
print(a,b)

15.
Following code intends to add a given value to global variable a. what will the following code produce?

 

def increase(x):
    a=a+x
    print(a)
    return
a=20
b=5
increase(b)
print(a)