- What will be the output of the following Python code ?
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)
- 3
- 4
- 4 is maximum
- None of the mentioned
- What is the output of the following code ?
x = 50
def func (x) :
x = 2
func (x)
print ('x is now', x)
- x is now 50
- x is now 2
- x is now 100
- Error
- What is the output of the following code ?
def disp(*arg):
for i in arg:
print(i)
disp(name="Rajat", age="20")
- TypeError
- Rajat 20
- Name age
- None of these
- What is the return type of following function ?
def func1():
return 'mnp',22
- List
- dictionary
- string
- tuple
- What is the output of the following code ?
def fun(a, b=6):
a=a+b
print(a)
fun(5, 4)
- 11
- 9
- 5
- 4
- An algorithm that calls itself directly or indirectly is called as __________.
- Sub Function
- Recursion
- Reverse Polish Notation
- Reverse Polish Notation
- Function defined to achieve some task as per the programmer‟s requirement is called a __________.
- user defined function
- library function
- built in functions
- All of the above.
- Which of the following is not a keyword ?
- eval
- nonlocal
- assert
- finally
- What will be the output of the following ?
def iq(a,b):
if(a==0):
return b
else:
return iq(a-1,a+b)
print(iq(3,6))
- 9
- 10
- 11
- 12
- What will be the output of the following Python code ?
def C2F(c) :
return c*9/5+32
print (C2F(100))
print (C2F(0))
- 212.0
32.0
- 212
32
- 314
32.0
- 567
32.0
- Which of the following statement will execute in last ?
def s(n1): #Statement 1
print(n1) #Statement 2
n2=4 #Statement 3
s(n2) #Statement 4
- Statement 1
- Statement 2
- Statement 3
- Statement 4
- What is the output of following code ?
def func(a, b=5, c=10) :
print('a is', a, 'and b is', b, 'and c is', c)
func(3, 7)
func(25, c = 24)
func(c = 50, a = 100)
- a is 7 and b is 3 and c is 10
a is 25 and b is 5 and c is 24
a is 5 and b is 100 and c is 50
- a is 3 and b is 7 and c is 10
a is 5 and b is 25 and c is 24
a is 50 and b is 100 and c is 5
- a is 3 and b is 7 and c is 10
a is 25 and b is 5 and c is 24
a is 100 and b is 5 and c is 50
- None of the mentioned
- What will be the output of the following Python code ?
x = 50
def func(x):
print('x is', x)
x = 2
print('Changed local x to', x)
func(x)
print('x is now', x)
- x is 50
Changed local x to 2
x is now 50
- x is 50
Changed local x to 2
x is now 2
- x is 50
Changed local x to 2
x is now 100
- None of Above.
- Which one of the following is the correct way of calling a function
- function_name()
- call function_name()
- ret function_name()
- function function_name()
- If a function does not have a return statement, which of the following does the function return ?
- int
- null
- An exception is thrown without return
- None