ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(int('12abc', 16), int('ABC', 16) == 0xabc, int('1_000_000') == 10**6)- A. 76476 False True
- B. 76476 True True
- C. 12abc True True
- D. 76476 True False
Correct answer: B. 76476 True True
Hex digits go up to f, so '12abc' is 0x12abc, which is 76476. Upper-case hex digits are accepted, and underscores are allowed between digits.
More Python Programming questions
- What is printed? python print('%s' % None, '%r' % None, '%d' % True)
- What is printed? python print(str(3) 2 + str(3 2), int(str(3) 2) + 3 2)
- What is printed? python print(10 // 3 3 + 10 % 3 == 10, -10 // 3 3 + -10 % 3 == -10)
- What is printed? python print(sum(int(d) for d in str(320)) % 9, 320 % 9, (320) % 10)
- What is printed? python print(len(str(1050 + 1).rstrip('0')), str(1050 + 1)[-2:], str(1050 - 1)[:3])
- What is printed? python print(max(map(len, ['abc', 'de', 'fghi'])), list(map(len, ['abc', '', 'x'])), sum(map(len, ['ab', 'cd'])))