| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

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? print('xyyxyyxyxyxxy'.replace('xy', '12', 0))

Correct Answer is : xyyxyyxyxyxxy

2. What is the output of the following? print('xyyxyyxyxyxxy'.replace('xy', '12', 100))

Correct Answer is : 12y12y1212x12

3. What is the output of the following? print('abcdefcdghcd'.split('cd'))

Correct Answer is : [‘ab’, ‘ef’, ‘gh’, ”].

4. What is the output of the following? print('abcdefcdghcd'.split('cd', 0))

Correct Answer is : [‘abcdefcdghcd’].

5. What is the output of the following? print('abcdefcdghcd'.split('cd', -1))

Correct Answer is : [‘ab’, ‘ef’, ‘gh’, ”].

6. What is the output of the following? print('abcdefcdghcd'.split('cd', 2))

Correct Answer is : [‘ab’, ‘ef’, ‘ghcd’].

7. What is the output of the following? print('ab\ncd\nef'.splitlines())

Correct Answer is : [‘ab’, ‘cd’, ‘ef’].

8. What is the output of the following? print('Ab!2'.swapcase())

Correct Answer is : aB!2

9. What is the output of the following? print('ab cd ef'.title())

Correct Answer is : Ab Cd Ef

10. What is the output of the following? print('ab cd-ef'.title())

Correct Answer is : Ab Cd-Ef

11. What is the output of the following? print('abcd'.translate('a'.maketrans('abc', 'bcd')))

Correct Answer is : bcdd

12. What is the output of the following? print('abcd'.translate({97: 98, 98: 99, 99: 100}))

Correct Answer is : none of the mentioned

13. What is the output of the following? print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))

Correct Answer is : abcd

14. What is the output of the following? print('ab'.zfill(5))

Correct Answer is : 000ab

15. What is the output of the following? print('+99'.zfill(5))

Correct Answer is : 99

16. What is the output of the following code ? class father: def __init__(self, param): self.o1 = param class child(father): def __init__(self, param): self.o2 = param >>>obj = child(22)>>>print "%d %d" % (obj.o1, obj.o2)

Correct Answer is : Error is generated

17. What is the output of the following code ? class tester: def __init__(self, id): self.id = str(id) id="224" >>>temp = tester(12)>>>print(temp.id)

Correct Answer is : 12

18. What is the output of the following code ? >>>example = "snow world">>>print("%s" % example[4:7])

Correct Answer is : wo

19. What is the output of the following code ? >>>example = "snow world">>>example[3] = 's'>>>print example

Correct Answer is : Error

20. What is the output of the following code ? >>>max("what are you")

Correct Answer is : y