Answer types

Type of questions and answers

There are two levels at which one can set types of answers within a question. Either on question
level in which case the same input-type is assumed for each answer field, or within each answer
environment separately. In this case one can have different types of answers within one question.
(see Different Answer Type)

Multiple choice tasks can also be wrapped by an answer environment in order to have MC-tasks and
input fields in one question (see below).

Setting the type is done by the \type{...}-command, and the position of the command determines
how it works.

Example 1 (one type for all answers fields):

1
2
3
4
5
6
7
8
9
10
11
12
\begin{question}
    \type{input.number} % set for all answers
 
    \begin{answer}
        ...
    \end{answer}
 
    \begin{answer}
        ...
    \end{answer}
 
\end{question}

Example 2 (possibly different types for each answer):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
\begin{question}
    \type{input.generic} % optional
 
    \begin{answer}
        \type{input.number} % this answer has to be a number
        ...
    \end{answer}
 
    \begin{answer}
        \type{input.function} % this answer is a function
        ...
    \end{answer}
 
    \begin{answer}
        \type{mc.multiple} % this answer block consists of a MC-question.
        ...
    \end{answer}
 
\end{question}

In the second example, the command \type{input.generic} can be omitted, but each answer
environment needs to have a \type{...}-command. It is not possible to set a specific type
on question level and just overwrite it for some answers.

Notice that some features like [\permuteAnswers](input.fields.md#permutable-answers) won't be available if a question has different types of answers.

What type is applicable

Multiple Choice types

More detailed information on MC questions can be found under the following link:
Multiple choice questions

Here is just an overview of the types:

Type Preview
mc.multiple


example
mc.multiple
mc.unique


example
mc.unique
mc.yesno


example
mc.yesno
mc.matrix


example in WebMiau or the full article here
mc.matrix

input-types

More detailed information on input field questions can be found under the following link:
Overview input field questions

Here is just an overview of the types:

Type Preview
input.number


more
input.number
input.finite-number-set

more

By default only numbers (e.g. 1, 5, 1.2, 2/3) are accepted values for the user input. With the command \allowForInput the set of valid symbols for the input can be extended. That allows for example to ask for multiple of pi: \allowForInput{+ - * / pi}.
input.finite-number-set
input.function
Compare the user's answer numerically
with the pre-given solution

more
input.function
input.cases.function
Designed for case differentiations of e.g. absolute value functions.
Note that you can only use this input type in an answer environment.

more

input.cases.function
input.interval


Details
input.matrix
If the solution to a question is a row vector, a column vector or a matrix,
the generic problem is of the type input.matrix.

example in WebMiau (cross product)

Use checkAsFunction for comparing matrices with (multivariate) functions as matrix entries.

example in WebMiau (Jacobian matrix)
input.matrix
input.text


examples in WebMiau or the full article here
input.text
input.truth-table


Details
input.truth-table