Show a multiple-choice or single-choice question.
mc_question( title, ..., points = 1, nr_answers = 5, random_answer_order = TRUE, checkbox = TRUE, label = "Select the correct answer(s).", hide_label = FALSE, min_points = 0, mandatory = FALSE, id = NULL, title_container = h6, static_title = NULL ) answer( label, correct = FALSE, always_show = FALSE, weight = c(0, 1), correct_quoted = FALSE )
title | question title. Markdown is supported and by default the title will be rendered dynamically if it contains inline R code. |
---|---|
... | answer options created with |
points | total number of points for the question. Set to |
nr_answers | maximum number of answers to display. At least one correct answer will always be shown.
If |
random_answer_order | should the order of answers be randomized? Randomization is unique for every user. |
checkbox | make a multiple response question, i.e., allow the user to select more than one answer. |
label | answer text to show. Supports markdown formatting and inline code chunks of the form |
hide_label | hide the label from non-screen readers. |
min_points | if |
mandatory | is this question mandatory for submitting the section? If |
id | question identifier to be used instead of the code chunk label. Must only contain
characters |
title_container | a function to generate an HTML element to contain the question title. |
static_title | if |
correct | an expression which, evaluated in the rendering environment, determines if the answer is correct or not. Can also be a simple logical. |
always_show | even if answer options are randomized, always show this answer. |
weight | the weight of this answer, if selected. By default, correct answers have a weight of 1, and incorrect answers have a weight of 0. See details for more information. A negative weight will subtract that proportion of available points from the user's points (e.g., to penalize for selecting incorrect answer options). The sum of all displayed positive weights is standardized to sum to 1, but negative weights are not standardized. |
correct_quoted | is the expression given in |
The weight
of an answer option determines how many points are awarded/subtracted for selecting this answer option.
If correct
is an expression and correctness of an answer option can only be determined at run-time, weight
can be a numeric vector with two elements. The first element is the weight applied if the answer is wrong, the
second element is the weight applied if the answer is correct.
The sum of weights of all displayed correct answers is standardized to sum to 1 (i.e., users selecting all displayed correct answers will get all points), but negative weights are used as given. For example, if the weight of an incorrect answer option is set to -0.5 and the total number of points available for a question is 4, selecting this answer option will reduce the number of points awarded by 2.
Other exam question types:
text_question()