1

In preparation of an exam sheet, I would like the order of questions to change randomly each time I compile the tex file. This is useful for the multiple choice and True/False questions since this reduces the possibility of fraud. I am using

\documentclass{exam}

to prepare the exam sheet. More precisely, I would like the order of questions to change randomly in each section: a different order of questions in multiple choice questions section and similarly for the section for T/F questions.

The sample code:

\documentclass{exam}
\usepackage{amsmath}

%\printanswers
\newcommand{\tf}[1][{}]{%
    \fillin[#1][0.25in]%
}

\begin{document}
\section{Multiple Choice Questions}

\begin{questions}
    \question What is the name of the warmest season in the northern hemisphere?

    \begin{checkboxes}
        \choice Spring 
        \correctchoice Summer
        \choice Autumn
        \choice Winter
    \end{checkboxes}

    \question Which colour is not one of three main colours?

    \begin{checkboxes}
        \choice blue 
        \choice red
        \choice yellow
        \correctchoice brown
    \end{checkboxes}

\section{True/False Questions}

\question \tf[T] Is it true that $2+3=5$?

\question \tf[F]Albert Einstein invented the steam engine in the 18th century. T/F 

\end{questions}
\end{document}
2
  • 2
    The question linked to has only a very poor link-only answer – Scott Seidman Nov 29 '17 at 12:12
  • 2
    @CarLaTeX, The question you linked to uses class examdesign instead of exam. I want to know if I can do this in exam class. – Ali Nov 29 '17 at 12:59

Browse other questions tagged or ask your own question.