Looking at the source of exam.cls there is a if@bonus
that you can use to test if you are typesetting a bonus or a regular question. Hacking a bit you can do something like
\makeatletter
\newcommand\thetotalpoints{%
\if@bonus
[\totalbonuspoints\ bonus points]
\else
[\totalpoints\ points]
\fi
}
\makeatother
\qformat{Question \thequestion: \thetotalpoints \hfill}
With the probsoln
package, problems can be defined either within the document or in an external file that can be loaded using a command such as \loadallproblems
or \loadrandomproblems
.
Here's a simple example with the problems defined in the document:
\documentclass{article}
\usepackage{probsoln}
\begin{defproblem}{prob1}% label
\begin{onlyproblem}% question
Calculate the following:%
\begin{textenum}
\item $7+2$
\item $9-9$
\item $5+5+5$
\end{textenum}
\end{onlyproblem}%
\begin{onlysolution}% solution
\begin{textenum}
\item $9$
\item $0$
\item $15$
\end{textenum}
\end{onlysolution}
\end{defproblem}
\begin{defproblem}{prob2}% label
\begin{onlyproblem}% question
Solve the following equations:
\begin{textenum}
\item $x+5=7$
\item $x-5=9$
\item $5x=20$
\end{textenum}
\end{onlyproblem}%
\begin{onlysolution}% solution
\begin{textenum}
\item $x=2$
\item $x=14$
\item $x=4$
\end{textenum}
\end{onlysolution}
\end{defproblem}
\begin{document}
\renewcommand{\labelenumii}{\theenumii)}
\begin{enumerate}
\foreachproblem{\item\thisproblem}
\end{enumerate}
\section*{Solutions}
\showanswers
\begin{enumerate}
\foreachsolution{\item\thisproblem}
\end{enumerate}
\end{document}
This produces

The formatting can be changed. For example, using the enumitem
package:
\documentclass{article}
\usepackage{probsoln}
\usepackage{enumitem}
\begin{defproblem}{prob1}% label
\begin{onlyproblem}% question
Calculate the following:%
\begin{textenum}
\item $7+2$
\item $9-9$
\item $5+5+5$
\end{textenum}
\end{onlyproblem}%
\begin{onlysolution}% solution
\begin{textenum}
\item $9$
\item $0$
\item $15$
\end{textenum}
\end{onlysolution}
\end{defproblem}
\begin{defproblem}{prob2}% label
\begin{onlyproblem}% question
Solve the following equations:
\begin{textenum}
\item $x+5=7$
\item $x-5=9$
\item $5x=20$
\end{textenum}
\end{onlyproblem}%
\begin{onlysolution}% solution
\begin{textenum}
\item $x=2$
\item $x=14$
\item $x=4$
\end{textenum}
\end{onlysolution}
\end{defproblem}
\newenvironment{ExerciseList}
{\begin{enumerate}[label={\emph{Exercise \arabic*}},%
ref={\arabic*},wide]
\renewcommand{\labelenumii}{\theenumii)}%
}
{\end{enumerate}}
\newcommand{\exercise}{\item\mbox{}\par}
\begin{document}
\begin{ExerciseList}
\foreachproblem{\exercise\thisproblem}
\end{ExerciseList}
\section*{Solutions}
\showanswers
\begin{ExerciseList}
\foreachsolution{\exercise\thisproblem}
\end{ExerciseList}
\end{document}
This produces:

Edit:
Here's an alternative where you can write the answer next to the question in the code:
\documentclass{article}
\usepackage{probsoln}
\usepackage{enumitem}
\newcommand{\QA}[2]{%
\begin{onlyproblem}#1\end{onlyproblem}%
\begin{onlysolution}#2\end{onlysolution}}
\begin{defproblem}{prob1}% label
\begin{onlyproblem}% question
Calculate the following:%
\end{onlyproblem}%
\begin{textenum}
\item \QA{$7+2$}{$9$}
\item \QA{$9-9$}{$0$}
\item \QA{$5+5+5$}{$15$}
\end{textenum}
\end{defproblem}
\begin{defproblem}{prob2}% label
\begin{onlyproblem}% question
Solve the following equations:
\end{onlyproblem}%
\begin{textenum}
\item \QA{$x+5=7$}{$x=2$}
\item \QA{$x-5=9$}{$x=14$}
\item \QA{$5x=20$}{$x=4$}
\end{textenum}
\end{defproblem}
\newenvironment{ExerciseList}
{\begin{enumerate}[label={\emph{Exercise \arabic*}},%
ref={\arabic*},wide]
\renewcommand{\labelenumii}{\theenumii)}%
}
{\end{enumerate}}
\newcommand{\exercise}{\item\mbox{}\par}
\begin{document}
\begin{ExerciseList}
\foreachproblem{\exercise\thisproblem}
\end{ExerciseList}
\section*{Solutions}
\showanswers
\begin{ExerciseList}
\foreachsolution{\exercise\thisproblem}
\end{ExerciseList}
\end{document}
The result is the same as the previous example.
Edit 2:
Here's a method that defines and displays the problem. The label is generated automatically:
\documentclass{article}
\usepackage{probsoln}
\usepackage{enumitem}
\newcommand{\QA}[2]{%
\begin{onlyproblem}#1\end{onlyproblem}%
\begin{onlysolution}#2\end{onlysolution}}
\newenvironment{ExerciseList}
{\begin{enumerate}[label={\emph{Exercise \arabic*}},%
ref={\arabic*},wide]
\renewcommand{\labelenumii}{\theenumii)}%
}
{\end{enumerate}}
\newcommand{\exercise}{\item\mbox{}\par}
\newcommand{\Exercise}[2]{\exercise
#1\par
\begin{defproblem}{prob\arabic{enumi}}%
\begin{textenum}%
#2%
\end{textenum}%
\end{defproblem}%
\useproblem{prob\arabic{enumi}}%
}
\begin{document}
\begin{ExerciseList}
\Exercise{Calculate the following:}%
{%
\item \QA{$7+2$}{$9$}
\item \QA{$9-9$}{$0$}
\item \QA{$5+5+5$}{$15$}
}%
\Exercise{Solve the following equations:}
{%
\item \QA{$x+5=7$}{$x=2$}
\item \QA{$x-5=9$}{$x=14$}
\item \QA{$5x=20$}{$x=4$}
}
\end{ExerciseList}
\section*{Solutions}
\showanswers
\begin{ExerciseList}
\foreachsolution{\exercise\thisproblem}
\end{ExerciseList}
\end{document}
Best Answer
Something like this?
If you only want the text of the question in boldface, here's a different set of patches.