Skip to content
ExamSpine

Lesson 4.6 · Answer it

Why decompose

3 marksYou mark it yourself against the marking points

A student writes one 40-line function. It reads three test marks typed by the user, works out their average, decides a grade letter from the average, and prints a short report.

(a) Explain one problem with keeping all of this in a single function. [1]

(b) Name two smaller functions you would split it into, saying what each one does. [1]

(c) Explain how one of your two functions could be tested on its own, without running the rest of the program. [1]

[3]