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 )
question title. Markdown is supported and by default the title will be rendered dynamically if it contains inline R code.
answer options created with
total number of points for the question. Set to
maximum number of answers to display. At least one correct answer will always be shown.
should the order of answers be randomized? Randomization is unique for every user.
make a multiple response question, i.e., allow the user to select more than one answer.
answer text to show. Supports markdown formatting and inline code chunks of the form
hide the label from non-screen readers.
is this question mandatory for submitting the section? If
question identifier to be used instead of the code chunk label. Must only contain
a function to generate an HTML element to contain the question title.
an expression which, evaluated in the rendering environment, determines if the answer is correct or not. Can also be a simple logical.
even if answer options are randomized, always show this answer.
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.
is the expression given in
weight of an answer option determines how many points are awarded/subtracted for selecting this answer option.
correct is an expression and correctness of an answer option can only be determined at run-time,
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: