What will be the output of the following Python code snippet?
for i in ''.join(reversed(list('abcd'))):
print (i)1.a b c d
2.d c b a
3. error
4. None of the mentioned
What will be the output of the following Python code snippet?
for i in [1, 2, 3, 4][::-1]:
print (i)1.1 2 3 4
2.4 3 2 1
3.error
4.none of the mentioned
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for i in d:
print(i)1. 0 1 2
2.a b c
3. 0 a 1 b 2 c
4.none of the mentioned
What will be the output of the following Python code?
i = 1
while False:
if i%2 == 0:
break
print(i)
i += 21.1
2.1 3 5 7 …
3. 1 2 3 4 …
4. None of the mentioned
What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)1. [‘ab’, ‘cd’]
2. [‘AB’, ‘CD’]
3.[None, None]
4.none of the mentioned
What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)1.[‘AB’, ‘CD’]
2.[‘ab’, ‘cd’, ‘AB’, ‘CD’]
3. [‘ab’, ‘cd’]
4. None of the mentioned
What will be the output of the following Python code snippet?
for i in '':
print (i)1.None
2.(nothing is printed)
3.error
4.none of the mentioned
What will be the output of the following Python code snippet?
for i in 'abcd'[::-1]:
print (i)1. a b c d
2.d c b a
3. error
4.none of the mentioned
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
i.upper()
print (x)1.a b c d
2. 0 1 2 3
3.error
4.none of the mentioned
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
i[x].upper()
print (x)1. abcd
2.ABCD
3.error
4.none of the mentioned
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'1.a
2.abcd abcd abcd abcd
3. a a a a
4. None of the mentioned
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
x = 'a'
print(x)1. a
2.abcd abcd abcd
3. a a a a
4.none of the mentioned
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
x[i].upper()
print (x)1.abcd
2.ABCD
3.error
4. None of the mentioned
What will be the output of the following Python code snippet?
x = 2
for i in range(x):
x += 1
print (x)1. 0 1 2 3 4 …
2.0 1
3.3 4
4. 0 1 2 3
What will be the output of the following Python code snippet?
x = 2
for i in range(x):
x -= 2
print (x)1. 0 1 2 3 4 …
2. 0 -2
3.0
4.error
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d.values():
print(x)1.0 1 2
2.None None None
3. error
4. None of the mentioned
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d:
print(d.add(x))1. 0 1 2
2. 0 1 2 0 1 2 0 1 2 …
3.None None None
4.none of the mentioned
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d:
print(x)1. 0 1 2
2.{0, 1, 2} {0, 1, 2} {0, 1, 2}
3.error
4.none of the mentioned
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.keys():
print(d[x])1.0 1 2
2.a b c
3.0 a 1 b 2 c
4.none of the mentioned
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(d[x])1. 0 1 2
2. a b c
3.0 a 1 b 2 c
4.none of the mentioned
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(x)1.0 1 2
2. a b c
3.0 a 1 b 2 c
4.none of the mentioned
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
print(x, y)1. 0 1 2
2.a b c
3. 0 a 1 b 2 c
4.none of the mentioned
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d:
print(x, y)1. 0 1 2
2.a b c
3. 0 a 1 b 2 c
4. None of the mentioned
What will be the output of the following Python code?
for i in range(0):
print(i)1. 0
2.no output
3.error
4.none of the mentioned
What will be the output of the following Python code?
for i in range(2.0):
print(i)1. 0.0 1.0
2. 0 1
3.error
4.none of the mentioned
What will be the output of the following Python code?
for i in range(5):
if i == 5:
break
else:
print(i)
else:
print("Here")1. 0 1 2 3 4 Here
2.0 1 2 3 4 5 Here
3.0 1 2 3 4
4.1 2 3 4 5
What will be the output of the following Python code?
for i in range(float('inf')):
print (i)1.0.0 0.1 0.2 0.3 …
2.0 1 2 3 …
3.0.0 1.0 2.0 3.0 …
4.none of the mentioned
What will be the output of the following Python code?
for i in range(int(2.0)):
print(i)1.0.0 1.0
2. 0 1
3.error
4.none of the mentioned
What will be the output of the following Python code?
for i in range(int(float('inf'))):
print (i)1.0.0 0.1 0.2 0.3 …
2.0 1 2 3 …
3.0.0 1.0 2.0 3.0 …
4.none of the mentioned
What will be the output of the following Python code?
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)1.0 1 2 3 0
2. 0 1 2 0
3. 0 1 2
4.error
What will be the output of the following Python code?
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)1.0 1 2 0
2.0 1 2
3. error
4.none of the mentioned
What will be the output of the following Python code?
i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 11. 1 2 3 4 5 6
2. 1 2 3 4 5 6 7
3.error
4.none of the mentioned
What will be the output of the following Python code?
i = 1
while True:
if i%2 == 0:
break
print(i)
i += 21.1
2.1 2
3.1 2 3 4 5 6 …
4. 1 3 5 7 9 11 …
What will be the output of the following Python code?
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 21.2 4 6 8 10 …
2.2 4
3. 2 3
4.error
What will be the output of the following Python code?
i = 5
while True:
if i%0O11 == 0:
break
print(i)
i += 11. 5 6 7 8 9 10
2. 5 6 7 8
3. 5 6
4. error
What will be the output of the following Python code?
i = 5
while True:
if i%0O9 == 0:
break
print(i)
i += 11.5 6 7 8
2.5 6 7 8 9
3.5 6 7 8 9 10 11 12 13 14 15 ….
4.error
What will be the output of the following Python code?
i = 5
while True:
if i%0O9 == 0:
break
print(i)
i += 11.5 6 7 8
2.5 6 7 8 9
3.5 6 7 8 9 10 11 12 13 14 15 ….
4.error
What will be the output of the following Python code?
True = False
while True:
print(True)
break1. True
2.False
3. None
4.none of the mentioned
What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
print(i.upper())1.a b c d
2. 0 1 2 3
3. error
4. 1 2 3 4
What will be the output of the following Python code?
x = 'abcd'
for i in range(x):
print(i)1. a b c d
2. 0 1 2 3
3.error
4.none of the mentioned
What will be the output of the following Python code?
x = 'abcd'
for i in x:
print(i)
x.upper()1. a B C D
2.a b c d
3.A B C D
4.error
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
print('i', end = " ")1. no output
2. i i i i i i …
3. a a a a a a …
4.a b c d e f
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")1.no output
2. i i i i i i …
3.a a a a a a …
4.a b c d e f
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
x = x[1:]
print(i, end = " ")1. a a a a a a
2.a
3. no output
4. error
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
x = x[:-1]
print(i, end = " ")1. i i i i i i
2. a a a a a a
3.a a a a a
4.none of the mentioned
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x[1:]:
print(i, end = " ")1. a a a a a a
2. a
3.no output
4. error
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x[:-1]:
print(i, end = " ")1.a a a a a
2.a a a a a a
3. a a a a a a …
4. a
What will be the output of the following Python code?
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")1. no output
2. i i i i i i …
3. a b c d e f
4.abcdef
What will be the output of the following Python code?
x = "abcdef"
while i in x:
print(i, end=" ")1.a b c d e f
2.abcdef
3. i i i i i i …
4.error
What will be the output of the following Python code?
x = 123
for i in x:
print(i)1.1 2 3
2.123
3.error
4.none of the mentioned