## Quiz

### calculated questions for Moodle generator

calculated questions for Moodle generator

A long time ago somebody created a spreadsheet "Quiz_CLtoMoodleXML_V.1.3.1_test". With this spreadsheet you can create all kind of questions in Excel and generate a Moodle XML file that can be imported into Moodle resulting in new questions in your question bank.

(I've checked the XML files with Moodle 2.4+ (Build: 20121230) and it worked )

I'll be presenting this work on Moodle Research 2013 and I hope to meet you there.

Average of ratings: -
Re: calculated questions for Moodle generator

Hi Hiram,

A long time ago, I also created a spreadsheet to generate calculated questions first on WEBCT then on Moodle.

Effectively one of the wildcard could contain the response to a complex calculation using the power of the spreadsheet which are quite larger then the one line Moodle equation.

On WebCt the problem was that the wildcards where included in the question submitted. So there was a need to code them.

Unless I miss something, they are not included in the data on the user side on Moodle unless they are displayed so no coding should be necessary.

The new question types developped at OU are also a response to the need of more complex calculations.

In all cases, you have developped a quite interesting tool.

Pierre

Average of ratings: -
Re: calculated questions for Moodle generator

Thanks Pierre

feel free the check out this tool and comment on it.

I see your nice picture often related to mathematical topics in moodle, so I value very much your opinion.

In fact the wildcard containing the right answer is still in the question text but hidden away

Cheers
Hiram

Average of ratings: -
Re: calculated questions for Moodle generator

Hi Hiram,

right answer is still in the question text but hidden away?

I just test on a 2,4 Moodle version and the good response does not seem to be available in the source code ( using Safari on Mac) of a quiz attempt.

Pierre

Average of ratings: -
Re: calculated questions for Moodle generator

Perfect, so my hiding system works

in the source code of a rendered question you can find a comment (<!--...-->) enclosing a series of numbers, the correct answer is part of that number.

cheers
Hiram

Average of ratings: -
Re: calculated questions for Moodle generator

Hi Hiram,

There is probably a misunderstanding.

I did not test on your system. I just didn't found the good response in the source as given by source code function of Firefox.

Could you give us an example on a regular question?

Pierre

Average of ratings: -
Re: calculated questions for Moodle generator

Ah OK Pierrre Look at this screen

Somewhere in the page source you'll see the comment tag and in there, the right answer, on the yellow field, is surrounded by a random set of random numbers.

Cheers
Hiram

Average of ratings: -
Re: calculated questions for Moodle generator

Hi Hiram

On uqam moodle 2,5 the content of a regular question is not the same

>Modifier la question</a></div></div><div class="content"><div class="formulation"><h3 class="accesshide">Texte de la question</h3><input type="hidden" name="q296:1_:sequencecheck" value="1" /><div class="qtext"><p>2,3</p></div><div class="ablock"><label for="q296:1_answer">Réponse :</label><span class="answer"><input type="text" name="q296:1_answer" id="q296:1_answer" size="80" /></span></div></div></div></div><div class="submitbtns"><input type="submit" name="next" value="Suivant" /></div><input type="hidden" name="attempt" value="169" /><input type="hidden" name="thispage" value="0" id="followingpage" /><input type="hidden" name="nextpage" value="-1" /><Pierre

Average of ratings: -
Re: calculated questions for Moodle generator

Like Pierre, I just tried previewing a Calculated question in my Moodle install, and there is no HTML comment like that.

Average of ratings: -
Re: calculated questions for Moodle generator

Hi Hiram

the explanation is as you wrote:

Correct answers are stored in a wildcard and as such must appear somewhere in the Question Text.

 When looking at the source code of a page publishing the question one can find the following line:

New tires:

A truck was fitted with 17 new tires.These tires were...

Obviously these answers must be obscured. And this is done by the following steps:
1. Hide
Using the HTML comment tags <!-- hidden text --> text within the tags is invisible.
BUT, expect learners to look further and peek in the source code of the page where they will easily find these comment tags and will figure out that the number hidden could be the correct answer.

2. Camouflage
• Number format
The answers are rounded to six decimals and then multiplied by 1000000. So 0,488995 becomes 488995 in this value is stored in the wildcard. Later, a formula recalculates this to 0,488995 which is the correct answer.
This whole number has no more decimal separator and does not look like the right answer (which is a number smaller than one).
By changing the value of the factor, cell G1 in the worksheet, one can choose for example a factor like 2000000 which results in a number that resembles even less the correct answer.

• Embedding
Before and after the sequence of correct and alternative answers there is a string of numbers. Five numbers are picked randomly from the answers in column B in the worksheet. The sequence of correct and alternative answers is a sixth value. These six values are then placed in a random order.

As far as I can conclude your tool has been originaly made for WebCT or another similar system.

All the coding related to this "camouflage" is not necessary on Moodle which would greatly simplify your tool..

Pierre

P.S. I will try to find a copy of a similar tool I developped ( around 2001) for WebCT.

Average of ratings: -
Re: calculated questions for Moodle generator

Tested again in Moodle 2.5.2+ (Build: 20131004), viewed in firefox

=>generate a question via the cq4m generator (OR us the included xml), import and publish in a quiz, open the quiz as student, look at the source code of the page and you will find:

<h1>New tires:</h1><!--155309103241127238253879523393781252781212523433338039-->A truck was fitted with 15 new tires.<br>These tires were selected from a batch which afterwards proved that 18% of the tires did not comply with the quality standards. The bad tires must be replaced. <p> <b>Determine the chance that more than 2 but less than 10 tires must be replaced, accurate to 4 decimal places.

The values of all the wildcards are plainly visible, so is the right answer but that value is obfuscated in a set of numbers between the comment tags.

This was presented during mrc2013. David Mudrak suggested to post on the tracker the question for a new wildcard type in which one could hide the right answer (generated outside Moodle) to get rid of the need to camouflage the right answer.

Not sure why you don't see this?

And yes Tim, excel can generate HTML like that

Cheers
Hiram

Average of ratings: -
Re: calculated questions for Moodle generator

As several of us have now pointed out, that HTML comment is coming from the CQ4M spreadsheet. Specifically from Cell W2 of https://sites.google.com/site/cq4mgenerator/home/example-spreadsheets which contains

If you tell Moodle to put all the question variables into the question text in a HTML comment, Moodle will do that.

The solution is simple. Don't do that!

If you explain why your spreadsheet is doing that, then we may be able to suggest an alternative.

(One possible explanation is that you want to ensure that all the variables are mentioned in the question text, so that Moodle knows they are there. I am not sure that is really necessary, but if it is, you could instead make the comment <!--{={answer1}*0}{={answer2}*0}{={answer3}*0}{={answer4}*0}--> which would insert a row of 0s into the HTML.)

Average of ratings: -
Re: calculated questions for Moodle generator

Solved Tim

I was under the impression that Moodle needed all wildcards to be available in the question text, and maybe that was the case in version 1.

But, I've erased the comment hiding the right answer in the xml file, and Moodle presents the question in a correct way without any trace of 'the right anwswer'.

The trick the use {=   } is relative new to me, but as you write would be a top alternative to obfuscate variables.

So the answer to "... to ensure that all the variables are mentioned in the question text, so that Moodle knows they are there. I am not sure that is really necessary" = It is not necessary!