### Calculated Question: Correct Answer marked as Incorrect

Number of replies: 15I have been using the Calculated Questions in the Quiz module in adaptive mode for a few months instead of assigning paper/pencil homework and all has been working well until lately.

I have had a few students input an answer which falls into the accepted range for that answer, but the server still marks the answer wrong. When I gave her the correct answer as given by the editing page, it was still marked wrong.

I have the correct answer set to two decimal places. When she enters the answer in more than 2 decimal places, she received a correct response.

My only lead is that the calculation is rather lengthy, but it yields the correct answers.

Any ideas on where to start?

### Re: Calculated Question: Correct Answer marked as Incorrect

But at first sight it could be a conflict between the 2 decimals correct answer setting and the tolerance limits.

If you correct answer is 1.015 +- 0.001 i.e correct values are between 1.014 and 1.015 and if you set two decimal places then 1.01 and 1.02 will get wrong.

Pierre

### Re: Calculated Question: Correct Answer marked as Incorrect

Hello,

I have been very frustrated lately with certain calculated questions. We are running Moodle v. 1.6.2 (we plan to upgrade this summer).

It seems that the problem is when I set the correct answer to 0 decimal places. When students enter the correct answer tot he nearest whole number, Moodle sees it as incorrect, even though it is correct. (In the editing windows, Moodle lists the answer as correct.) IN fact, in the results window, the student's response matches the correct answer given by Moodle.

I tried setting the correct answer to 2 decimal places, and it seems to work.

The quiz is in adaptive mode with penalites applied. The tolerance is set to 0.01 and the tolerance type is set to Relative.

If there is any advice for me, I would be grateful. (Is more information needed?)

### Re: Calculated Question: Correct Answer marked as Incorrect

Notice your paramters value and the response.

The edit the question and look at third page that shows the values and the error limits.

Locate your dataset item and compare.

Give us the data.

Some of the tolerance and limits and significants figure can be mutually exclusive.

Pierre

P.S. The calculated question code has been merged from head to 1.6. The only differences are in the editing interface that has been changed in 1.8 and 1.9.

### Re: Calculated Question: Correct Answer marked as Incorrect

A sound's sound level is increased from {d1} dB to {d2} dB. How many times louder would you perceive the new sound?

And the formula to calculate the answer is:

pow(2,(({d2}-{d1})/10)) which calculates the answer correctly. I set the tolerance level to .01 and the tolerance type to "Relative." I set the answer to be 0 decimal places, in other words, to the nearest whole number.

In the second page of the editing screen, each variable is set to "a literal from the same question as before".

In the third screen, I have each {d2} set to between 40 and 75 with 1 decimal place and {d1} set to between 10 and 25 with 1 decimal place.

When I preview the question, I enter the correct answer (according to the dataset) to the nearest whole number. The answer matches the answer given in the dataset. Moodle tells me that the answer is incorrect. When I click "Fill with correct" the exact same answer is filled in! Yet, when I type it in, Moodle doesn't like it.

When I enter the answer with decimal places, Moodle marks it correct (it is within the range of acceptable answers).

When I set the question for 1 decimal place instead of two, the question works as designed.

I am really at a loss to explain this. it is frustrating for me and my students when they have the correct answer, but Moodle marks it wrong.

If you have any advice, I would be grateful!

### Re: Calculated Question: Correct Answer marked as Incorrect

in one case the calculated answer was 21 with a range of 20.79 to 21.21

This work correctly on a moodle 1.6.3 version.

This work also for 1.9 the limits are always calculated after the response at the integer level is set.

However UQAM 1.6.3 has a special merge for calculated questions.

I will look at the history and come back

Pierre

### Re: Calculated Question: Correct Answer marked as Incorrect

http://132.208.141.198/moodle_16/

log as user: moodle pw: moodle

and look (and play ) at the question test db

Pierre

### Re: Calculated Question: Correct Answer marked as Incorrect

Hello Pierre,

You have successfully duplicated my issue. The symptoms that I descibed to you happened on your test question.

When the question was set to have 0 decimal places in the response, the server marked my (correct) answer as incorrect. When I selected "fill with correct" it filled in the same whole number that I had typed in. Confusing!

When I set the response to 1 decimal place, things worked well.

I guess that the workaround is to set my responses to include decimal places. This summer we are installing a new server and will install version 1.9.

I sincerely thank you for your time. I am recommending Moodle to every teacher I talk to, even those that do not teach online. It's a great companion to a face-to face course.

### Re: Calculated Question: Correct Answer marked as Incorrect

http://132.208.141.198/moodle_19/

user:moodle pw:moodle

I will look more closely to see if there remain some bad combinations of number of decimals and tolerance.

The problem is that the 0 decimal answer is 8 when the correct mathematrical answer is 7.7 which is outside the tolerance range.

This is also confusing for the students as some will answer 7 and other 8 if you ask for the rounding value. You should always allow a number of decimals (or significant figures) that match the tolerance limits.

Pierre

P.S. Better examples in the docs will help (MDL-7679)

### Re: Calculated Question: Correct Answer marked as Incorrect

Will add some further validation procedure when buiding datasetitems (datasetitems_form.php) so that problems with significant figures and tolerance values are pinpointed and corrected.

Pierre

### Re: Calculated Question: Correct Answer marked as Incorrect

### Re: Calculated Question: Correct Answer marked as Incorrect

More probably the settings of tolerance interval and significant figure are in conflict. Your correct mathematical result 139.03 is outside the other constraint.

Could you give us all the parameters that you set for this answer.

Pierre

### Re: Calculated Question: Correct Answer marked as Incorrect

This are the parameters:

Formula (({a}*{b})-({a}*{b}*{c}/100))+(({a}*{b})-({a}*{b}*{c}/100))*0.19

Tolerance 0 or 0.00

Tolerance Type Nominal

Correct Answer shows 2

decimal places for {a} and {c}: 0

decimal places for {b}: 2

After setting tolerance to 0.01 I got correct results and grades. Can you explain this?

Ralf

### Re: Calculated Question: Correct Answer marked as Incorrect

For example 1/3 = 0,3333 so will be Ok if decimal are set to 3 and tolerance to 0.0004 nominal.

0,333 will be inside the 0,3329333 to 0,333733333 limit.

I am working to put an additional line to tell if the True value is inside or outside(warning) the limits.

See MDL-14433

Pierre

### Re: Calculated Question: Correct Answer marked as Incorrect

Can you add also a little help file to the settings for tolerance?

### Re: Calculated Question: Correct Answer marked as Incorrect

This is part of the plan

see higher in this discussion

P.S. Better examples in the docs will help (MDL-7679)

Pierre