This is testing your design patterns, by using the simplest possible method. I think this could be the Strategy (or some other behavioural pattern). See these:
http://en.wikipedia.org/wiki/Strategy_pattern
http://en.wikipedia.org/wiki/Behavioral_pattern
If you are going for a Java interview, you should be able to identify the design pattern they are hinting at and that should prevent you from being too unsettled!
To answer the question, create two classes that implement MathFunction
as required, then create two instances and store them in functionList
.
The point here is not ‘can you do calculations in this strange way’, it is ‘can you identify design patterns’.