Multiple Choice Quiz

Multiple Choice Quiz

by John Viall -
Number of replies: 9
I'm trying to make the following quiz question, and was wondering if there is a way to display the choices like the following example.

Which of the following does NOT perform the following task: print correct if answer is equal to 7 and incorrect if answer is not equal to 7?
a. if ( answer == 7 )
cout <<"correct";
else
cout <<"incorrect";

And while I'm asking questions, is there a way to default the number of multiple choice answers to 4 before having to add more blank answers?

Thanks,
John
Average of ratings: -
In reply to John Viall

Re: Multiple Choice Quiz

by Joseph Rézeau -
Wužiwarjo-wobraz wo Core developers Wužiwarjo-wobraz wo Particularly helpful Moodlers Wužiwarjo-wobraz wo Plugin developers Wužiwarjo-wobraz wo Testers Wužiwarjo-wobraz wo Translators

Hi John,

Please never ever cut and paste text from your word processor (MS Word or other) into the moodle HTML editor. It will paste loads of ugly code (as displayed in your message above).sad

Joseph

In reply to Joseph Rézeau

Re: Multiple Choice Quiz

by John Viall -
Sorry about that, I thought I cleaned all the "ugly code" before posting.

Next time, I will double and triple check. blush

Thanks,
John
In reply to Joseph Rézeau

Re: Multiple Choice Quiz

by Olli Savolainen -
Or, if you need to, I guess the button (with the Word document icon) in the editor still works, to clean up the code? smile Or was the issue here that it didn't?
In reply to John Viall

Re: Multiple Choice Quiz

by John Viall -
Here is the question without the "ugly code". big grin

I'm trying to write a multi-line answer in a multiple choice quiz, how can I do this and preserve the formatting (indents, etc.).

Which of the following does NOT perform the following task: print correct if answer is equal to 7 and incorrect if answer is not equal to 7?
a. if ( answer == 7 )
cout << "correct";
else
cout << "incorrect";

And while I'm asking questions, is there a way to default the number of multiple choice answers to 4 before having to add more blank answers?

Thanks,
John

P.S. Apparently, I can't indent the answers even here. While this isn't AS important for a C++ course, it is important in a Python, so any help will be appreciated.
In reply to John Viall

Re: Multiple Choice Quiz

by Joseph Rézeau -
Wužiwarjo-wobraz wo Core developers Wužiwarjo-wobraz wo Particularly helpful Moodlers Wužiwarjo-wobraz wo Plugin developers Wužiwarjo-wobraz wo Testers Wužiwarjo-wobraz wo Translators
Is that what you would like to display? could you please provide a couple more choices, also formatted and tell us which one is correct (I haven't the faintest). The solution is to type your choice text in one of the HTML editors on the edit question page, go to the HTML CODE, copy the code into the choice line-window...
Joseph
Attachment image00.jpg
In reply to Joseph Rézeau

Re: Multiple Choice Quiz

by Cristina Berisso -

It looks to me that what he wants is to have a few spaces of indentation on the line after the "if" and after the "else", so that it would read like:

if ( answer ==7)
    cout << "correct" ;

else
    cout << "incorrect" ;

So all he needs is to play a little in HTML with the break tag and the "nbsp" non-breaking-space tag.

Am I expressing what you really want to do?

In reply to Cristina Berisso

Re: Multiple Choice Quiz

by Joseph Rézeau -
Wužiwarjo-wobraz wo Core developers Wužiwarjo-wobraz wo Particularly helpful Moodlers Wužiwarjo-wobraz wo Plugin developers Wužiwarjo-wobraz wo Testers Wužiwarjo-wobraz wo Translators

@Cristina

I think the main part of the OP's request was to have a multi-line choice Answer in the MCQ, and also indenting. That feature is not immediately available when editing the MCQ question choices, so I advised using e.g. the feedback HTML editor window to format his choice text, then copy the code to the choice Answer window (see attached). Unfortunately, the &nbsp; (non-breaking space entities) in the HTML code window do not "stick", i.e. if you re-edit your code you'll find that they have disappeared.sad

Joseph

PS.- It would be good to have the reaction of the original poster.

Attachment image00.jpg