\documentclass{article}
\usepackage{xltxtra}
\usepackage[bloc,completemulti,separateanswersheet,automarks]{automultiplechoice}
\usepackage{multicol}
\usepackage{color}
\setmainfont{Linux Libertine O}
\geometry{paperwidth=215mm,paperheight=330mm,hmargin=2cm,top=2.7cm,footskip=10.5pt,bottom=2cm,headsep=0.2cm}\usepackage{graphicx,wrapfig}\usepackage{tikz}\usepackage{frame,mdframed,fancybox}\begin{document}
\def\AMCmakeTitle#1{\par\noindent\hrule\vspace{1ex}{\hspace*{\fill}\Large\bf #1\hspace*{\fill}}\vspace{1ex}\par\noindent\hrule\par\vspace{1ex}}
\AMCrandomseed{1527384}
\definecolor{amcboxcolor}{named}{gray}
\AMCboxColor{amcboxcolor}
\def\AMCotextGoto{\par \tab{\textit{Please write the answer in a box provided on a separate answer sheet.}}}
\def\AMCotextReserved{\textit{Don't fill.}}
\def\AMCbeginQuestion#1#2{\par\noindent{\bf Question #1} #2\hspace*{1em}}\def\AMCformQuestion#1{\vspace{\AMCformVSpace}\par{\sc Q #1:} }\def\AMCchoiceLabelFormat #1{\footnotesize{#1}} \AMCboxDimensions{size=2.1 ex,shape=oval}\newcommand{\tab}{\hspace*{15pt}}\newcommand{\partab}{\par\vspace*{4pt}\hspace*{15pt}}\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}}\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}}

\include{types_of_nutrition}
\include{types_multi_MCQ}
\include{types_essay}
\include{process_MCQ}
\include{process_multi_MCQ}
\include{limiting_factors_MCQ}
\include{limiting_factors_multi_MCQ}
\include{limiting_factors_graph}
\include{limiting_factors_graph_multi}
\include{leaf_structure_MCQ}
\include{leaf_structure_essay}
\include{leaf_structure_multi_MCQ}


\element{survey}{
\begin{question}{Q001}\scoring{mz=0,auto=1}
This is a \textit{survey} question. It will not be counted towards your score. What do you think of this test?
\QuestionIndicative
\begin{multicols}{3}
\begin{choices}[o]
\wrongchoice{Mission Impossible}
\wrongchoice{Quite hard}
\correctchoice{Medium}
\wrongchoice{Quite easy}
\wrongchoice{Like stealing candy from a baby}
\end{choices}
\end{multicols}
\begin{center}
\includegraphics[width=4cm,keepaspectratio]{baby_wants_candy.png}
\end{center}
\end{question}
}


\onecopy{5}{
\begin{center}\bf\large \begin{minipage}[m]{1.5cm}\begin{center}\includegraphics[width=1.2cm,keepaspectratio]{LogoDY.png}\end{center}\end{minipage}\hspace*{6pt}\begin{minipage}[m]{0.4\linewidth}\begin{flushleft}
     \bf\Large SCIENCE X QUIZ PHOTOSYNTHESIS
\end{flushleft}\end{minipage}\end{center}

\begin{minipage}{0.9\linewidth}\hspace*{15pt} Questions using the sign \multiSymbole{} may have zero, one or several correct answers.  Other questions have a single correct answer.\emph{\textbf{ Negative points}} may be attributed to \emph{very bad} answers.
\end{minipage}\vspace*{-2pt}

\vspace{2mm}\noindent\hrule


\vspace{2ex}

\cleargroup{all}
\cleargroup{structure_questions}
\cleargroup{essay_questions}
\shufflegroup{types_MCQ}\copygroup[2]{types_MCQ}{all}
\shufflegroup{types_multi_MCQ}\copygroup[1]{types_multi_MCQ}{all}
\shufflegroup{process_MCQ}\copygroup[2]{process_MCQ}{all}
\shufflegroup{process_multi_MCQ}\copygroup[1]{process_multi_MCQ}{all}
\shufflegroup{limiting_factors_MCQ}\copygroup[2]{limiting_factors_MCQ}{all}
\shufflegroup{limiting_factors_multi_MCQ}\copygroup[1]{limiting_factors_multi_MCQ}{all}
\shufflegroup{limiting_factors_graph}\copygroup[2]{limiting_factors_graph}{all}
\shufflegroup{limiting_factors_graph_multi}\copygroup[2]{limiting_factors_graph_multi}{all}
\shufflegroup{leaf_structure_MCQ}\copygroup[2]{leaf_structure_MCQ}{structure_questions}
\shufflegroup{leaf_structure_multi_MCQ}\copygroup[1]{leaf_structure_multi_MCQ}{structure_questions}
\shufflegroup{leaf_structure_essay}\copygroup[2]{leaf_structure_essay}{essay_questions}
\shufflegroup{types_essay}\copygroup[1]{types_essay}{essay_questions}
\insertgroup{all}
\\ \textbf{Following three questions refer to the diagram of internal leaf structure below:}\\ 
\begin{center}
\includegraphics[width=10cm,keepaspectratio]{leaf_structure_internal.png}
\end{center}
\insertgroup{structure_questions}
\insertgroup{essay_questions}
\insertgroup{survey}

%\cleargroup{all}
%\begin{flushleft}\textbf{Types of Nutrition}\end{flushleft}\vspace{1.5ex}\par
%\insertgroup{types_MCQ}
%\insertgroup{types_multi_MCQ}
%\textbf{Photosynthesis process}\vspace{1.5ex}\par
%\insertgroup{process_MCQ}
%\insertgroup{process_multi_MCQ}
%\textbf{Essay Questions}\vspace{1.5ex}\par
%\insertgroup{types_essay}
%\insertgroup{limiting_factors_MCQ}
%\insertgroup{limiting_factors_multi_MCQ}
%\insertgroup{limiting_factors_graph}
%\insertgroup{limiting_factors_graph_multi}
%\\ \textbf{Following three questions refer to the diagram of internal leaf structure below:}\\ 
%\begin{center}
%\includegraphics[width=10cm,keepaspectratio]{leaf_structure_internal.png}
%\end{center}
%\insertgroup{leaf_structure_MCQ}
%\insertgroup{leaf_structure_multi_MCQ}
%\insertgroup{leaf_structure_essay}
%\insertgroup{survey}


\clearpage

\AMCformBegin
\begin{center}\bf\large \vspace*{-10pt}\begin{center}\begin{minipage}[t]{1in}\vspace{0pt}\begin{center}\includegraphics[width=1.6cm,keepaspectratio]{LogoDY.png}\end{center}\end{minipage}\begin{minipage}[t]{3in}\vspace{18pt}\begin{center}\Large\hspace*{0.06in}PHOTOSYNTHESIS QUIZ ANSWER SHEET\\\end{center}\end{minipage}\end{center}\vspace*{10pt}\end{center}

{\setlength{\parindent}{0pt}\hspace*{\fill}\hbox{\vbox{\AMCcodeH{student.number}{5}}}\hspace*{\fill}\begin{minipage}{5.8cm}$\longleftarrow{}$\hspace{0pt plus 1cm}Please write your student code in the provided box to the left, and write your full name and class below.\vspace{3ex}

\hfill\namefield{\fbox{\begin{minipage}{.9\linewidth}Name, surname and class:

\vspace*{.5cm}\dotfill

\vspace*{.5cm}\dotfill
\vspace*{1mm}
\end{minipage}
}}\hfill\vspace{5ex}\end{minipage}\hspace*{\fill}
} \vspace*{-4mm}
\\\hspace*{15pt}Make sure you completely fill in the box of the answer that you choose. If you change your answer, please erase the old one completely! Recommend using whiteout (tip-x) for erasing answers.
\vspace{2mm}\noindent\hrule


\begin{multicols}{2}
\AMCform
\end{multicols}
}
\end{document}
