cancel
Showing results for 
Search instead for 
Did you mean: 
Surveyor II

Enter/Return in Quiz answer

Jump to solution

I am trying to write a quiz for my programming students. I want the answer to be written like this: 

What is output by:

print ("1")
print ("\t2")
print ("3")

Answer: 

 

1
 2
3

How can I do that in a Canvas quiz? (Thus, have an enter/return in the answer.)

1 Solution

Accepted Solutions
Navigator

msnodgrass@perryschools.org,

The built-in Canvas types don't support this.

rmurchshafer@unomaha.edu gave some suggestions, but all of them except for multiple choice have data entry flaws and multiple choice may not be what you're after.

The essay question type won't work exactly like you want. You can hit enter, but you cannot easily enter a tab character within the Rich Content Editor. PC users can hold down the alternate key and type 0 9 on the numeric keypad, but that doesn't work for Mac users. The easiest way is to open up another program that supports tabs and then copy/paste it into the box. That's probably not what you're after on a quiz or they could also copy/paste your code into something and run it and then copy/paste the answer back. And, as Rick mentioned, essay questions are not automatically graded.

The multiple dropdowns might not work because the student might not know that there are three lines. Depending on the language being used (PHP for example), I wouldn't get 3 lines, I would get "1   23" all on a single line. I would definitely include that in a multiple choice answer. By the way, you're going to have the same trouble entering tabs in the multiple choice answers as well.

Since you can't easily enter tabs, a student might be tempted to use spaces to make it look right. You might do what Rick suggested, but I would use an underscore instead of a space in his example. Since most output uses a monospaced font but the default one in Canvas isn't, it may be hard to tell what the student has entered. You can switch to preformatted text. Also, some systems use an 8-space tab while others use 4, 2 or some other number. That is, what is visible seems ambiguous to us (your class may not be as confused because you'll be dealing with a specific language). The "1   23" I get in most languages I use (where you have to explicitly add an end of line or carriage return) may end up looking like "1" followed by 7 spaces, followed by "23".

Multiple choice may be the best way you go if you want to use Canvas. People in the math and sciences find lots of areas that run against the same problem, it's just too limited for what we need.

Another way is rework the way the questions are asked.

How many lines does this output take?

(numeric response)

If column 1 is the left-most column, what column does the 2 appear in?

(numeric response)

The print statement automatically adds a carriage return at the end

(true/false).

What does the "\t" represent?

(multiple answer)

* nothing, it's the symbol \ followed by a t

* a horizontal tab

* a vertical tab

* a backspace

* a line feed

* a carriage return

View solution in original post

2 Replies
Community Coach
Community Coach

I don't think you'll be able to do this with a short answer question type as they only get one line to type in (i think).  It would work as an Essay question type, but then you'd have to grade them individually.  

Multiple choice would work, but for the answer choices you'll need to invoke the html editor to have a multi-line answer choice.  You do this by clicking the pencil icon to the right of the answer option when creating the question.

You could also use a multiple fill in the blank question type to kind of work with the code below.  For line1, line2 and line3 you'd need to enter the possible values.  The only problem with this is that I couldn't get it to recognize a required space before 2 in the line 2 response.  So you might need to ask students to use something in place of a space, like maybe "sp2" meaning space followed by 2.

What is output by:

print ("1")
print ("\t2")
print ("3")


Output
Line 1: [line1]
Line 2: [line2]
Line 3: [line3]

Rick

Navigator

msnodgrass@perryschools.org,

The built-in Canvas types don't support this.

rmurchshafer@unomaha.edu gave some suggestions, but all of them except for multiple choice have data entry flaws and multiple choice may not be what you're after.

The essay question type won't work exactly like you want. You can hit enter, but you cannot easily enter a tab character within the Rich Content Editor. PC users can hold down the alternate key and type 0 9 on the numeric keypad, but that doesn't work for Mac users. The easiest way is to open up another program that supports tabs and then copy/paste it into the box. That's probably not what you're after on a quiz or they could also copy/paste your code into something and run it and then copy/paste the answer back. And, as Rick mentioned, essay questions are not automatically graded.

The multiple dropdowns might not work because the student might not know that there are three lines. Depending on the language being used (PHP for example), I wouldn't get 3 lines, I would get "1   23" all on a single line. I would definitely include that in a multiple choice answer. By the way, you're going to have the same trouble entering tabs in the multiple choice answers as well.

Since you can't easily enter tabs, a student might be tempted to use spaces to make it look right. You might do what Rick suggested, but I would use an underscore instead of a space in his example. Since most output uses a monospaced font but the default one in Canvas isn't, it may be hard to tell what the student has entered. You can switch to preformatted text. Also, some systems use an 8-space tab while others use 4, 2 or some other number. That is, what is visible seems ambiguous to us (your class may not be as confused because you'll be dealing with a specific language). The "1   23" I get in most languages I use (where you have to explicitly add an end of line or carriage return) may end up looking like "1" followed by 7 spaces, followed by "23".

Multiple choice may be the best way you go if you want to use Canvas. People in the math and sciences find lots of areas that run against the same problem, it's just too limited for what we need.

Another way is rework the way the questions are asked.

How many lines does this output take?

(numeric response)

If column 1 is the left-most column, what column does the 2 appear in?

(numeric response)

The print statement automatically adds a carriage return at the end

(true/false).

What does the "\t" represent?

(multiple answer)

* nothing, it's the symbol \ followed by a t

* a horizontal tab

* a vertical tab

* a backspace

* a line feed

* a carriage return

View solution in original post