ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(10 / 2, 10 // 2, 7 / 7, 2 * 3 + 4)
  1. A. 5.0 5 1.0 10
  2. B. 5 5 1 10
  3. C. 5.0 5 1 10
  4. D. 5.0 5 1.0 14

Correct answer: A. 5.0 5 1.0 10

/ always returns a float, so 10 / 2 is 5.0 and 7 / 7 is 1.0. // on ints returns an int, and multiplication binds tighter than +, so 2 * 3 + 4 is 10.

More Python Programming questions

Exams that ask this topic