What is printed? (a function with a bug) python def average(a, b): return a + b / 2 print(average(4, 6))

  1. 5.0
  2. 7.0
  3. 3.0
  4. 10
Answer

B) 7.0

Division happens first: 4 + 3.0 = 7.0 – a logical error. SLO CS-11-C-07

Computer Science MCQ · More Unit 3: Programming Fundamentals MCQs · Practise