% Load the class with the 'code' option to typeset code snippets
% Then you must have minted installed and compile with the -shell-escape option
\documentclass[]{ntuexam}
\usepackage{lipsum}
\begin{document}
\course{SC4012/CE4067/CZ4067}{SOFTWARE SECURITY}
\quiztitle{SEMESTER 2 EXAMINATION 2024-2025}
\monthyear{Apr/May 2025}
\length{2 hours}
%%%%%%%%%%%%%%%%%%%%%%%%
% Override exam instructions below if necessary
%\makeatletter
%\renewcommand{\printInstructions}{
% \noindent{\bfseries\underline{INSTRUCTIONS}}
%
% \begin{enumerate}[leftmargin=*,labelsep=20pt,topsep=0pt]
% \item This paper contains \numquestions~questions and comprises \pageref{LastPage} pages.
% \item Answer \textbf{ALL} questions.
% \item This is a closed-book examination.
% \end{enumerate}
%}
%\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%
\makeheading
%%%%%%%%%%%%%%%%%%%%%%%%
% Do not print solutions by default
\noprintanswers
% To print solutions, use this instead
% \printanswers
%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%
% BEGIN EXAM QUESTIONS %
%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% QUESTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question \lipsum[1][1]
\begin{parts}
\part[10] \label{part:1a} \lipsum[1][1-2]
\droppoints
\begin{solution}
\lipsum[2][1-4]
\end{solution}
\part[15] \lipsum[1][3] As given in \cref{part:1a}, \lipsum[1][4-5]
\droppoints
\begin{solution}
\lipsum[2][1-3]
\end{solution}
\end{parts}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% QUESTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[25] \lipsum[1][1-3]
\begin{itemize}
\item \lipsum[2][1]
\item \lipsum[2][2]
\item \lipsum[2][3]
\end{itemize}
\lipsum[1][4-6]
\droppoints
\begin{figure}[ht]
%%%%%%% A sample code snippet
%
% \begin{minted}[breaklines]{c}
% void dummy(int a)
% {
% int x = 1, y = 0;
% assert(x - a != 0);
% }
% \end{minted}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\centering
\includegraphics[width=.5\textwidth]{dummy}
\caption{A dummy figure.}\label{fig:test}
\end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=.5\textwidth]{dummy}
\caption{}
\end{figure}
\begin{solution}
\lipsum[2][1-4]
\end{solution}
% This marks the end of a question in case the footnote warning does not work correctly
\addquestionobject
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% QUESTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question
\begin{parts}
\part \lipsum[1][1-3]
\begin{subparts}
\subpart[5] \lipsum[1][1] \label{part:format-read}
\droppoints
\begin{solution}
\lipsum[2][1-2]
\end{solution}
\subpart[5] \lipsum[1][3]
\droppoints
\begin{solution}
\lipsum[2][3-5]
\end{solution}
\end{subparts}
\part[15] \Cref{fig:dummy} \lipsum[1][4-5]
% Override the figure number to Q3 (instead of Q3a)
\renewcommand{\thefigure}{Q3}
\begin{figure}[ht]
\centering
\includegraphics[width=.5\textwidth]{dummy}
\caption{}\label{fig:dummy}
\end{figure}
% Having a figure as the only thing placed on the next page should be avoided.
% \droppoints is placed after the figure as a workaround to ensure that the reminder still appears
% in the footer.
\droppoints
\begin{solution}
\lipsum[2][3-5]
\end{solution}
% This marks the end of a question in case the footnote warning does not work correctly
\addquestionobject
\end{parts}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% QUESTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question
\begin{parts}
\part \lipsum[1][1-3]
\begin{subparts}
\subpart[8] \lipsum[1][1]
\droppoints
\begin{solution}
\lipsum[2][1-2]
\end{solution}
\subpart[7] \lipsum[1][3]
\droppoints
\begin{table}[ht]
\caption{}
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline
\phantom{text} & \phantom{text} & \phantom{text} & \phantom{text} & \phantom{text} \\
\hline
\phantom{text} & \phantom{text} & \phantom{text} & \phantom{text} & \phantom{text} \\
\hline
\end{tabular}
\end{table}
\begin{solution}
\lipsum[2][3-5]
\end{solution}
\end{subparts}
\part[10] \lipsum[1][1-3]
\droppoints
\begin{solution}
\lipsum[2][1-2]
\end{solution}
\end{parts}
\end{questions}
\end{document}