Logo

Python Questions Set 113:

Quiz Mode

x=6

x++

1
2
3

Solution:

 In which direction is the turtle pointed by default? 

1
2
3
4

Solution:

The output of the function len("abc") and sys.getsize("abc") will be same?

1
2

Solution:

Which of the following expressions will evaluate to True?

1
2
3
4

Solution:

What does math.sqrt(X) do?

1
2
3
4

Solution:

Is the following Python code correct?

>>> class A:
def __init__(self, b):
self.b = b
def display(self):
print(self.b)
>>> obj = A("Hello")
>>> del obj

1
2

Solution:

 

What is the output of the following code?

def foo(i, x=[]):
   x.append(i)
   return x
for i in range(3):
   print(foo(i))

1
2
3
4

Solution:

 

What will be the output of the following Python code?

myList = [1, 5, 5, 5, 5, 1]

max = myList[0]

indexOfMax = 0

for i in range(1, len(myList)):

if myList[i] > max:

       max = myList[i]

       indexOfMax = i

>>>print(indexOfMax)

1
2

Solution:

What will be the output of the following Python code?

>>> class demo():
def __repr__(self):
return '__repr__ built-in function called'
def __str__(self):
return '__str__ built-in function called'
>>> s=demo()
>>> s

1
2
3
4

Solution:

What will be the output of the following Python code?

class A:
def test(self):
print("test of A called")
class B(A):
def test(self):
print("test of B called")
super().test()
class C(A):
def test(self):
print("test of C called")
super().test()
class D(B,C):
def test2(self):
print("test of D called")
obj=D()
obj.test()

1
2
3
4

Solution: