The code editor is used to create changing parameters for questions in tests. This way students cannot copy another student's answer if something has to be calculated.
How it works
When creating a test, questions have to be written. These questions can contain numbers or parameters when the students have to do a calculation. To make these numbers change of value for each student, the code editor can be used. In the code editor variables can be created, which later can be used in the question and in the criteria of the question. These variables can be used in the content of a question as well as a subquestion. Also, in the code editor the answer to each question needs to be calculated using the variables, so these variables can be used in the criteria.
How to use the code editor
- Sign in to Ans.
- Create an assignment. Read here how to create an assignment.
- Click Add exercise and give the exercise a title.
- Click Options and select Add code editor. A black box will appear.
- In the code editor, see image below, variables have to be created. To create a variable with a changing value per student, the function random(x,y,step=z) can be used. This function will have a value somewhere between x and y and will have steps of z. This means that when the function has a value between 1 and 4 with steps of 1, the variable can have the values 1, 2, 3 and 4. After creating the right variables, the answers have to be calculated. In the example below, the variables a, b and c are answers to question 1a, 1b, and 1c. Variables can be added up by +, subtracted by -, divided by /, multiplied by * and be done to the power of by **. Make sure to use brackets if needed.
When all variables are calculated, press Run in the top right to run the code and find out if everything works. Also, if something did not work, you can print variables by using print(a) to print the variable a. This way, if running the code gives an error, mistakes can be found in the code. When in the top right Success is displayed, the code works and is also saved.
How to use the created variables in content and questions
- Click Add content or Add question.
- Click Var in the top right of the description block.
- The variable will be shown in a black box with the name as it was given in the code editor. This way it will be visible in the test as a number.
How to use the created variables in criteria
- Click Criteria in the menu on the left.
- Click on a question and select a value in the drop-down menu.
- Set a margin if the students have a margin of error. So 1,0 means the student has a margin of 1%. This value is the answer to this subquestion and will be shown when the question is reviewed.