JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Python interview questions part 62
Python interview questions part 62
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 11
1. What is the output of the following? x = 2 for i in range(x): x -= 2 print (x)
A. 0 1 2 3 4 …
B. 0 -2
C. 0
D. error
Show Correct Answer
Correct Answer is :
0 -2
2. What is the output of the following? for i in range(10): if i == 5: break else: print(i) else: print("Here")
A. 0 1 2 3 4 Here
B. 0 1 2 3 4 5 Here
C. 0 1 2 3 4
D. 1 2 3 4 5
Show Correct Answer
Correct Answer is :
0 1 2 3 4
3. What is the output of the following? for i in range(5): if i == 5: break else: print(i) else: print("Here")
A. 0 1 2 3 4 Here
B. 0 1 2 3 4 5 Here
C. 0 1 2 3 4
D. 1 2 3 4 5
Show Correct Answer
Correct Answer is :
0 1 2 3 4 Here
4. What is the output of the following? x = (i for i in range(3)) for i in x: print(i)
A. 36527
B. error
C. 0 1 2 0 1 2
D. none of the mentioned
Show Correct Answer
Correct Answer is :
36527
5. What is the output of the following? x = (i for i in range(3)) for i in x: print(i) for i in x: print(i)
A. 36527
B. error
C. 0 1 2 0 1 2
D. none of the mentioned
Show Correct Answer
Correct Answer is :
36527
6. What is the output of the following? string = "my name is x" for i in string: print (i, end=", ")
A. m, y, , n, a, m, e, , i, s, , x,
B. m, y, , n, a, m, e, , i, s, , x
C. my, name, is, x,
D. error
Show Correct Answer
Correct Answer is :
m, y, , n, a, m, e, , i, s, , x,
7. What is the output of the following? string = "my name is x" for i in string.split(): print (i, end=", ")
A. m, y, , n, a, m, e, , i, s, , x,
B. m, y, , n, a, m, e, , i, s, , x
C. my, name, is, x,
D. error
Show Correct Answer
Correct Answer is :
my, name, is, x,
8. What is the output of the following? a = [0, 1, 2, 3] for a[-1] in a: print(a[-1])
A. 0 1 2 3
B. 0 1 2 2
C. 3 3 3 3
D. error
Show Correct Answer
Correct Answer is :
0 1 2 2
9. What is the output of the following? a = [0, 1, 2, 3] for a[0] in a: print(a[0])
A. 0 1 2 3
B. 0 1 2 2
C. 3 3 3 3
D. error
Show Correct Answer
Correct Answer is :
0 1 2 3
10. What is the output of the following? a = [0, 1, 2, 3] i = -2 for i not in a: print(i) i += 1
A. -2 -1
B. 0
C. error
D. none of the mentioned
Show Correct Answer
Correct Answer is :
error
11. What is the output of the following? string = "my name is x" for i in ' '.join(string.split()): print (i, end=", ")
A. m, y, , n, a, m, e, , i, s, , x,
B. m, y, , n, a, m, e, , i, s, , x
C. my, name, is, x,
D. error
Show Correct Answer
Correct Answer is :
m, y, , n, a, m, e, , i, s, , x,
Similar Interview Questions
Search for latest jobs
Find Jobs