ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(ord('a') - ord('A'), chr(ord('A') + 32), 'Z'.lower() < 'a', 'z' > 'Z')- A. 32 b False True
- B. 32 a True False
- C. 31 a False True
- D. 32 a False True
Correct answer: D. 32 a False True
Lowercase letters are 32 code points above their uppercase forms. 'Z'.lower() is 'z', which has a larger code point than 'a', so the first comparison is False, and 'z' > 'Z' is True.
More Python Programming questions
- What is printed? python print('-'.join('abc'), ''.join(map(str, [1, 2, 3])) == '123', ','.join([]) == '', 'x'.join(['', '']))
- What is printed? python s = 'hello' print(s.find('l'), s.index('l', 3), s.rfind('l'), s.count('ll'), s.find('z'))
- What is printed? python print('%.2e' % 0.000123456, '%G' % 1e-5, '%g' % 1e-5, '%.3g' % 1234.5)
- What is printed? python print(max(3, 3.0), min(3.0, 3), max([2, 2.0]), type(max(2.0, 2)).name)
- What is printed? python print(sum([True, True, False]), sum([1.5, True]), True 3 + 0.5, sum([1, 2], 10))
- What is printed? python print(all([]), any([]), all([0, 1]), any([0.0, '']), all(x > 0 for x in [1, -1]))