No, cake shouldn’t be composted
It doesn’t matter whether it is sponge, pastry or fruit/mousse-based like in the picture – it won’t add a lot of nutrients or bulk to your compost heap and while it will rot down quite quickly, they might attract rats or other vermin to your compost heap in the meantime. The reward isn’t worth the risk.
Instead, use it up – even dry or going stale sponge cake can be turned into treats. Use in a trifle, as part of a pie biscuit crust or bake them into biscotti or sweet croutons. For more ideas, see our Recycle This page about things to do with old cake.