Logo

Python Questions Set 143:

Quiz Mode

What is the greatest common divisor (GCD) of 15 and 20?

1
2
3
4

Solution:

 Which of these in not a core data type? 

1
2
3
4

Solution:

What is the output of the following Python code?

print('x\97\x98')

1
2
3
4

Solution:

 What will be output of this expression:
  'p' + 'q' if '12'.isdigit() else 'r' + 's' 

1
2
3
4

Solution:

Which function is used to access the parent class in Python?

1
2
3
4

Solution:

If s = "abcedfgh", what does dir(s) print?

1
2
3

Solution:

What is the output of the following Python code?

def myfunc(a):

    a=a+2

         a=a*2

    return a

print(myfunc(2))

1
2
3
4

Solution:

 

What will be the output of the following Python code?

a=["Apple","Ball","Cobra"]
<br class="blank" />a.sort(key=len)
print(a)

1
2

Solution:

Which of the following is not a valid print statement in Python?

1
2
3
4
5

Solution:

What will be the output of the following code?

class Circle:
def __init__(self, radius):
self.radius = radius

r = Circle(3)
print(round(3.14 * r.radius * r.radius, 2))

1
2
3
4

Solution: