Multiple Choice Quiz

Multiple Choice Quiz

av John Viall -
Antall svar: 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
Gjennomsnittlig vurdering: -
Som svar til John Viall

Re: Multiple Choice Quiz

av Joseph Rézeau -
Bilde av Core developers Bilde av Particularly helpful Moodlers Bilde av Plugin developers Bilde av Testers Bilde av 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

Som svar til Joseph Rézeau

Re: Multiple Choice Quiz

av 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
Som svar til Joseph Rézeau

Re: Multiple Choice Quiz

av 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? smiler Or was the issue here that it didn't?
Som svar til John Viall

Re: Multiple Choice Quiz

av 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.
Som svar til John Viall

Re: Multiple Choice Quiz

av Joseph Rézeau -
Bilde av Core developers Bilde av Particularly helpful Moodlers Bilde av Plugin developers Bilde av Testers Bilde av 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
Vedlegg image00.jpg
Som svar til Joseph Rézeau

Re: Multiple Choice Quiz

av 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?

Som svar til Cristina Berisso

Re: Multiple Choice Quiz

av Joseph Rézeau -
Bilde av Core developers Bilde av Particularly helpful Moodlers Bilde av Plugin developers Bilde av Testers Bilde av 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.

Vedlegg image00.jpg