21. What will be the output of the following Python code snippet?
print('Hello World'.istitle())
print('Hello World'.istitle())
22. What will be the output of the following Python code?
>>>str1="helloworld"
>>>str1[::-1]
>>>str1="helloworld"
>>>str1[::-1]
23. What will be the output of the following Python code snippet?
print('abcdefcdghcd'.split('cd', -1))
print('abcdefcdghcd'.split('cd', -1))
24. What will be the output of the following Python code?
print('abcd'.partition('cd'))
print('abcd'.partition('cd'))
25. What will be the output of the following Python code snippet?
print('ab cd-ef'.title())
print('ab cd-ef'.title())
26. What will be the output of the following Python code?
print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))
print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))
27. What will be the output of the following Python statement?
>>>"a"+"bc"
>>>"a"+"bc"
28. What will be the output of the following Python statement?
>>> print('x\97\x98')
>>> print('x\97\x98')
29. What is "Hello".replace("l", "e")?
30. Given a string example="hello" what is the output of example.count('l')?
Read More Section(Strings in Python)
Each Section contains maximum 100 MCQs question on Strings in Python. To get more questions visit other sections.