Using both exam.cls and probsoln.sty
This example requires two LaTeX runs if you want to reference the number (or total number) of points.\documentclass[addpoints]{exam} \usepackage{probsoln} \showanswers \renewenvironment{solution}% {\par\noindent\textbf{\solutionname}: \ignorespaces}% {\ignorespacesafterend} \begin{document} \begin{center}\bfseries Assignment~1\ifshowanswers\space (Solution Sheet)\fi \end{center} \begin{questions} \question[1] What is the main drawback of ray guns? \begin{onlysolution} \begin{solution} Overheating. \end{solution} \end{onlysolution} \end{questions} \end{document}
Download exam-probsoln.tex or exam-probsoln.pdf.