ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(int('12abc', 16), int('ABC', 16) == 0xabc, int('1_000_000') == 10**6)
  1. A. 76476 False True
  2. B. 76476 True True
  3. C. 12abc True True
  4. 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

Exams that ask this topic