Logo

Python Questions Set 193:

Quiz Mode

 Suppose list1 is [1, 5, 9], what is sum(list1)? 

1
2

Solution:

--------------   function is used to add data to the list 

Solution:

 What is displayed on executing print(math.fabs(-3.4))? 

1
2
3
4

Solution:

 Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]? 

1
2

Solution:

What is the output of the following Python code snippet?

abc="therewasatime"

abc[:3]

1
2
3
4

Solution:

 

What will be the output of the following Python code?


 x = [12, 34]

 print(len(' '.join(list(map(int, x))))) 

1
2
3
4

Solution:

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

x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'

1
2
3
4

Solution:

 

If return statement is not used inside the function, the function will return:


1
2
3
4

Solution:

v1 = "\neither"

v2 = "\there"

v3 = "\nor"

v4 = "\there"

print "%s %r %r %s" %(v1,v2,v3,v4) 

1
2
3
4

Solution:

 

What Is The Output Of The Following Code Snippet?

def heading(str):
   print ("+++%s+++" % str)
heading.id = 1
heading.text = "Python functions"
heading("%d %s" % (heading.id, heading.text))

1
2
3
4

Solution: