This class is demo implementation in Java, to develop the algorithm for a
question answer matrix. A qa-matrix has the answers formatted as row header
elements, the row headers and the questions and the cells are the tick boxes.
The implementation takes a number of
question-answer pairs and
dummy pairs (which contain only wrong answers as a kind of decoy),
currently in the main method.
To create an exam question proper,
- first the pairs are shuffled.
- Then for each of the pair, the answer is used as a header elements (top
cell). In this state, filling out the matrix would put the correct answers on
the diagonal, skipping the decoy answers.
- The rows are built separately, but only from the proper question-answer
pairs, not from the dummy pair.
- For each pair the correct answer cell number can be determined from the
row number (remember diagonal). Thereby you are able to create the list of
right and wrong choices. Example: Pair two (of six ) would have .X...., where
'.' is wrong and 'X' right. Thus we can create the question rows.
- If it is not a dummy pair, the row is added to the row-set.
- After completing the adding of the questions to the row-set, the row-set
is shuffled and can then be added to output stream and printed.