What is the ouput for the code?
Anonymous Quiz
34%
[βhatβ,βmatβ,βratβ,βrhymeβ]
25%
βhatmatratrhymeβ
18%
[βhat mat rat rhymeβ]
23%
βhatrhymematrhyme ratβ
Code snippet:
class Count:
def __init__(self, count=0):
self.__count=count
a=Count(2)
b=Count(2)
print(id(a)==id(b), end = '' '')
c= ''hello''
d= ''hello''
print(id(c)==id(d))
What is output of the code above?
Anonymous Quiz
22%
True False
34%
False True
18%
False False
26%
True True
Code snippet:
first = bool('False')
second = bool()
print(str(first) + " " + str(second))What will be the output of the Python code snippet?
Anonymous Quiz
17%
True True
29%
False True
32%
True False
22%
False False
Code snippet:
x = 'abcd'
for i in range(len(x)):
x[i].upper()
print (x)
What is the output of the code snippet above?
Anonymous Quiz
26%
abcd
59%
ABCD
10%
error
6%
none of the mentioned
π1
Code snippet:
D = dict()
for x in enumerate(range(2)):
D[x[0]] = x[1]
D[x[1]+7] = x[0]
print(D)
What is the output of the code?
Anonymous Quiz
21%
{0: 1, 7: 0, 1: 1, 8: 0}
21%
{1: 1, 7: 2, 0: 1, 8: 1}
33%
{0: 0, 7: 0, 1: 1, 8: 1}
25%
KeyError
Code snippet:
class A():
def disp(self):
print("A disp()")
class B(A):
pass
obj = B()
obj.disp()
What is the output of the piece of code?
Anonymous Quiz
15%
Invalid syntax for inheritance
23%
Error because when object is created, argument must be passed
22%
Nothing is printed
40%
A disp()
π1
Code snippet
x=100
def f1():
global x
x=90
def f2():
global x
x=80
print(x)
Code snippet:
class A:
def __init__(self):
self.__i = 1
self.j = 5
def display(self):
print(self.__i, self.j)
class B(A):
def __init__(self):
super().__init__()
self.__i = 2
self.j = 7
c = B()
c.display()
What will be the output of the code?
Anonymous Quiz
32%
False True
18%
False False
18%
True True
33%
True False
Code snippet:
import turtle
t=turtle.Pen()
for i in range(0,4):
t.forward(100)
t.left(120)
What will be the output shape of the code?
Anonymous Quiz
24%
square
39%
rectangle
26%
triangle
12%
kite