ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(bin(10)[::-1], int(''.join(reversed(bin(10)[2:])), 2), format(10, 'b').zfill(6))
  1. A. 0101b0 5 001010
  2. B. 0101b0 10 001010
  3. C. 0b1010 5 001010
  4. D. 0101b0 5 10

Correct answer: A. 0101b0 5 001010

Reversing the string '0b1010' gives '0101b0'. Reversing only the digits 1010 gives 0101, which is 5, and format with zfill pads 1010 to six places.

More Python Programming questions

Exams that ask this topic