Quiz development: Random Questions/Answers

Quiz development: Random Questions/Answers

د Petronel Postolache لخوا -
د ځوابونو شمیر: 2

Anyone working on this or already done?

 

د درجې بندۍ اوسط:  -
In reply to Petronel Postolache

Re: Quiz development: Random Questions/Answers

د Martin Dougiamas لخوا -
د Core developers انځور د Documentation writers انځور د Moodle HQ انځور د Particularly helpful Moodlers انځور د Plugin developers انځور د Testers انځور
Yes. Someone recently hired me to write some code related to this that will be available in the next release. You can see some of it in the current CVS.

There is a new "Random Match" question type that randomly picks from among the "Short Answer" questions in the same category to build "Matching Questions" (eg four questions at once with four answers that need to be matched). The client had 30,000 existing short-answer questions which can now be imported and implemented using this method.

There will also be a "Random Multiple Choice" question type that will simply choose one of the existing "Multiple Choice" questions (random for each quiz attempt).

There will also be a quiz option to jumble up the order of questions in a quiz each time it is attempted.
In reply to Martin Dougiamas

Re: Quiz development: Random Questions/Answers

د Petronel Postolache لخوا -

I found something very easy that satisfy my needs. Shuffle the order of displaying answers.

I just changed mod/quiz/lib.php line 487 to:

$answerids = explode(",", $options->answers);
//shuffle answers order
srand ((float)microtime()*1000000);
shuffle ($answerids);

foreach ($answerids as $key => $answerid) {

To shuffle the order of questions just add:

shuffle ($questions);

after
$questions = explode(",", $quiz->questions);