Quiz development: Random Questions/Answers

Quiz development: Random Questions/Answers

wót Petronel Postolache -
Anzahl Antworten: 2

Anyone working on this or already done?

 

Als Antwort auf Petronel Postolache

Re: Quiz development: Random Questions/Answers

wót Martin Dougiamas -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Moodle HQ Nutzerbild von Particularly helpful Moodlers Nutzerbild von Plugin developers Nutzerbild von 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.
Als Antwort auf Martin Dougiamas

Re: Quiz development: Random Questions/Answers

wót 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);