Python Multiple Choice Questions and Answers on “Strings”. 1. What will be the output of the following Python code? print("Hello {name1} and {name2}".format(name1='foo', name2='bin')) a) Hello foo and bin 2. What will be the output of the following Python code? print("Hello {0!r} and {0!s}".format('foo', 'bin')) a) Hello foo and foo 3. What will be the output of the following Python code? print("Hello {0} and {1}".format(('foo', 'bin'))) a) Hello foo and bin 4. What will be the output of the following Python code? print("Hello {0[0]} and {0[1]}".format(('foo', 'bin'))) a) Hello foo and bin 5. What will be the output of the following Python code snippet? print('The sum of {0} and {1} is {2}'.format(2, 10, 12)) a) The sum of 2 and 10 is 12 6. What will be the output of the following Python code snippet? print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 10, 12)) a) The sum of 2 and 10 is 12 7. What will be the output of the following Python code snippet? print('{:,}'.format(1112223334)) a) 1,112,223,334 8. What will be the output of the following Python code snippet? print('{:,}'.format('1112223334')) a) 1,112,223,334 9. What will be the output of the following Python code snippet? print('{:$}'.format(1112223334)) a) 1,112,223,334 10. What will be the output of the following Python code snippet? print('{:#}'.format(1112223334)) a) 1,112,223,334 multiple choice questions on Python, ---- >> Below are the Related Posts of Above Questions ::: ------>>[MOST IMPORTANT]<<------
|