Calculating marks in a test
Using a weight matrix, Snap has the ability to differentiate between responses to a particular question as being correct or incorrect.
In this example we will set up four multiple choice questions, each with four possible answers. Using weighted variables we will identify the response for a correct as those weighted as one or incorrect for those weighted as zero. Using these numbers the total number of correct responses can be calculated.
Step By Step
Step 1
Create a variable with the following:
| Name: | Q1 |
| Label: | Question Q1 (type your question here) |
| Type: | Question |
| Response: | Single |
| Label: | A (answer here) Value: 1 |
| Label: | B (answer here) Value: 2 |
| Label: | C (answer here) Value: 3 |
| Label: | D (answer here) Value: 4 |
Step 2
Set up three new variables each with for possible answers (codes) naming them Q2, Q3 and Q4.
Step 3
Click on the weights
button to open the Weights window.
Step 4
Select the
button to create a new weight.
At the Weight details dialogue box, enter a Value of 1 for Code 1 and 0 for Code 2,3 and 4. Name this as ScoreA. This will be used for each question where A is the correct answer.
Step 5
Save
the new weight and close the Weights window
.
Step 6
Now create 3 more weights, where B i.e. code 2 is correct (value 1 and all others are 0), C code 3 is correct and D, code 4 is correct. Name these, ScoreB, ScoreC and ScoreD.

Step 7
In between Question 2 and Question 3 create a new variable to total the number of correct responses so far:
| Type: | Question |
| Response | Quantity |
| Name: | Total1 |
| Label: | Section 1 Total |
| Source: | Q1 ScoreA + Q2 ScoreB |
Please note to specify a source in a variable, press the set square and ruler
icon.
Step 8
After Question 4 create a similar variable to total the number of correct responses to this section:
| Type: | Question |
| Response: | Quantity |
| Name: | Total2 |
| Label: | Section 2 Total |
| Source: | Q3 ScoreC + Q4 ScoreD |
Step 9
After Total2 create a new variable:
| Type: | Question |
| Response: | Quantity |
| Name: | Total |
| Label: | Grand Total |
| Source: | Total1 + Total2 |
Step 9
Now press the case data icon
and use the questionnaire mode
to input the responses to the questions. The correct responses will Question 1 = A, Question 2 = B, Question 3 = C and Question 4 = D.
HINT You may also find it useful to hide the name to Total, Total1 and Total2. To do this click into the question, change into styles mode
and specify current question from the scope menu, show from the topics menu and name in the third drop, then untick the show box.
![]()
You should now have a fully working quiz with section scores and a total.