Q.1
What will be the output of the following Python code? print("Hello {nameand {name2}".format(name1='foo', name2='bin'))
  • a) Hello foo and bin
  • b) Hello {name1} and {name2}
  • c) Error
  • d) Hello and
Q.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
  • b) Hello ‘foo’ and foo
  • c) Hello foo and ‘bin’
  • d) Error
Q.3
What will be the output of the following Python code? print("Hello {and {1}".format(('foo', 'bin')))
  • a) Hello foo and bin
  • b) Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
  • c) Error
  • d) None of the mentioned
Q.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
  • b) Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
  • c) Error
  • d) None of the mentioned
Q.5
What will be the output of the following Python code snippet? print('The sum of {and {is {2}'.format(12))
  • a) The sum of 2 and 10 is 12
  • b) Error
  • c) The sum of 0 and 1 is 2
  • d) None of the mentioned
Q.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(12))
  • a) The sum of 2 and 10 is 12
  • b) The sum of 10 and a is 14
  • c) The sum of 10 and a is c
  • d) Error
Q.7
What will be the output of the following Python code snippet? print('{:,}'.format(1112223334))
  • a) 1,112,223,334
  • b) 111,222,333,4
  • c) 1112223334
  • d) Error
Q.8
What will be the output of the following Python code snippet? print('{:,}'.format('1112223334'))
  • a) 1,112,223,334
  • b) 111,222,333,4
  • c) 1112223334
  • d) Error
Q.9
What will be the output of the following Python code snippet? print('{:$}'.format(1112223334))
  • a) 1,112,223,334
  • b) 111,222,333,4
  • c) 1112223334
  • d) Error
Q.10
What will be the output of the following Python code snippet? print('{:#}'.format(1112223334))
  • a) 1,112,223,334
  • b) 111,222,333,4
  • c) 1112223334
  • d) Error
0 h : 0 m : 1 s