Using logic/variable to show cumulative scores across categories at end of activity

Is there any way to do this so that each response in an MCQ could affect a different varibale? So that you could give the learner one of three personality types at the end of the quiz? Could it be done with javascript?