Welcome to the Ranch
It shows how important it is to read the questions carefully. The code TK showed you will compile, which is what matters for an exam question. It might be poor design, but the question isn't asking whether the code is well designed or not.
Seriously Rick? Seriously? You might as well just read this tiny ad: