Python interview questions part 60

Python interview questions part 60

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 = 'abcd' for i in x: print(i) x.upper()

Correct Answer is : a b c d

2. What is the output of the following? x = 'abcd' for i in x: print(i.upper())

Correct Answer is : A B C D

3. What is the output of the following? x = 'abcd' for i in range(x): print(i)

Correct Answer is : error

4. What is the output of the following? x = 'abcd' for i in range(len(x)): print(i)

Correct Answer is : 0 1 2 3

5. What is the output of the following? x = 'abcd' for i in range(len(x)): print(i.upper())

Correct Answer is : error

6. What is the output of the following? x = 'abcd' for i in range(len(x)): i.upper() print (x)

Correct Answer is : error

7. What is the output of the following? x = 'abcd' for i in range(len(x)): x[i].upper() print (x)

Correct Answer is : abcd

8. What is the output of the following? x = 'abcd' for i in range(len(x)): i[x].upper() print (x)

Correct Answer is : error

9. What is the output of the following? x = 'abcd' for i in range(len(x)): x = 'a' print(x)

Correct Answer is : a a a a

10. What is the output of the following? x = 'abcd' for i in range(len(x)): print(x) x = 'a'

Correct Answer is : none of the mentioned

11. What is the output of the following? x = 123 for i in x: print(i)

Correct Answer is : error

12. What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for i in d: print(i)

Correct Answer is : 36527

13. What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x, y in d: print(x, y)

Correct Answer is : none of the mentioned

14. What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x, y in d.items(): print(x, y)

Correct Answer is : 0 a 1 b 2 c

15. What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x in d.keys(): print(d[x])

Correct Answer is : a b c

16. What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(x)

Correct Answer is : a b c

17. What is the output of the following? d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(d[x])

Correct Answer is : none of the mentioned

18. What is the output of the following? d = {0, 1, 2} for x in d.values(): print(x)

Correct Answer is : error

19. What is the output of the following? d = {0, 1, 2} for x in d: print(x)

Correct Answer is : 36527

20. What is the output of the following? d = {0, 1, 2} for x in d: print(d.add(x))

Correct Answer is : None None None

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon