% Exam Template Probability and Statistics courses
%
% Using Philip Hirschhorn's exam.cls: http://www-math.mit.edu/~psh/#ExamCls
%
% run pdflatex on a finished exam at least three times to do the grading table on front page.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% These lines can probably stay unchanged, although you can remove the last
% two packages if you're not making pictures with tikz.
\documentclass[11pt]{exam}
    % \printanswers   %    <=========  Comment this to print exam without answers
    \newcommand{\gradingnote}[1]{}
    %\newcommand{\gradingnote}[1]{\hfill {\color{red} \textit{Grading note: } #1}}
    
    \newboolean{addsolutionspace}
    \setboolean{addsolutionspace}{true}
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
\RequirePackage{tikz, graphicx}
\usepackage{color}
\usepackage{multirow, hhline, array, arydshln, blkarray}
\usepackage{txfonts}
\usepackage{hhline, bigstrut}
%\usepackage{calculator, calculus}
\usepackage{soul}
\usetikzlibrary{patterns, plotmarks}
\usepackage{hyperref}
\usepackage{enumerate}
\usepackage{pgfplots, pgfplotstable}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
% By default LaTeX uses large margins.  This doesn't work well on exams; problems
% end up in the "middle" of the page, reducing the amount of space for students
% to work on them.
\usepackage[margin=1in]{geometry}
\newboolean{hasattachment}\setboolean{hasattachment}{false}
\newboolean{openbook}\setboolean{openbook}{false}
\newboolean{opennotes}\setboolean{opennotes}{false}
\newboolean{calculator}\setboolean{calculator}{false}
%\newcommand\openbooktrue{\setboolean{openbook}{true}}
%patch the exam package and change the format of the grade table.
\usepackage{etoolbox}
\makeatletter
\patchcmd{\questions}
  {\def\@currentlabel{\thequestiontitle}}
  {\def\@currentlabel{\thequestion}}
  {}
  {}
\makeatother
% ======================================
		% Here's where you edit the Class, Exam, Date, etc.
		\newcommand{\term}{Semester II Academic Year 2020-2021}
		\newcommand{\classcode}{19Q1}
		\newcommand{\classtitle}{\quad Big Data Application}
		\newcommand{\examiner}{Qin Zhang}
		\newcommand{\examnum}{Final Exam}
		\newcommand{\examdate}{27/06/2021}
		\newcommand{\timelimit}{\qquad 120 Minutes}
		\newcommand{\weight}{100}
		\newcommand{\numberpage}{5}
		\newcommand{\numberquestion}{5}
		\newcommand{\numberpoint}{100} 
		 
		\newcommand{\class}{\classcode -- \classtitle}
		\newcommand{\classShort}{\classcode}
		
		%% == comment the following lines if needed
		\hasattachmenttrue  
		% \openbooktrue
		% \opennotestrue
		\calculatortrue
		
		%% == define instructions
		\newcommand{\instructions}{
			\begin{itemize}
				\item Write your name and student ID on the \textbf{bottom left corner of the first page}. Indicate \textbf{your ID} on the top left corner of each page.
				\item Answer all questions in the space provided. Write \textbf{as many details as possible}. Unanswered questions receive \textbf{ZERO} marks.
				\item \textbf{Organize your work}. Work scattered all over the page without a clear ordering might receive very little credit.
				\item This is an \textbf{OPEN BOOK} exam.
			\end{itemize}
		}
% ======================================
% For an exam, single spacing is most appropriate
\singlespacing
% \onehalfspacing
% \doublespacing
% For an exam, we generally want to turn off paragraph indentation
\parindent 0ex
\everymath{\displaystyle}
\begin{document}
\pgfplotsset{compat=1.17}
\include{Uni_FINexam_header}
%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  questions
%
%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questions}
%\qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}
\qformat{{\bf Problem \thequestion}: (\thequestiontitle) \ \  [\totalpoints \ points] \hfill}
%\qformat{{\bf Problem \thequestion}: \ \  [\thepoints] \hfill}
	\titledquestion{Question One}
        \begin{parts}
            \part[5] Sub-question 1
        		\begin{checkboxes}
        			\choice Choice 1
        			\choice Choice 2
        			\CorrectChoice Choice 3
        			\CorrectChoice Choice 4
        		\end{checkboxes}
\smallskip                
            \part[10] Sub-question 2
        	\begin{solution}
        		Open end question
        	\end{solution}
\fillwithdottedlines{\stretch{1}}
        \end{parts}
	\addemptypage	
	\titledquestion{Question Two}
        \begin{parts}
            \part[5] Sub-question 1
        		\begin{oneparcheckboxes}
        		\smallskip
        			\choice Choice 1
        			\choice Choice 2
        			\CorrectChoice Choice 3
        			\choice Choice 4
        		\end{oneparcheckboxes}
\smallskip
            \part[12] Sub-question 2
        	\begin{solution}
        		Open end question
        	\end{solution}
\fillwithgrid{2in}
        \end{parts}
	\addemptypage	
\end{questions}
% \ifprintanswers
%   % do nothing 
% \else %add empty page
% %add formula sheets
% \newpage
% \input{formulaSheet.tex}
% 	\addemptypage			
% \fi
\end{document}