51. What will be the output of the following Python code?
print('a'.maketrans('ABC', '123'))
print('a'.maketrans('ABC', '123'))
52. What will be the output of the following Python code snippet?
print('abcdefcdghcd'.split('cd', 0))
print('abcdefcdghcd'.split('cd', 0))
53. What will be the output of the following Python code?
print("Hello {} and {}".format('foo', 'bin'))
print("Hello {} and {}".format('foo', 'bin'))
54. What will be the output of the following Python statement?
>>>"abcd"[2:]
>>>"abcd"[2:]
55. What will be the output of the following Python code?
print("Hello {name1} and {name2}".format('foo', 'bin'))
print("Hello {name1} and {name2}".format('foo', 'bin'))
56. What will be the output of the following Python code snippet?
print('0xa'.isdigit())
print('0xa'.isdigit())
57. The output of executing string.ascii_letters can also be achieved by:
58. What will be the output of the following Python code snippet?
print('{:,}'.format(1112223334))
print('{:,}'.format(1112223334))
59. What will be the output of the following Python code?
print('{0:.2%}'.format(1/3))
print('{0:.2%}'.format(1/3))
60. What will be the output of the following Python code?
print("abcdef".center(7, '1'))
print("abcdef".center(7, '1'))
Read More Section(Strings in Python)
Each Section contains maximum 100 MCQs question on Strings in Python. To get more questions visit other sections.