# Examples for multiple choice questions - exactly one correct choice¶

\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.unique} % There is always only one correct answer

\begin{choice}
\text{-5 = -5}
\solution{true} % This answer requires a yes
\end{choice}

\begin{choice}
\text{5 = \sqrt{-25}}
\solution{false} % This answer may not be selected
\end{choice}

\begin{choice}
\text{5 = -5}
\solution{false} % This answer may not be selected
\end{choice}
\end{question}


% There is always only one correct answer
\begin{question} % start of question
\text{variables:numbers, functions; corrector:fixed }
\explanation{}
\type{mc.unique} % There is always only one correct answer

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

\begin{choice}
\text{$f$ = $c$}
\solution{true} % This choice is true.
\end{choice}

\begin{choice}
\text{$f$ = $d$}
\solution{false} % This choice is false
\end{choice}

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


% There is always only one correct answer
\begin{question} % start of question
\text{variables:randint, functions; corrector:fixed}
\explanation{}
\type{mc.unique} % There is always only one correct answer

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

\function{h}{a*b}
\function[calculate]{h_result}{(a+1)*b}
\end{variables}

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

\begin{choice}
\text{$g$ = $g_result$}
\solution{false} % This choice is wrong
\end{choice}

\begin{choice}
\text{$h$ = $h_result$}
\solution{false} % This choice is wrong
\end{choice}
\end{question}


\begin{question}
\explanation{Both expressions must have a common denominator before you compare them.}

\permutechoices{1}{2}
\type{mc.unique}
\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 adjust.
\randadjustIf{a,b,c,d}{a<b OR c=d } % 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/b}{<}{c/d}
\end{choice}

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


Add picture from clipboard (Maximum size: 500 MB)