I can't try to write that code for you right now 'cause I'm so tired, but I do have an idea of how I'd do it... I remember my exams in schools were multiple answers, something like this:
(Q) What are the properties of water?
1. it's tasteless
2. it smells funny
4. it's odorless
8. it's kinda green
16. it's colorless
32. it may only be found in liquid state
64. it's considered the universal solvent
so, the right answer would be options 1, 4, 16, and 64. sum that up: 85.
that way, you can always know what the person has chosen, by subtracting whatever is the highest possible alternative without making it less than 1.
example: john only checked 1,4, and 64, and thus added to 69. You would never think he had checked 128. Not even if he had chosen all the options before, which would add to 127. Got it?
anyways, that's just a way to treat the logics...
sorry for my bad English, hope I could help.