ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(bool(''), bool('False'), bool([]), bool([[]]), bool(None))- A. False True False True False
- B. False False False True False
- C. True True False True False
- D. False True True True False
Correct answer: A. False True False True False
Only empty containers and None are falsy among these values. The string 'False' has text, and [[]] is a list holding one item, so it is truthy.
More Python Programming questions
- What is printed? python print(str(3) + str(3.0), 3 + 3.0, '3' 3 == '333')
- What is printed? python y = 1 + 1 - 1 2 2 // 4 print(y, 2 2 0, (2 2) 0, -3 2 % 5)
- What is printed? python t = 'racecar' print(t == t[::-1], t.find('car'), t.rfind('c'), t.replace('car', 'CAR', 1))
- What is printed? python s = 'one two three' print(s.split(' '), len(s.split()), s.split(None, 1)[1], '-'.join(s.split()))
- What is printed? python print('ab'.ljust(4, '') + '|', 'ab'.rjust(4, ''), 'ab'.zfill(4), '12'.zfill(1))
- What is printed? python print('%s and %s' % ('A', 'B'), '%(x)d-%(x)05.1f' % {'x': 3}, '%%%d' % 5)