The standard view of this forum does not always work well with assistive technology. We also provide a simpler view, which still contains all features. Switch to simple view.

Albert Gomez Post 1

12 June 2016, 6:27 AM Edited by the author on 12 June 2016, 6:35 AM

Put Answer in Feedback

Attachment

Dear Tim Hunt,

I'm creating questions in which numerical answers are required and want to show the answer in the General feedback field, so my pupils may see a fully worked-out solution including the answer. Can this be done? For example, using {i} as a wildcard and entering {i}/1000 in the Answer 1 formula box, how can the answer be shown to the pupils after they click on Check?

Imagine the computer generated wildcard {i} is a number such as 12. The correct answer is 0.012. What command (LaTeX or Sprintf or whatever) should I place in the General feedback field to elicit the expected answer, that is, 0.012. (Entering {i}/1000 simply doesn't work and entering \frac{{i}}{1000} just doesn't look as it should, as you can see in the attached screen-print.)

Thanks for your answer,

Al

Tim Hunt Post 2 in reply to 1

13 June 2016, 11:43 AM

Any additional quantities you need to use in the general feedback, you need to compute as additional variables, even if they will not be used in the question text or answers. For example

k = i/1000.

Then, in the General feebdack, you can write [[k]] to display that value.

Albert Gomez Post 3 in reply to 2

14 June 2016, 6:45 AM

Thanks a lot, Tim,

This has solved my problem almost completely. One little bit remains:

I've defined Variable 1 as i=rand_int(1,999), but this almost always gives three-digit numbers. The chances of getting a one- or a two-digit number are minimal, and this is not good for my pupils. Is there a (sprintf) command that works something like loguniform, so that one- and two-digit numbers get a better chance of occurrence?

Thanks again,

Al

Tim Hunt Post 4 in reply to 3

14 June 2016, 10:31 AM

Try

=round(power(10, rand_int(29999)/10000), 0)

That should give almost equal chances of 1, 2 or 3 digits.

Albert Gomez Post 5 in reply to 4

14 June 2016, 3:27 PM

Thanks, Tim, 

It does work. Following your piece of advice, I have defined my Variable 1 as 

i=round(power(10, rand_int(1,29999)/10000), 0)

but this has caused a little mess somewhere else: now my Variable 2, which I intend to be the final answer and which I had defined as

a=i/1000000

displays in scientific notation instead of as a decimal. I guess there is some other (sprintf) command to force my Variable 2 to display as a decimal, is there not?

Best,

Al

Tim Hunt Post 6 in reply to 5

15 June 2016, 12:48 PM

Sorry, I don't know if there is any way to control the formatting.

Albert Gomez Post 7 in reply to 6

15 June 2016, 8:06 PM Edited by the author on 15 June 2016, 8:06 PM

Dear Tim,

After much search, I seem to have come up with a solution. The answer is displayed in decimal notation (instead of in scientific notation) by simply typing the Variable a as [[a,f]] in the General feedback field. Seems to work.

Many thanks for everything,

Al