<< Part 15 - Part 17 >>

Part 16: Different Answer Type in one single question

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.
A answer must then be encapsulated:

\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}

Result

A complete example

\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}
    \field{rational}

    \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}
        \text{\\Geben Sie die diskrete Wahrscheinlichkeitsverteilung an: Für $\omega\in\Omega:\;P\left(\{\omega\}\right)=$}
        \solution{f}
    \end{answer}

\end{question}

Result

2. Example

\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}

Result

differentTypes.png (12 KB) Sabine Greiser, 07/05/2017 09:00 AM

differentTypes2.png (52.8 KB) Sabine Greiser, 07/05/2017 09:00 AM

differentTypes3.png (34.6 KB) Sabine Greiser, 07/05/2017 09:07 AM

Differenttypes Differenttypes2 Differenttypes3
Add picture from clipboard (Maximum size: 500 MB)