Logo

Python Questions Set 48:

Quiz Mode

Find the output of the following code:


l=[6,"a",54,":","b",1]

print(l.index(l[1]))

Solution:

>>> my_tuple = (0, 1, False)

>>> a = any(my_tuple)

>>> print(a)

1
2
3
4

Solution:

 Suppose x is 345.3546, what is format(x, “10.3f”) (_ indicates space). 

1
2

Solution:

Functions defined inside a class are called:

1
2
3
4

Solution:

What will be the output of the following Python code?

int('65.43')

1
2
3
4

Solution:

Which function is used to display the login page again when a login attempt fails?

1
2
3
4

Solution:

What is the output of the following Python code?

>>> a = "Say"

>>> b = "Hello"

>>> print(a, b)

1
2
3
4

Solution:

What will be the output of the following Python code?

>>> a={1,2,3}
>>> b=a
>>> b.remove(3)
>>> a

1
2
3
4

Solution:

What is the output of the following code?


list = [2, -1, 4, -5, -5, -3, 3, -2]

if all(abs(i) < 4 for i in list):

print("IF")

else:

print("ELSE")

1
2
3
4

Solution:

Which of the following statements about lambda functions is false?

1
2
3
4

Solution: