Setting up a Multiple Choice Answer Key
Here's a possible solution using the features provided by the exam
document class and the answers
package:
\documentclass{exam}
\usepackage{answers}
\Newassociation{sol}{Solution}{ans}
\newtheorem{ex}{}{}
\renewcommand\questionlabel{}
\renewcommand\questionshook{\leftmargin0pt}
\begin{document}
\Opensolutionfile{ans}[ans1]
\section{Problems}
\begin{ex}
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{oneparchoices}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{oneparchoices}
\begin{sol}
Socrates
\end{sol}
\end{questions}
\end{ex}
\begin{ex}
\begin{questions}
\stepcounter{question}
\question
One of these numbers is perfect.
\begin{oneparchoices}
\choice $2$
\choice $28$
\choice $5$
\choice $3$
\choice $7$
\end{oneparchoices}
\end{questions}
\begin{sol}
$7$
\end{sol}
\end{ex}
\Closesolutionfile{ans}
\section{Solutions}
\input{ans1}
\end{document}
You could adapt the solution from How keep a running list of strings and then process them one at a time for this purpose:
Code:
\documentclass{article}
\usepackage{pgffor}
\usepackage{enumitem}
\newcommand\AnswersList{}
\newcommand\AddAnswer[1]{\edef\AnswersList{\AnswersList#1\endgraf}}
\newcommand*{\mc}[6]{%
% code to display the multiple choice for #1...#5
\AddAnswer{#6,}%
}%
\begin{document}
\mc{2}{3}{5}{7}{11}{3}
\mc{2}{3}{5}{7}{11}{5}
The list of answers are:
\begin{enumerate}[label=(\arabic*)]
\foreach \answer in \AnswersList {%
\item \answer
}%
\end{enumerate}
\end{document}