Logo

Python Questions Set 40:

Quiz Mode

 What is the value returned by math.floor(3.4)? 

1
2
3
4

Solution:

 

Is the following Python code valid?

a,b=1,2,3

1
2

Solution:

Find the output of the following code:


d={'a':1,'b':2,'c':3,'d':4}

print(list(d))

Solution:

 To add a new element to a list we use which command? 

1
2

Solution:

 

What will be the output of the following Python code?

['f', 't'][bool('spam')]

1
2
3
4

Solution:

In the following Python code, which of the following is an "argument" to a function?

x = 'banana'

y = max(x)

z = y * 2

1
2
3
4

Solution:

Given the following code:

a = [1, 2, 3, 4, 5]

b = 1 + 2 + 3 + 4 + 5

c = sum(a)

What will the output of print(b == c) be?

1
2
3
4

Solution:

 

Which Of The Following Statements Can Be Used To Check, Whether An Object “Obj” Is An Instance Of Class A Or Not?

1
2
3

Solution:

Which module is required to create an abstract class in Python?

1
2
3
4

Solution:

What type of inheritance is this?

class A():
pass
class B():
pass
class C(A, B):
pass

1
2
3
4

Solution: