%%% Copyright (c) 2017 Jorre Vannieuwenhuyze.
%%%
%%% Permission is granted to copy, distribute and/or modify this
%%% software under the terms of the LaTeX Project Public License
%%% (LPPL), version 1.3c or any later version.
%%%
%%% This software is provided 'as is', without warranty of any kind,
%%% either expressed or implied, including, but not limited to, the
%%% implied warranties of merchantability and fitness for a
%%% particular purpose.


\documentclass[a4paper]{article}

\usepackage[output=concept
           ,numberofversions=4
           ,version=1
           ,seed=1
           ,randomizequestions=true
           ,randomizeanswers=true
           ,writeRfile=true
           ]{mcexam}
    
% Packages used for special things
\usepackage{tikz,framed} 

% Set headers and footers
\usepackage{fancyhdr,lastpage}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt} 
\renewcommand{\footrulewidth}{1pt}
\lfoot{\mctheversion}
\rfoot{Page \thepage\ of \pageref{LastPage}}

% Ensure each question+answers is printed entirely on the same page.
\usepackage{calc}
\renewenvironment{setmcquestion}{\begin{minipage}[t]{\linewidth-\labelwidth}}{\end{minipage}\par}  
 
  

  


\begin{document}






\begin{center}
  \bfseries\LARGE Example Exam \texttt{mcexam} Package 
\end{center}

\begin{framed}
  \centering\bfseries\Large\MakeUppercase{\mctheversion}
\end{framed}

\mcifoutput{concept,exam}{ 

  \bigskip
  
  \noindent Name: \dotfill\\[.5\baselineskip]
  \noindent Student Number: \dotfill\\[.5\baselineskip]
  \noindent Program: \dotfill  
  
  \vspace{2\baselineskip}
  
  \noindent\textbf{Instructions:}
  \begin{itemize}[nosep]
   \item Answer all questions.
   \item Fill in the answers on the answer sheet.
  \end{itemize}  
  
  }
 



 
\begin{mcquestions}
        
        
       
\begin{mcquestioninstruction}
The next question is about the sky. 
\end{mcquestioninstruction}

\question What is the color of the sky?
         
          \begin{mcanswerslist}[fixlast]
          \answer[correct] blue
          \answer green
          \answer red
          \answer yellow
          \answer none of the above
          \end{mcanswerslist}        
          
          \begin{mcexplanation}
          If you look up to the sky and there are no clouds, you'll see it is blue.
          \end{mcexplanation}
                   
          \begin{mcnotes}
          This question had a large proportion of good answers last year.
          \end{mcnotes}
          
          
          
          
\question Which figure is a square?
          \begin{mcanswers}
          \begin{tabular}{@{}cccc}
          \answer{1}{\tikz{\draw (-0.66,0)--(0.66,0)--(0,1)--cycle;}}& 
          \answer{2}{\tikz{\draw (0,0)--(2,0)--(2,1)--(0,1)--cycle;}}& 
          \answer[correct]{3}{\tikz{\draw (0,0)--(1,0)--(1,1)--(0,1)--cycle;}}& 
          \answer{4}{\tikz{\draw (0,0) circle[radius=0.5];}}\\
          \answernum{1}&\answernum{2}&\answernum{3}&\answernum{4}\\
          \end{tabular} 
          \end{mcanswers}

          
          
  
          
\begin{mcquestioninstruction}
Questions \ref{ref1} to \ref{ref2} are about maths.
\end{mcquestioninstruction}

\question What is the value of $\pi$?\label{ref1}

         \begin{mcanswerslist}[{1,2,3,4},{2,3,4,1},{3,4,1,2}]
         \answer[correct] 3.14 
         \answer 2.19
         \answer a billion
         \answer 0
         \end{mcanswerslist}
         
         \begin{mcexplanation}
         $\pi$ is 3.14
         \end{mcexplanation}
    
\question[follow] How much is 2 + 2 ?

         \begin{mcanswerslist}[ordinal]
         \answer 3
         \answer[correct] 4 
         \answer 5
         \answer 6
         \answer 7
         \end{mcanswerslist}

         
\question[follow] The square root of 2 is \ldots\label{ref2}
         
         \begin{mcanswerslist}[fixlast]
         \answer 2.1 
         \answer[correct] smaller than 2 
         \answer larger than a billion
         \answer none of the above
         \end{mcanswerslist}
    
          
\question Which statement is correct?
          
          \begin{mcanswerslist}[{1,2,3,4},{2,1,4,3},{3,4,1,2},{4,3,2,1}]
          \answer The moon is a planet.
          \answer The moon is a star.
          \answer The sun is a planet.
          \answer[correct] The sun is a star.
          \end{mcanswerslist}

\question Which is the letter alpha?
 
          \begin{mcanswers}
          \begin{tabular}{cccc}
          \answer[correct]{1}{\Huge$\alpha$} & 
          \answer{2}{\Huge$\beta$}  & 
          \answer{3}{\Huge$\gamma$} & 
          \answer{4}{\Huge$\delta$} \\[0.1\baselineskip]
          \answernum{1}&\answernum{2}&\answernum{3}&\answernum{4}\\
          \end{tabular} 
          \end{mcanswers} 


 
 
 
\question What year did Albert Einstein die?

          \begin{mcanswerslist}[ordinal]
          \answer 1949
          \answer 1954
          \answer[correct] 1955
          \answer 1960         
          \end{mcanswerslist}



\question Which is the largest planet in the solar system?

          \begin{mcanswerslist}
          \answer[correct] Jupiter
          \answer Neptune
          \answer Earth
          \answer Mars
          \end{mcanswerslist}


\question What colour is Cerulean?

          \begin{mcanswerslist}
          \answer Red
          \answer[correct] Blue
          \answer Yellow
          \answer Green
          \end{mcanswerslist}
          
\question What are a group of Dolphins called?

          \begin{mcanswerslist}
          \answer School
          \answer Herd
          \answer[correct] Pod
          \answer Pool
          \end{mcanswerslist}

\question Who invented Penicillin?

          \begin{mcanswerslist}
          \answer[correct] Alexandra Fleming
          \answer Thomas Edison
          \answer Marie Curie
          \answer George Orwell
          \end{mcanswerslist}

\question What date was President John F Kennedy assassinated?

          \begin{mcanswerslist}[{1,2,3,4},{1,3,2,4},{4,3,2,1},{4,2,3,1}]
          \answer November 22 1962
          \answer November 24 1962
          \answer[correct] November 22 1963
          \answer November 24 1963
          
          \end{mcanswerslist}

\question How many men have walked on the moon?

          \begin{mcanswerslist}[ordinal]
          \answer 5
          \answer 9
          \answer 10
          \answer[correct] 12
          \end{mcanswerslist}

\question Who has won the most Academy Awards?

          \begin{mcanswerslist}
          \answer James Cameron
          \answer[correct] Walt Disney
          \answer Katherine Hepburn
          \answer Steven Spielberg
          \end{mcanswerslist}

\question What is the currency of Brazil?

          \begin{mcanswerslist}[{1,2,3,4},{2,1,3,4}]
          \answer Dollar
          \answer[correct] Real
          \answer Dollar \emph{and} Real
          \answer None of the above
          \end{mcanswerslist} 
 
 
 
 
 
\question Is this the last question? it is a very long question which spans several lines of the document.

          \begin{mcanswerslist}[permutenone]
          \answer[correct] yes
          \answer no
          \end{mcanswerslist}
          
          \begin{mcexplanation}
          It may not be the last question in your exam, but it is the question which was last programmed.
          \end{mcexplanation} 
 
 
\end{mcquestions}





\mcifoutput{concept,exam}{ 

  \vspace{2\baselineskip}
  
  \noindent\textbf{Instructions:}
  \begin{itemize}[nosep]
   \item You finished the exam!
   \item Hand in the answer sheet.
  \end{itemize}  
  
  }






 
 
 
\end{document}
