gs gs109 Python Strings - Python Strings - Quiz No.8
gs gs109 Python Quiz
This quiz belongs to book/course code gs gs109 Python of gs organization. We have 134 quizzes available related to the book/course Python. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Python Strings. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: What will be the output of the following Python code?
print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))
Hello foo and bin
Hello {name1} and {name2}
Error
Hello and
Question 2: What will be the output of the following Python code?
print("Hello {0!r} and {0!s}".format('foo', 'bin'))
Hello foo and foo
Hello ‘foo’ and foo
Hello foo and ‘bin’
Error
Question 3: What will be the output of the following Python code?
print("Hello {0} and {1}".format(('foo', 'bin')))
Hello foo and bin
Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
Error
None of the mentioned
Question 4: What will be the output of the following Python code?
print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
Hello foo and bin
Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
Error
None of the mentioned
Question 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))
The sum of 2 and 10 is 12
Error
The sum of 0 and 1 is 2
None of the mentioned
Question 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))
The sum of 2 and 10 is 12
The sum of 10 and a is 14
The sum of 10 and a is c
Error
Question 7: What will be the output of the following Python code snippet?
print('{:,}'.format(1112223334))
1,112,223,334
111,222,333,4
1112223334
Error
Question 8: What will be the output of the following Python code snippet?
print('{:,}'.format('1112223334'))
1,112,223,334
111,222,333,4
1112223334
Error
Question 9: What will be the output of the following Python code snippet?
print('{:$}'.format(1112223334))
1,112,223,334
111,222,333,4
1112223334
Error
Question 10: What will be the output of the following Python code snippet?
print('{:#}'.format(1112223334))
1,112,223,334
111,222,333,4
1112223334
Error