Randomised multiple-choice test (exam-randomizechoices)
A multiple-choice test on the exam class whose answer choices are placed in a seeded random order, followed by a key table.
Create an account to use this
- Category
- Teaching
- Document class
exam(exam.cls) — ships with TeX Live- Workflow
- Assignment / problem set — no revision rounds
- Author
- Jesse E. J. op den Brouw
- Source
- CTAN
- Licence
- exam-randomizechoices.sty: The LaTeX Project Public License 1.3. Sample text: Manulyx, CC0 1.0 (free to use, no conditions).
What you get
main.tex— the file that is compiled · 2 KB
These become your files. Editing them afterwards changes your project and nothing else — a project owns its files from the moment it is made.
Link to this template. Send it to a student or co-author: it starts a new paper in this template, through sign-up if they need an account.
https://manulyx.com/start/ctan-teaching-exam-randomizechoices
Source
main.tex — the file that is compiled · 2 KB
\documentclass[11pt,addpoints]{exam}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[randomize]{exam-randomizechoices}
% A fixed seed gives the same order on every compile; change it for a new version.
\setrandomizerseed{2026}
\pagestyle{headandfoot}
\header{Course Code}{Multiple-choice test}{Version 2026}
\headrule
\footer{}{Page \thepage\ of \numpages}{}
\CorrectChoiceEmphasis{\bfseries}
\begin{document}
\begin{center}
{\Large\bfseries Your paper}\\[4pt]
Course Code -- Course Name \quad 20 minutes \quad \numpoints\ points
\end{center}
\noindent\makebox[0.58\textwidth]{Name:\enspace\hrulefill}\hfill
\makebox[0.38\textwidth]{Student ID:\enspace\hrulefill}
\vspace{8pt}
\noindent The choices below are printed in a random order. Circle one answer per question.
\begin{questions}
\question[2] Which value solves
\begin{equation}
2x + 3 = 11 ?
\end{equation}
\begin{randomizechoices}
\choice $x = 3$
\CorrectChoice $x = 4$
\choice $x = 5$
\choice $x = 7$
\end{randomizechoices}
\question[2] Which planet is closest to the Sun?
\begin{randomizechoices}
\CorrectChoice Mercury
\choice Venus
\choice Earth
\choice Mars
\end{randomizechoices}
\question[2] The table gives the boiling point of water at three altitudes. At which altitude
does water boil at about $90\,^{\circ}$C?
\begin{center}
\begin{tabular}{@{}lccc@{}}
\toprule
Altitude (m) & 0 & 1500 & 3000 \\
\midrule
Boiling point ($^{\circ}$C) & 100 & 95 & 90 \\
\bottomrule
\end{tabular}
\end{center}
% keeplast keeps the final choice in place while the others are shuffled
\begin{randomizechoices}[keeplast]
\choice 0 m
\choice 1500 m
\CorrectChoice 3000 m
\choice None of these
\end{randomizechoices}
\question[2] What is the SI unit of force?
\begin{randomizeoneparchoices}
\choice joule
\choice watt
\CorrectChoice newton
\choice pascal
\end{randomizeoneparchoices}
\end{questions}
\newpage
\section*{Answer key}
\printkeytable
\end{document}
The first page, as this template compiles today. Click it to enlarge, and again to shrink. Open the file ↗