ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(int(2.5 * 4) // 3, int(10 / 4 * 2), 10 // 4 * 2, 10 / 4 // 2)
  1. A. 3 5 4 2.0
  2. B. 3 4 4 1.0
  3. C. 3 5 5 1.0
  4. D. 3 5 4 1.0

Correct answer: D. 3 5 4 1.0

2.5 * 4 is exactly 10.0, so int gives 10 and 10 // 3 is 3. 10 / 4 is 2.5, and 2.5 // 2 floors 1.25 to 1.0, which is why the last value is a float 1.0.

More Python Programming questions

Exams that ask this topic