1. What will be the output of the following Python code?
print("xyyzxyzxzxyy".count('yy'))
print("xyyzxyzxzxyy".count('yy'))
2. What will be the output of the following Python code?
>>>max("what are you")
>>>max("what are you")
3. What will be the output of the following Python code?
print(0xA + 0xB + 0xC)
print(0xA + 0xB + 0xC)
4. What will be the output of the following Python code?
>>>example="helloworld"
>>>example[::-1].startswith("d")
>>>example="helloworld"
>>>example[::-1].startswith("d")
5. What will be the output of the following Python code?
print('abcdef'.partition('cd'))
print('abcdef'.partition('cd'))
6. To return the length of string s what command do we execute?
7. What will be the output of the following Python code snippet?
print('ab'.zfill(5))
print('ab'.zfill(5))
8. What will be the output of the "hello" +1+2+3?
9. What will be the output of the following Python code snippet?
print('__foo__'.isidentifier())
print('__foo__'.isidentifier())
10. What will be the output of the following Python statement?
>>>print('new' 'line')
>>>print('new' 'line')
Read More Section(Strings in Python)
Each Section contains maximum 100 MCQs question on Strings in Python. To get more questions visit other sections.