ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(max('zebra', 'Zebra'), min('zebra', 'Zebra'), 'apple' > 'Apple', 'Z' < 'a')- A. zebra zebra True False
- B. zebra Zebra True True
- C. Zebra zebra False True
- D. zebra Zebra False False
Correct answer: B. zebra Zebra True True
Lowercase letters have larger code points than uppercase, so zebra beats Zebra in both max and min. Comparing apple with Apple is decided by the first character, and Z (90) is less than a (97).
More Python Programming questions
- What is printed? python x = 5 print(x.add(3), (5).mod(-3), (-5).mod(3), int.floordiv(-5, 3))
- What is printed? python print('ab'.rjust(5, ''), 'ab'.ljust(5, '-'), 'ab'.center(5, '.'), 'ab'.center(6, '.'))
- What is printed? python print(f'{"x"!r}', '%s and %r' % ('x', 'x'), '{!s} {!r}'.format('x', 'x'))
- What is printed? python s = 'abc' print(s 2 == 'abcabc', s[1:] + s[:1], s[-1:] + s[:-1], len('ab' 0))
- What is printed? python print(int('007'), int('-07'), int('01'), int('00'))
- What is printed? python print(float('1e3') == 1000, float('1E-2') 100, float(' .5 '), float('5.'))