Python interview questions part 61

Python interview questions part 61

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? for i in range(0): print(i)

Correct Answer is : no output

2. What is the output of the following? for i in range(2.0): print(i)

Correct Answer is : error

3. What is the output of the following? for i in range(2.0): print(i)

Correct Answer is : error

4. What is the output of the following? for i in range(int(2.0)): print(i)

Correct Answer is : 0 1

5. What is the output of the following? for i in range(int(2.0)): print(i)

Correct Answer is : 0 1

6. What is the output of the following? for i in range(float('inf')): print (i)

Correct Answer is : none of the mentioned

7. What is the output of the following? for i in range(float('inf')): print (i)

Correct Answer is : none of the mentioned

8. What is the output of the following? for i in range(int(float('inf'))): print (i)

Correct Answer is : none of the mentioned

9. What is the output of the following? for i in range(int(float('inf'))): print (i)

Correct Answer is : none of the mentioned

10. What is the output of the following? for i in [1, 2, 3, 4][::-1]: print (i)

Correct Answer is : 4 3 2 1

11. What is the output of the following? for i in [1, 2, 3, 4][::-1]: print (i)

Correct Answer is : 4 3 2 1

12. What is the output of the following? for i in ''.join(reversed(list('abcd'))): print (i)

Correct Answer is : d c b a

13. What is the output of the following? for i in ''.join(reversed(list('abcd'))): print (i)

Correct Answer is : d c b a

14. What is the output of the following? for i in 'abcd'[::-1]: print (i)

Correct Answer is : d c b a

15. What is the output of the following? for i in 'abcd'[::-1]: print (i)

Correct Answer is : d c b a

16. What is the output of the following? for i in '': print (i)

Correct Answer is : (nothing is printed)

17. What is the output of the following? for i in '': print (i)

Correct Answer is : (nothing is printed)

18. What is the output of the following? x = 2 for i in range(x): x += 1 print (x)

Correct Answer is : 45355

19. What is the output of the following? x = 2 for i in range(x): x += 1 print (x)

Correct Answer is : 45355

20. What is the output of the following? x = 2 for i in range(x): x -= 2 print (x)

Correct Answer is : 0 -2

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon