# Part 15: Randomquestionpool¶

With the help of \randomquestionpool it is possible to select from a multitude of questions always exactly the same number for each student.
You use \randomquestionpool to define question groups. A question for the student is selected from each group.
Each question can be of different types. The system randomly selects a question from each group.

Each group is defined by the indices of the questions.

\randomquestionpool{start}{end} --> \randomquestionpool{2}{5}


Here, questions 2, 3, 4 and 5 are grouped together.
The student will see either the 2nd, 3rd, 4th or 5th question.

A similar functionality is offered by \randomquickcheckpool. For examples, see Quickchecks.

### Example¶

Here you can see an example of 4 different questions.
Two question pools are formed.

The first pool contains questions 1 and 2.
The second pool contains questions 3 and 4.

The student sees either the 1st or 2nd question as question 1
and
either the 3rd and 4th question as question 2.

\begin{problem}

\randomquestionpool{1}{2}
\randomquestionpool{3}{4}

\begin{question} % Question 1

\type{mc.multiple}

\lang{de}{
\text{Frage 1}
\explanation{Die Erklärung}
}

\lang{en}{
\text{Question 1}
\explanation{Explanation}
}

\begin{choice}
\text{$-5 = -5$}
\solution{true}
\end{choice}

\begin{choice}
\text{$5 = |-5|$}
\solution{true}
\end{choice}

\begin{choice}
\text{$5 = -5$}
\solution{false}
\end{choice}

\end{question}

\begin{question} % Question 2

\begin{variables}
\randint[Z]{a}{-3}{3}
\randint[Z]{b}{1}{5}
\randint[Z]{c}{1}{2}
\randint[Z]{d}{1}{5}
\randint[Z]{f}{-5}{5}
\matrix[calculate]{v1}{a\\b\\c}
\matrix[calculate]{v2}{d\\f\\0}
\matrix[calculate]{cr}{-c*f\\c*d\\(a*f)-(d*b)}
\function[calculate]{dot}{a*d+b*f}
\end{variables}

\type{input.matrix} %optional, this will be the default answer type.
\field{real}

\lang{de}{
\text{Gegeben sind:\\ $\vec{v1} = \var{v1}, \vec{v2} = \var{v2}$}
}

\lang{en}{
\text{Given:\\ $\vec{v1} = \var{v1}, \vec{v2} = \var{v2}$}
}

%First answer with default type input.matrix
\text{$\vec{v1} \times \vec{v2} =$}
\solution{cr}
\format{3}{1}

\type{input.number} %set a different answer type than the default type
\text{$\vec{v1} \cdot \vec{v2} =$}
\solution{dot}

\end{question}

\begin{question} % Question 3
\type{input.interval}

\text{Write down the Interval from 1 to 3:}
\field{rational}

\text{ A = }
\solution{[1;3]} % or ] for open type, the boundaries should be separated by ";"

\end{question}

\begin{question} % Question 4

\begin{variables}
\number{a}{1/2}
\number{b}{1/3}
\number{c}{1/5}
\end{variables}

\lang{en}{
\text{\textit{Write the set $A$ of numbers $\var{a}$, $\var{b}$, and
$\var{c}$}:}
}

\lang{de}{
\text{\textit{Schreibe die Menge $A$}:}
}

\type{input.finite-number-set}
\field{rational}

\text{$A =$}
\solution{a, b, c}

\end{question}

\end{problem}


### Other examples¶

##### The following 3 questions would be selected by the system due to the 3 \randomquetionpools: Question: Either question 1, question 2 or question 3 Question: 4 or 5 Question: 6 or 7
\begin{problem}
\randomquestionpool{1}{3}
\randomquestionpool{4}{5}
\randomquestionpool{6}{7}

\begin{question}
... % Question 1
\end{question}

\begin{question}
... % Question 2
\end{question}

\begin{question}
... % Question 3
\end{question}

\begin{question}
... % Question 4
\end{question}

\begin{question}
... % Question 5
\end{question}

\begin{question}
... % Question 6
\end{question}

\begin{question}
... % Question 7
\end{question}

\end{problem}

##### The following (one) question would randomly select the system based on the (one) \randomquetionpool: Question: Either question 1, question 2, question 3, question 4, question 5, question 6 or question 7
\randomquestionpool{1}{7}

##### The following 4 questions would randomly select the system due to the 4 randomquetionpools: Question: question 1 Question: 2 or 3 Question: question 4 Question: Either question 5, question 6 or question 7
\randomquestionpool{1}{1}
\randomquestionpool{2}{3}
\randomquestionpool{4}{4}
\randomquestionpool{5}{7}

##### The following 3 questions would randomly select the system due to the 3 randomquetionpools: Question: 2 or 3 Question: question 4 Question: Either question 5 or question 6
\randomquestionpool{2}{3}
\randomquestionpool{4}{4}
\randomquestionpool{5}{6}


Question 1 and question 7 in the code would not be displayed by the system.
If \randomquestionpool is specified, then only questions that are within the indexes are included.

Add picture from clipboard (Maximum size: 500 MB)