In some questions, I need to include the different types of tasks or sub-items, e.g., multiple-choice and numeric, in a single exercise. Is this possible in R/exams?
In the example below, assume that Part A and Part B are the tasks and must be within the same exercise. It is clear that they could easily be written in two separate exercises but could they also be combined in a single exercise?
Question 01
Part A
What is the capital of Germany?
a. Bonn
b. Berlin
c. Munich
d. HamburgPart B
What is the population of Germany's capital?
~##ANSWER1##~
Such questions are supported in R/exams and are called cloze
exercises. For worked examples see
boxhist,
boxhist2,
fourfold,
fourfold2,
lm, among others.
The caveat is that such exercises are not supported by all exams2xyz
interfaces. Most importantly, they are supported by exams2moodle
and exams2openolat
, though.
To turn your illustrative example into an Rmd exercise you need:
Question
========
What is the capital of Germany? \#\#ANSWER1\#\#
What is the population of Germany's capital (in millions)? \#\#ANSWER2\#\#
Answerlist
----------
* Bonn
* Berlin
* Munich
* Hamburg
*
Meta-information
================
exname: German capital
extype: cloze
exclozetype: schoice|num
exsolution: 0100|3.669495
extol: 0.1
exshuffle: TRUE
Rendered in Moodle the exercise looks like this:
The \#\#ANSWERi\#\#
placeholders are replaced by the corresponding interaction elements in the final exercise. The answer list in combination with the exclozetype
then provide the information that is necessary to build the interaction elements. Note that the fifth answer list element, corresponding to the population size, is empty.
It is also possible to write cloze
exercises without \#\#ANSWERi\#\#
placeholders but these are then somewhat more limited in how the interaction elements can be controlled. See boxhist vs. boxhist2 and fourfold vs. fourfold2.
The Rnw version of the same exercise is as follows:
\begin{question}
What is the capital of Germany? ##ANSWER1##
What is the population of Germany's capital (in millions)? ##ANSWER2##
\begin{answerlist}
\item Bonn
\item Berlin
\item Munich
\item Hamburg
\item
\end{answerlist}
\end{question}
\exname{German capital}
\extype{cloze}
\exclozetype{schoice|num}
\exsolution{0100|3.669495}
\extol{0.1}
\exshuffle{TRUE}