A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

71. What is the output of the following?
print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))
a. Hello foo and bin
b. Hello {name1} and {name2}
c. Error
d. Hello and
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Hello foo and bin

72. What is the output of the following?
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
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Hello ‘foo’ and foo

73. What is the output of the following?
print("Hello {0} and {1}".format(('foo', 'bin')))
a. Hello foo and bin
b. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
c. Error
d. None of the mentioned
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Error

74. What is the output of the following?
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
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).Hello foo and bin

75. What is the output of the following?
print('The sum of {0} and {1} is {2}'.format(2, 10, 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
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).The sum of 2 and 10 is 12

76. What is the output of the following?
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
b. The sum of 10 and a is 14
c. The sum of 10 and a is c
d. Error
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).The sum of 10 and a is 14

77. What is the output of the following?
print('{:,}'.format(1112223334))
a. 1,112,223,334
b. 111,222,333,4
c. 1112223334
d. Error
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).1,112,223,334

78. What is the output of the following?
print('{:,}'.format('1112223334'))
a. 1,112,223,334
b. 111,222,333,4
c. 1112223334
d. Error
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).Error

79. What is the output of the following?
print('{:$}'.format(1112223334))
a. 1,112,223,334
b. 111,222,333,4
c. 1112223334
d. Error
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).Error

80. What is the output of the following?
print('{:#}'.format(1112223334))
a. 1,112,223,334
b. 111,222,333,4
c. 1112223334
d. Error
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).1112223334