ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(''.join(map(chr, [72, 105])), ord('A') > 127, len('ab'.encode('utf-8')))- A. Hi True 2
- B. Hi False 4
- C. Hi False 2
- D. Ho False 2
Correct answer: C. Hi False 2
chr(72) and chr(105) give H and i. 'A' has code point 65, which is below 127, and two ASCII letters take two bytes in UTF-8.
More Python Programming questions
- What is printed? python print(list('hi'.encode('utf-16-le')), len('hi'.encode('utf-32')))
- What is printed? python print(bytes([104, 105]).decode(), bytes(b'ab').hex(), bytes([10, 255]).hex())
- What is printed? python print(f'{0.1:.1f}', f'{0.25:.1f}', f'{0.35:.1f}', f'{0.45:.1f}')
- What is printed? python print(5 // 2 2, 5 >> 2, 5 / 2 2)
- What is printed? python print(1 + 2 3 2 // 4 % 5, (1 + 2) 3 2 // 4 % 5)
- What is printed? python print(1 == 1.0 and '1' != 1, [1, 2] == [1.0, 2.0], (1, 'a') == (1.0, 'a'))