All CollectionsAuthorsCreate new content
Error carried forward: How to use the function sw_answer
Error carried forward: How to use the function sw_answer

Learn about error carried forward and how to use the function sw_answer

Updated over a week ago

In this article, we will demonstrate how to work with forward-carried errors in tests. We will make a set of two exercises. In the first exercise, we will ask a student to determine a formula for a line through two points. In the second part, we will ask to give the coordinates of the intersection with the x-axis. We will make sure that the student will still be awarded points for the second question if they carry the error forward.

## What is an error carried forward?

Suppose a student is making a test with a question A and a question B. Sometimes the answer to question B is dependent on the answer to question A. So if a student makes a mistake in question A, they will most likely also make that mistake in question B even if they make the exact same calculations but just use their wrong answer in A. In a situation like this, we say that the student “carried the error forward”. Ideally, we want to award points for question B if this happens.

We have a set of exercises containing A and B. To retrieve the student's answer to exercise A, we use `sw_answer(1, 1, ‘%null’)`. Let’s go over what this does.

The first argument is `1` because we want to access the first answer field of the question. The second argument is `1` because we want to access the answers in the first exercise of the set. The last argument is the default value `’%null’`, this is the fallback value in case the student didn’t provide any answer to the specified field. For more details, you can always visit the technical menu. It's not necessary to provide this last argument.

Suppose we have the following question in a test:

The correct answer is y = 7x - 6. But suppose the student writes y = 7x - 7 instead. Then to the follow-up question they’ll give the wrong answer: [1, 0]

To make sure this answer is also accepted in a test we make a new variable. In this example, we give it a descriptive name, but this is optional.

Next, we go to question B and add a solution. We choose the evaluation type `eval statement`.

Now we have to use the student answer from A and the answer in B to see if they carried the error forward. We will write a short Maxima program that returns `true` if they carried the error and `false` otherwise. In this case, they carried the error if the y-coordinate is 0 and if the equation holds when we substitute the values in our equation. Below is an example of how you could do this.

`block(`

`ans_a: \$student_ans_a,`

`ans_b: answer,`

`if ans_b[2] = 0 and subst(x = ans_b[1], ans_a) = 0 then return(true)`

`else return(false)`

`)`

And that’s it. Now if a student makes a test and carries an error they can still be automatically awarded points.

## Why don't we use "Error carried forward" in practice mode?

In practice mode, we only want to allow the student to make question B if they actually got question A correct. So by design of our platform, it is impossible to carry an error forward. The `sw_answer` function still works, and you can use it in various different creative ways if you please.