JohnPaul
Based on the answer https://tex.stackexchange.com/a/582183/18545
```
\documentclass[12pt,a4paper]{article}
\usepackage{xsim}
\usepackage{tasks}
\NewTasksEnvironment[
label = \textbf{\Alph*.} ,
label-width = 15pt
]{choice}[\choice](4)
\DeclareExerciseEnvironmentTemplate{item}
{\description\item[\GetExerciseName~\GetExerciseProperty{counter}]}
{\enddescription}
\DeclareExerciseEnvironmentTemplate{space}
{\textbf{\GetExerciseProperty{counter}} }
{\quad}
\newcommand*\answer[1]{%
\XSIMexpandcode{%
\SetExerciseProperty{solution-body}
{\noexpand{\Alph{task}}}}%
#1%
}
\DeclareExerciseCollection{part-A}
\xsimsetup{
exercise/template = item ,
solution/template = space ,
exercise/name = Q. ,
exercise/the-counter = \arabic{exercise}. ,
exercise/collect ,
random/sort = false
}
\begin{document}
\collectexercises{part-A}
\begin{exercise}
What is the product of $-2$ and $3$?
\begin{choice}
\choice \answer{$-6$}
\choice $6$
\choice $5$
\choice $-5$
\end{choice}
\end{exercise}
\begin{exercise}
What is the sum of the sides of a polygon called?
\begin{choice}(2)
\choice Leg
\choice \answer{Perimeter}
\choice Area
\choice Volume
\end{choice}
\end{exercise}
\begin{exercise}
What is the sum of $-2$ and $-3$?
\begin{choice}
\choice $-6$
\choice $6$
\choice $5$
\choice \answer{$-5$}
\end{choice}
\end{exercise}
\begin{exercise}
Number four
\end{exercise}
\begin{exercise}
Number five
\end{exercise}
\collectexercisesstop{part-A}
\section{Problems}
\printrandomexercises[collection=part-A]{5}
\section{Answers}
\printsolutions[headings=false]
\end{document}
```
I have 5 multiple-choice questions. How can I generate multiple versions of an exam from these questions so that, in each version, both the order of the questions and the order of the answer choices are randomized?