Class 12 Questions : Function Set 1

1.
Which of the following is the use of function in python?

a) Functions are reusable pieces of programs
b) Functions don’t provide better modularity for your application
c) you can’t also create your own functions
d) All of the mentioned

 

2.
Which keyword is use for function?

a) fun
b) define
c) def
d) function

 

3.
What is the output of the below program?

def printMax(a, b):
      if a > b:
         print(a, ‘is maximum’)
      elif a == b:
         print(a, ‘is equal to’, b)
      else:
         print(b, ‘is maximum’)
printMax(3, 4)

a) 3
b) 4
c) 4 is maximum
d) None of the mentioned

 

4.
What is the output of the below program?

def sayHello():
    print('Hello World!') 
sayHello() 
sayHello()

a)
Hello World!
Hello World!
b)
‘Hello World!’
‘Hello World!’
c)
Hello
Hello
d) None of the mentioned

 

5.
What is the output of the below program ?
x = 50
def func(x):
#print(‘x is’, x)
x = 2
#print(‘Changed local x to’, x)
func(x)
print(‘x is now’, x)

a) x is now 50
b) x is now 2
c) x is now 100
d) None of the mentioned

 

Number Of Visitors

0125584