Canvas Quiz Extension
2022 Update:
Works on any domain. But you need to explicitly grant access first.
Import solution as CSV file.
CSV file should have header matching the name of the variables.
Last column of the CSV file is the answer, doesn't matter what you name it, as long as it is not the same name as any of the variables.
Solution table is directly editable after generation. Just click and make any edit before you save the question.
HOW TO USE
You can choose between "Regular" or "Extended"
"Regular" is the standard way, "Extended" will use this extension.
You must generate some valid results to save your question
If you cannot get any valid results under the extended version, you can switch to "Regular" way and enter 1 as the last formula and have it to generate 1 combo, click "Update." You question is updated. Switch back to "extended" the next time you come back to this question.
WARNING!!! It will generate all possible combinations based on your variables. So, if you have 3 variables and each of them has 10 possible values, you will have 1000 possible solutions!
Add custom functions in the "Formula Definition" section
Assign values to variable by:
a = range(start, end, optional: step)
a is your variable defined in the question
start is the starting value
end is the ending value
step is optional, default is 1. You can use negative values
If your range doesn't work (if your step goes the wrong direction), it will return an empty list
Example:
a = range(1,10) <-- will create a list of [1,2,3,4,5,6,7,8,9,10]
a = range(1,5,2) <-- will create a list of [1,3,5]
a = [ 3, 5, 7, 9 ] <-- any custom list with [ ]
a = 2*b + 1 <-- any formula as long as the variables used are defined already
Create custom javascript function by using the "eval:" prefix in your formula.
eval: myFunc = function(a,b) { return a*b }
Then define the variable with your custom function, having a & b being other variables defined in your question:
c = myFunc(a,b)
No graceful error handling here, use at your own risk.
You can't edit the formula. Just add a new one and remove the old one
Special functions:
link( a , b )
link two, or more, variable lists so each element in the lists are corresponding
can be added as one big list: link( a, b, c, d )
or added multiple times, link( a, b ), then link(b, c) which in effect will become link( a, b, c )
Of course, linked variables should be of lists of the same length
filter( a>b)
any boolean expression in javascript style
filter( a != 0 ) --> a not equals to 0
filter( a > b ) --> a > b
filter( a <= b ) ---> a <= b
filter( a == b ) --> a equals to b
filter( a % 2 == 0) --> a "mod" 2 equals 0, or a is an even number
can be added as a list like this: filter( a>b , b>c, a%2 == 0)
or added separately in multiple entries
Math functions
Must use "Math." in front of each math function used. This is a javascript thing.
Ex: Math.PI, Math.pow( a, 2 ), Math.sin( x)...etc
Final answer should be the last line. Don't forget to use javascript Math. functions
You should drag and reorder the formulas so no variables are used before definition
You need to make sure that the "Decimal Places" for the variables and final answer is set correctly. Set them at the original variable section.
Click on the Blue "Generate +" button to generate the result sets.
See WARNING above.
You don't need to specify the number of combinations. It will generate all possible combinations, without repeats.
See an Example at the bottom of this page.
Creating Multiple Choice:
Since calculated question only allows numerical values, your choices have to be 1, 2, 3, ...etc.
The choices must be 1,2,3... Cannot be other numbers.
At the end of your question, create a list like this:
[a1]
[a2]
[a3]
[a4]
[a1],[a2],[a3]... would be your possible answers
You can call the variables whatever you want, but the first variable is always the correct answer. They will be scrambled later.
Add a formula for each of the answers, eg. a1 = 3*x + y, where x and y are variables already defined.
Add a special function mc(a1,a2,a3,a4) as the last formula. This function will take the variables you passed in, scramble them so a1 will be placed under different choices.
Example using eval: custom function
Mutliple Choice Example