Why is code written inside functions easier to test?

  1. Functions never contain errors
  2. The debugger only works inside functions
  3. A function can be called with test inputs and its return value checked
  4. Functions run faster than other code
Answer

C) A function can be called with test inputs and its return value checked

Functions isolate a task so it can be tested separately. SLO CS-11-C-07

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