in reply to Perl ( multiple Choice Tests )
Read the questions from the question file into an array, and randomly pick one of the array elements using rand.
Using the question number from the last step, go get the correct answer from the answer file, possibly again reading the answers file into an array.
For the wrong answers, make some stuff up and put it in a bad answers file. Read that file into an array as before, and randomly select three distinct answers (distinct, because you don't want the same wrong answer twice). Order these three answers and the correct answer randomly and display. Done!
|
|---|