\documentclass[12pt]{article}
%\usepackage{verbatim}
\usepackage{fancyvrb}
\usepackage{tikz}
\usepackage{exam}
\usepackage{times}
\usepackage{stmaryrd}
\usepackage{mathpartir}
\usepackage{alltt}
\usepackage{enumerate}
\usepackage{xcomment}
\usepackage{algorithm,algorithmic}

% Only needed for demonstration.
\usepackage{lipsum}

\newenvironment{soltt}{\begin{xcomment}{document}}{\end{xcomment}}
\renewcommand{\familydefault}{\sfdefault}

\begin{document}

% When the paper has been written, the number of pages needs to be 
% provided, instead of 11.  (It should be possible to solve this 
% properly with lastpage.)
\pagetot{CSxyz}{11}

\vspace*{-0.3cm}

\newcommand{\solflag}{1} %%% remove %%% from start of line to make answers
\ifx\solflag\undefined
  \newcommand{\sol}[1]{}
  \newcommand{\solonly}[1]{}
\else
  \newcommand{\sol}[1]{\vspace*{-0.05in}\textit{#1}\vspace*{-0.2in}}
  \newcommand{\solonly}[1]{#1}
\fi

% ---------------------------------------------------
%%% Preamble information.
\class{CSxyz\quad Anti-Engineering Methods \\ SPECIMEN SOLUTION}
\vspace*{-0.2cm}

\examdate{XX XXXX 2021} {XX:XX\,-\,XX:XX}{3 hours}

\vspace*{-0.5cm}

\preamble{Attempt THREE questions.}


\input{exam-questions}

\sig{Prof. E.~X.~A.~M. Setter}

\end{document}