ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
print(len(bytes('é', 'utf-8')), len('é'))- A. 2 1
- B. 1 1
- C. 2 2
- D. 3 1
Correct answer: A. 2 1
The letter é takes two bytes in UTF-8, but the string holds it as one character.
More Python Programming questions
- What is printed? python print(float('inf') > 10308, -float('inf') < -10308)
- What is printed? python print(sorted({3: 'a', 1: 'b'}), list(reversed(sorted({3: 'a', 1: 'b'}))))
- What is printed? python print('a' < 'B', 'a'.upper() < 'B')
- What is printed? python print(0 == False, 0 is False, '' == None)
- What is printed? python print(any(x > 2 for x in [1, 2, 3]), next(x for x in [1, 2, 3] if x > 1))
- What is printed? python print(list(range(5, 0, -2)), list(range(0)), range(3)[1:])