JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Python interview questions part 59
Python interview questions part 59
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is the output of the following? x = ['ab', 'cd'] for i in x: i.upper() print(x)
A. [‘ab’, ‘cd’].
B. [‘AB’, ‘CD’].
C. [None, None].
D. none of the mentioned
Show Correct Answer
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)
A. [‘AB’, ‘CD’].
B. [‘ab’, ‘cd’, ‘AB’, ‘CD’].
C. [‘ab’, ‘cd’].
D. none of the mentioned
Show Correct Answer
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
A. 45293
B. 37623
C. error
D. none of the mentioned
Show Correct Answer
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
A. 1 2 3 4 5 6
B. 1 2 3 4 5 6 7
C. error
D. none of the mentioned
Show Correct Answer
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
A. 5 6 7 8 9 10
B. 5 6 7 8
C. 45418
D. error
Show Correct Answer
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
A. 5 6 7 8
B. 5 6 7 8 9
C. 5 6 7 8 9 10 11 12 13 14 15 ….
D. error
Show Correct Answer
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
A. 1
B. 45293
C. 1 2 3 4 5 6 …
D. 1 3 5 7 9 11 …
Show Correct Answer
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
A. 2 4 6 8 10 …
B. 45326
C. 45325
D. error
Show Correct Answer
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
A. 1
B. 1 3 5 7 …
C. 1 2 3 4 …
D. none of the mentioned
Show Correct Answer
Correct Answer is :
none of the mentioned
10. What is the output of the following? True = False while True: print(True) break
A. TRUE
B. FALSE
C. None
D. none of the mentioned
Show Correct Answer
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)
A. 0 1 2 0
B. 36527
C. error
D. none of the mentioned
Show Correct Answer
Correct Answer is :
36527
12. What is the output of the following? i = 0 while i < 3: print(i) i += 1 else: print(0)
A. 0 1 2 3 0
B. 0 1 2 0
C. 36527
D.
Show Correct Answer
Correct Answer is :
0 1 2 0
13. What is the output of the following? x = "abcdef" while i in x: print(i, end=" ")
A. a b c d e f
B. abcdef
C. i i i i i i …
D. error
Show Correct Answer
Correct Answer is :
error
14. What is the output of the following? x = "abcdef" i = "i" while i in x: print(i, end=" ")
A. no output
B. i i i i i i …
C. a b c d e f
D. abcdef
Show Correct Answer
Correct Answer is :
no output
15. What is the output of the following? x = "abcdef" i = "a" while i in x: print(i, end = " ")
A. no output
B. i i i i i i …
C. a a a a a a …
D. a b c d e f
Show Correct Answer
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 = " ")
A. no output
B. i i i i i i …
C. a a a a a a …
D. a b c d e f
Show Correct Answer
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 = " ")
A. i i i i i i
B. a a a a a a
C. a a a a a
D. none of the mentioned
Show Correct Answer
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 = " ")
A. a a a a a
B. a a a a a a
C. a a a a a a …
D. a
Show Correct Answer
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 = " ")
A. a a a a a a
B. a
C. no output
D. error
Show Correct Answer
Correct Answer is :
a
20. What is the output of the following? x = "abcdef" i = "a" while i in x[1:]: print(i, end = " ")
A. a a a a a a
B. a
C. no output
D. error
Show Correct Answer
Correct Answer is :
no output
Similar Interview Questions
Search for latest jobs
Find Jobs