testwhat (version 4.2.2)

test_mc: Test a multiple choice exercise

Description

This code expects the DM.result variable to be defined by the DataCamp frontend. There is need to define the success_msg seperately, since it is defined inside the function.

Usage

test_mc(correct, no_selection_msg = NULL, feedback_msgs = NULL)

Arguments

correct
number of the correct answer (or vector of numbers, if several options are fine)
no_selection_msg
feedback message in case the student did not select an answer.
feedback_msgs
vector of feedback messages for both the incorrect exercises as the correct exercise. Order the messages according to how they are listed in the instructions. For example, if there are four options, the second of which is correct, a vector of four feedback messages should be provided. The first message corresponds to feedback on the incorrect selection of the first option, the second message corresponds to the feedback message for the correct collection. The third and fourth messages correspond to feedback on the incorrect selection of the third and fourth option.

Examples

Run this code
## Not run: 
# # Example solution: second instruction correct.
# 
# # Corresponding SCT:
# msg1 <- "Not good, try again!"
# msg2 <- "Nice one!"
# msg3 <- "Not quite, give it another shot."
# msg4 <- "Don't be silly..."
# test_mc(2, feedback_msgs = c(msg1, msg2, msg3, msg4))
# ## End(Not run)

Run the code above in your browser using DataLab