# Examples for multiple choice question - several correct choices possible¶

% Is is possible to select more than one answer
\begin{question} % start of question
\text{choices: permutechoices; corrector:fixed}
\explanation{See explanation presented in the lecture}
\permutechoices{1}{3} % determine a random order of questions 1,2 and 3
\type{mc.multiple} %    % Is is possible to select more than one choice

\begin{choice}
\text{-5 = -5}
\solution{true} % correct answer is yes
\end{choice}

\begin{choice}
\text{5 = |-5|}
\solution{true} % correct answer is yes
\end{choice}

\begin{choice}
\text{5 = -5}
\solution{false} % correct answer is no
\end{choice}
\end{question}


\begin{question} % start of question
\text{variables:numbers,function;  corrector:fixed}
\explanation{}
\type{mc.multiple}      % Is is possible to select more than one answer

\begin{variables}
\function{f}{a+b} % defines a function named f
\number{a}{1}
\number{b}{2}
\number{c}{3}
\number{d}{4}
\number{e}{-1}
\end{variables}

\begin{choice}
\text{$f$ = $c$}
\solution{true} % correct answer is yes
\end{choice}

\begin{choice}
\text{$f$ = $d$}
\solution{false} % correct answer is yes
\end{choice}

\begin{choice}
\text{$f$ = $e$}
\solution{false} % correct answer is no
\end{choice}
\end{question}


\begin{question} % start of question
\text{variables:randint; function[calculate]; corrector:fixed}
\explanation{}
\type{mc.multiple}      % Is is possible to select more than one choice

\begin{variables}
\randint[Z]{b}{6}{12}
\randint[Z]{a}{0}{5}

\function{f}{a+b}
\function[calculate]{f_result}{a+b}

\function{g}{a-b}
\function[calculate]{g_result}{a-b}

\function{h}{a*b}
\function[calculate]{h_result}{a*b}
\end{variables}

\begin{choice}
\text{$f$ = $f_result$}
\solution{true} % correct answer is yes
\end{choice}

\begin{choice}
\text{$g$ = $g_result$}
\solution{true} % correct answer is yes
\end{choice}

\begin{choice}
\text{$h$ = $h_result$}
\end{choice}
\end{question}


\begin{question}
\text{variables: randint, randadjustIf; corrector: solution{compute}, iscorrect}
\explanation{Both expressions must have a common denominator before you compare them.}

\permutechoices{1}{2}
\type{mc.multiple}
\field{real}

\begin{variables}
\randint{a}{1}{25}
\randint{b}{2}{35}
\randint{c}{3}{45}
\randint{d}{4}{55}

% If you randomize variables, it could happen, that the random values do not
% satisfy the conditions in the question and have to be adjusted.
%In the given case, we need to ensure that at least one solution is set to TRUE

randadjustIf{a,b,c,d}{a*d >= c*b AND d*c != b*a } % see Part 9 http://team.mumie.net/projects/support/wiki/GenericTexProblems
\end{variables}

\begin{choice}
\text{\frac{$a$}{$b$} < \frac{$c$}{$d$}}
\solution{compute}
\iscorrect{a*d}{<}{c*b}
\end{choice}

\begin{choice}
\text{\frac{$d$}{$a$} = \frac{$b$}{$c$}}
\solution{compute} % the correct answer will be calculate automatically.
\iscorrect{d*c}{=}{b*a} %The use of an additional \iscorrect command is required
\end{choice}
\end{question}


Add picture from clipboard (Maximum size: 500 MB)