implements the quiz logic functions