Logo

Python Questions Set 112:

Quiz Mode

Suppose i is 5 and j is 4, i + j is same as ________ 

1
2
3
4

Solution:

What is the output of the following Python code?

import math

a = 3

b = math.factorial(a)

print(b)

1
2
3
4

Solution:

What will be the output of the following Python code snippet?

z = set('abc$de')
'a' in z

1
2
3
4

Solution:

Which of the following is an advantage of a pure function?

1
2
3
4

Solution:

 

What will be the output of the following Python code snippet?

x=3.3456789
'%s' %x, str(x)

1
2
3

Solution:

What is the output of the given code?


s='Abekus'

s1="Abekus"

s2="""Abekus"""

print(s1)

print(s)

print(s2)

1
2
3

Solution:

 

What will be the output of the following Python code?

points = [[1, 2], [3, 1.5], [0.5, 0.5]]

points.sort()

print(points)

1
2

Solution:

 

What will be the output of the following Python code?


 def foo(i, x=[]):  

   x.append(i)    

 return x

 for i in range(3):    

 print(foo(i)) 

1
2
3
4

Solution:

What will be the output of the following Python code?

print(type(2))
print(type(2.8))
print(type('2.0'))

1
2
3
4

Solution:

 

What will be the output of the following Python code?

#mod1
def change(a):
   b=[x*2 for x in a]
   print(b)
#mod2
def change(a):
   b=[x*x for x in a]
   print(b)
from mod1 import change
from mod2 import change
#main
s=[1,2,3]
change(s)

1
2
3
4

Solution: