1. What is the output of the following?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
Correct Answer is : [‘ab’, ‘cd’].
2. What is the output of the following?
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
Correct Answer is : none of the mentioned
3. What is the output of the following?
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1
Correct Answer is : error
4. What is the output of the following?
i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 1
Correct Answer is : 1 2 3 4 5 6
5. What is the output of the following?
i = 5
while True:
if i%0O11 == 0:
break
print(i)
i += 1
Correct Answer is : 5 6 7 8
6. What is the output of the following?
i = 5
while True:
if i%0O9 == 0:
break
print(i)
i += 1
Correct Answer is : error
7. What is the output of the following?
i = 1
while True:
if i%2 == 0:
break
print(i)
i += 2
Correct Answer is : 1 3 5 7 9 11 …
8. What is the output of the following?
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
Correct Answer is : 45326
9. What is the output of the following?
i = 1
while False:
if i%2 == 0:
break
print(i)
i += 2
Correct Answer is : none of the mentioned
10. What is the output of the following?
True = False
while True:
print(True)
break
Correct Answer is : none of the mentioned
11. What is the output of the following?
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
Correct Answer is : 36527
12. What is the output of the following?
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
Correct Answer is : 0 1 2 0
13. What is the output of the following?
x = "abcdef"
while i in x:
print(i, end=" ")
Correct Answer is : error
14. What is the output of the following?
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")
Correct Answer is : no output
15. What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
Correct Answer is : a a a a a a …
16. What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
print('i', end = " ")
Correct Answer is : i i i i i i …
17. What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
x = x[:-1]
print(i, end = " ")
Correct Answer is : a a a a a a
18. What is the output of the following?
x = "abcdef"
i = "a"
while i in x[:-1]:
print(i, end = " ")
Correct Answer is : a a a a a a …
19. What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
x = x[1:]
print(i, end = " ")
20. What is the output of the following?
x = "abcdef"
i = "a"
while i in x[1:]:
print(i, end = " ")
Correct Answer is : no output