cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Member

Multi-line answers

Jump to solution

How do you add multiple line answer options to multiple choice questions.

1 Solution

Accepted Solutions
Highlighted

blayton@stjohnschs.org 


If you're using classic quizzes, then click on the pencil at the right of the response and it will open up the Rich Content Editor. That should address the issue of multiple-line answers.

It will allow you to put in Java code there as well as you could anywhere in Canvas (which isn't great). You might want to make the text use the preformatted style, which uses a fixed-width font. Many years ago when I last tested this, I had to choose Preformatted, then view the HTML source, and then paste the code in between the <pre> and </pre> tags.

I don't have Java code, but I tested it with some JavaScript that I had available (code is text as far as Canvas goes). It looks okay if you paste it from the Rich Content Editor, but it adds a <br /> element to each line.

347093_pastedImage_2.png

If you open up the HTML editor and paste it between <pre> and </pre>, it comes out much cleaner looking internally. I even put a blank line after me opening <pre> so that it looks good to me, but it appears that Canvas strips that leading blank line.

347094_pastedImage_3.png

For the students, there's no visible difference, but the first one won't copy/paste cleanly and retain the line breaks while the second one will. The first one either has no line breaks (notepad) or no indentation (Word) when pasted. The second one comes through correctly in notepad bu has no line breaks in Word.

In New Quizzes, every multiple choice question already has the Rich Content Editor selected, so there is no need to click on the pencil first.

View solution in original post

7 Replies
Highlighted
Community Coach
Community Coach

Hi brian.jensen@oregonstate.edu. Could you provide an example of the type of question you wish to ask?  Generally multiple choice questions are designed to have the question stem and list of possible answers students select from (only one, all that are correct, etc.).  Perhaps a different question type would be more useful in your situation.

Thanks!

Highlighted

I also have the same question as above and my example would be wanting to provide a snippet of Java code as answers.  Such as a for loop with executable lines under it.

Highlighted

blayton@stjohnschs.org 


If you're using classic quizzes, then click on the pencil at the right of the response and it will open up the Rich Content Editor. That should address the issue of multiple-line answers.

It will allow you to put in Java code there as well as you could anywhere in Canvas (which isn't great). You might want to make the text use the preformatted style, which uses a fixed-width font. Many years ago when I last tested this, I had to choose Preformatted, then view the HTML source, and then paste the code in between the <pre> and </pre> tags.

I don't have Java code, but I tested it with some JavaScript that I had available (code is text as far as Canvas goes). It looks okay if you paste it from the Rich Content Editor, but it adds a <br /> element to each line.

347093_pastedImage_2.png

If you open up the HTML editor and paste it between <pre> and </pre>, it comes out much cleaner looking internally. I even put a blank line after me opening <pre> so that it looks good to me, but it appears that Canvas strips that leading blank line.

347094_pastedImage_3.png

For the students, there's no visible difference, but the first one won't copy/paste cleanly and retain the line breaks while the second one will. The first one either has no line breaks (notepad) or no indentation (Word) when pasted. The second one comes through correctly in notepad bu has no line breaks in Word.

In New Quizzes, every multiple choice question already has the Rich Content Editor selected, so there is no need to click on the pencil first.

View solution in original post

Highlighted

Thanks for the help.  I saw the pencil for the question and opened the HTML, but for some reason I missed that option for answers.

Highlighted

James -

Thanks for this very useful information.  I have been wanting to know how to easily put formatted code into a quiz.  I never pursued it very far, but this helps a lot.  One question - do you know how to change the tab setting from 8 spaces to 4 or 2 in Canvas?  I am thinking that the functionality to do that in html has been stripped from the html editor that they provide.

Thanks,

Ron

Highlighted

bowmanr@uah.edu 

Canvas does not convert tabs to spaces for you. It's a text editor, not a programmer's editor, and just treats a tab as a U+0009 (character code 9). There is a tab-size CSS property that defaults to 8, but it would control it. You cannot enter that into your HTML, though, as it is not supported by the Canvas HTML Whitelist.

It appears supported while you're using the Rich Content Editor, but it is stripped out when saved.

347065_pastedImage_1.png 347120_pastedImage_2.png

347121_pastedImage_3.png  347122_pastedImage_4.png

but when you save it, it becomes

347123_pastedImage_5.png   347124_pastedImage_6.png

The reliable way to get the desired indenting is to use spaces rather than tabs, although that may break people's ability to copy/paste functioning code (probably not a high priority for a quiz).

Most Code Editors have an option for configuring this or there are normally online code formatters that will allow you to paste your code and then beautify or format it and many have configuration settings.

For example, I use the Online JavaScript Beautifier that supports JavaScript, HTML, and CSS. One of the options at the top of JavaScript is to "Indent with 2 spaces"

347125_pastedImage_7.png

And that can be changed to other flavors

347126_pastedImage_8.png

That's just the one I use most often because Eclipse (my IDE) doesn't format anything with ES6 arrow functions, but they exist for other languages.

You may also be able to work with your Canvas Admin to install a code highlighter library and then you can use Prism, highlight, or some other JavaScript library. They differ in how they're implemented (some use classes some use code as well as pre).

The Canvas Admin may be hesitant to do this as it would get loaded for every student throughout Canvas for the use of just a few and that's an overhead they may not want to do. If your computer science classes were all in a sub-account, it could be added at the sub-account level and not affect as many people. 

One thing to watch out for when you do that is whether it works with the mobile apps. I don't have extensive testing there, but the worst should be that it just doesn't do anything.

Highlighted
Navigator

Are you using the legacy quizzes or the new quizzes? In legacy quizzes, you can use the Rich Content Editor by clicking on the pencil next to the response and change from a single line, text-only answer. Here's a lesson from the Canvas Instructors Guide: How do I create a Multiple Choice quiz question?

I don't use the new quizzes and the lesson in the guide mentions being able to use the Rich Content Editor for the stem and for feedback, but not for the responses themselves. https://community.canvaslms.com/docs/DOC-15070-4152780604