41. What will be the output of the following Python code?
print('*', "abcdef".center(7), '*')
print('*', "abcdef".center(7), '*')
42. What will be the output of the following Python code?
print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
43. What will be the output of the following Python code snippet?
print(''.isdigit())
print(''.isdigit())
44. What will be the output of the following Python code?
print('ab'.isalpha())
print('ab'.isalpha())
45. What will be the output of the following Python code snippet?
print('abcd'.translate('a'.maketrans('abc', 'bcd')))
print('abcd'.translate('a'.maketrans('abc', 'bcd')))
46. Suppose i is 5 and j is 4, i + j is same as . . . . . . . .
47. What will be the output of the following Python code snippet?
print('abcdefcdghcd'.split('cd'))
print('abcdefcdghcd'.split('cd'))
48. What will be the output of the following Python code?
print("ab\tcd\tef".expandtabs('+'))
print("ab\tcd\tef".expandtabs('+'))
49. What will be the output of the following Python code snippet?
print('+99'.zfill(5))
print('+99'.zfill(5))
50. What will be the output of the following Python code?
print("abcdef".center(0))
print("abcdef".center(0))
Read More Section(Strings in Python)
Each Section contains maximum 100 MCQs question on Strings in Python. To get more questions visit other sections.