DifferentAnswerType

It is possible to combine different types of answers in a single question. The type of the answer is then defined at the answer level and not in the question.

Examples

A answer must then be encapsulated:

1
2
3
4
5
6
7
8
9
10
11
12
\begin{answer}
    \type{input.function}
    \text{input.function: $\var{g} = $}
    \solution{g}
    \checkAsFunction{x}{-10}{10}{100}
\end{answer}
 
\begin{answer}
    \type{input.number}
    \text{input.number: $\var{a} = $}
    \solution{a}
\end{answer}

differentTypes

Complex Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
\begin{problem}
 
    \begin{variables}
        \number{a}{1}
        \number{b}{8}
        \function{f}{a/b}
    \end{variables}
 
\begin{question}
    \lang{de}{
        \text{Die Seiten eines homogenen Oktaeders sind mit denBuchstaben $A,B,C,D,E,F,G,H$ bezeichnet.\\
            \image{image1} \\
            Formulieren Sie ein geeignetes stochastisches Modell. Wählen Sie die Zeile aus, in der die Grundmenge $\Omega$ angegeben ist.
        }
    }
 
    \type{input.generic}
 
    \begin{answer}
        \type{mc.unique}        
        \permutechoices{1}{4}
 
        \begin{choice}
            \text{$\Omega = \{ A, B, D, E, F, G, H \}$}
            \solution{false}
        \end{choice}
 
        \begin{choice}
            \text{$\Omega = \{ A, B, D, E, F, G, H, I \}$}
            \solution{false}
        \end{choice}
 
        \begin{choice}
            \text{$\Omega = \{ A, B, C, D, E, H \}$}
            \solution{false}
        \end{choice}
 
        \begin{choice}
           \text{$\Omega = \{ A, B, C, D, E, F, G, H \}$}
           \solution{true}
        \end{choice}
    \end{answer}
\\
    \begin{answer}
        \type{input.number}
        \field{rational}
        \text{\\Geben Sie die diskrete Wahrscheinlichkeitsverteilung an: Für $\omega\in\Omega:\;P\left(\{\omega\}\right)=$}
        \solution{f}
    \end{answer}
 
\end{question}

differentTypes2

Next Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
\begin{problem}
    \begin{variables}
        \randint{a}{-3}{3}
        \randint[Z]{b}{-3}{3}
        \randint{c}{-3}{3}
        \randint{d}{-3}{3}
        \function[calculate]{x1}{a/b}
        \function[calculate]{x2}{c+d}
        \function{f}{-cos(7x)}
        \function{g}{7sin(7x)}
        \function{h}{abs(abs(x-1)+2x)}
        \string{j}{7sin(7x)}
        \matrix{m}{1 & 2 \\ 3 & 4}
 
        \randint{c1}{-10}{10}
        \randint{c2}{2}{5}
        \function[calculate]{c3}{c1*c2}
        \randint[Z]{d1}{-10}{10}
        \randint{d2}{1}{5}
        \randint{n}{0}{6}
    \end{variables}
 
    \begin{question}
        \lang{de}{
            \text{\textbf{one question with different input answer types}}
        }
 
        \type{input.generic}
        \field{real}
        \precision{3}
 
        \begin{answer}
            \type{input.function}
            \text{input.function: $\var{g} = $}
            \solution{g}
            \checkAsFunction{x}{-10}{10}{100}
        \end{answer}
 
        \begin{answer}
            \type{input.number}
            \text{input.number: $\var{a} = $}
            \solution{a}
        \end{answer}
 
        \begin{answer}
            \type{input.matrix}
            \text{input.matrix: $\var{m} = $}
            \format{-1}{-1}
            \solution{m}
        \end{answer}
 
        \begin{answer}
            \type{input.interval}
            \text{input.interval: $[1;3] = $}
            \solution{[1;3]}
        \end{answer}
 
        \begin{answer}
            \type{input.finite-number-set}
            \text{input.finite-number-set: $\{\var{a}; \var{c}; \var{d}\} = $}
            \solution{a,c,d}
        \end{answer}
 
        \begin{answer}
            \type{input.cases.function}
            \text{input.cases.function: $\var{h} = $}
            \solution{h=IFELSE{x>=1}{3x-1}{IFELSE{x<-1}{-x-1}{x+1}}}
        \end{answer}
 
        \begin{answer}
            \type{input.text}
            \text{input.text: valid string = }
            \inputAsString{t}
            \solution{j}
            \checkStringsForRelation{valid(t)}
        \end{answer}
 
        \begin{answer}
            \type{mc.multiple}
            \lang{de}{\text{W\"{a}hlen Sie alle richtigen Aussagen aus:}}
            \lang{en}{\text{Select all the correct statements:} }
            \permutechoices{1}{5}
 
            \begin{choice}
                \lang{de}{\text{$\var{a}$ ist eine nat"urliche Zahl.}}
                \lang{en}{\text{$\var{a}$ is a natural number.}}
                \solution{compute}
                \iscorrect{a}{>}{0}
            \end{choice}
 
            \begin{choice}
                \lang{de}{\text{$\var{b}$ ist eine rationale Zahl.}}
                \lang{en}{\text{$\var{b}$ is a rational number.}}
                \solution{true}
            \end{choice}
 
            \begin{choice}
                \lang{de}{\text{$\frac{\var{c3}}{\var{c2}}$ ist eine ganze Zahl.}}
                \lang{en}{\text{$\frac{\var{c3}}{\var{c2}}$ is an integer.}}
                \solution{true}
            \end{choice}
 
            \begin{choice}
                \lang{de}{\text{$\var{d1}\cdot (-\var{d2})$ ist eine nat"urliche Zahl.}}
                \lang{en}{\text{$\var{d1}\cdot (-\var{d2})$ is a natural number.}}
                \solution{compute}
                \iscorrect{d1}{<}{0}
            \end{choice}
 
            \begin{choice}
                \lang{de}{\text{$1:\var{n}$ ist eine ganze Zahl.}}
                \lang{en}{\text{$1:\var{n}$ is an integer.}}
                \solution{compute} %
                \iscorrect{n}{=}{1}
            \end{choice}
 
            \begin{choice}
                \lang{de}{\text{Keine der Aussagen ist richtig.}}
                \lang{en}{\text{None of the above statments is correct.}}
                \solution{false}
            \end{choice}
 
        \end{answer}
 
    \end{question}
 
\end{problem}

differentTypes3