ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(bytes([104, 105]).decode(), bytes(b'ab').hex(), bytes([10, 255]).hex())
- A. hi 6162 0aff
- B. hi 6162 10ff
- C. hi 9899 0aff
- D. ab 6162 0aff
Correct answer: A. hi 6162 0aff
Decoding bytes 104 and 105 as ASCII gives 'hi'. hex() shows each byte as two hex digits, so 10 is 0a and 255 is ff.
More Python Programming questions
- 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'))
- What is printed? python print(set([1, 2]) == {1.0, 2.0}, {1: 'x'}.get(1.0), {'1': 2}.get(1))
- What is printed? python print(2 63 - 1 == 9223372036854775807, (2 63) % 10, -2 63 // 10)