Logo

Python Questions Set 27:

Quiz Mode

 

What is the output of the following program?

result = lambda x: x * x
print(result(5))

1
2
3
4

Solution:

 What will be the output of the following Python expression if x=56.236?

print("%.2f"%x)

1
2
3
4

Solution:

Which of the following is the correct way to find the elements that are present in set a but not in set b?

1
2
3
4

Solution:

What is the output of the following Python code?

g = (i for i in range(5))
print(type(g))

1
2
3
4

Solution:

 

What Is The Output Of The Following Code Snippet?

def test_var_args(param1, *args):
  print (type(args))

test_var_args('delhi', 'noida', 'gurgaon', 'ghaziabad')

1
2
3
4

Solution:

     

What will be the output of the following Python code?


re.split(r'(n\d)=', 'n1=3.1, n2=5, n3=4.565')

1
2
3
4

Solution:

 Which of the following statements is false about recursion?
 

1
2
3
4

Solution:

Assume that value 4 has memory address x27, value 3.2 has memory address x5, and value 8 has memory address x1. Which of the following is true after this code is executed?

>>> a = 4

>>> b = 3.2

>>> a = 8

1
2
3
4

Solution:

What will be the output of the following Python code?

class objects:
def __init__(self):
self.colour = None
self._shape = "Circle"

def display(self, s):
self._shape = s
obj=objects()
print(obj._shape)

1
2
3
4

Solution: