ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(int(0.1 * 10) == 1, int(0.7 * 10), int(4.35 * 100), round(4.35 * 100))
  1. A. True 7 435 435
  2. B. True 7 434 435
  3. C. False 7 434 435
  4. D. True 6 434 435

Correct answer: B. True 7 434 435

int truncates toward zero, and 4.35 * 100 is stored just under 435, so int gives 434 while round gives 435. The multiplications by 10 are exact enough here to give 1 and 7.

More Python Programming questions

Exams that ask this topic