This question has been modified from this question with added feature. However, when I used \printanswers command, the code gives an error the following error:
! Extra }, or forgotten \endgroup.
\endmulticols ->\par \if@boxedmulticols \egroup
\balance@columns \return@non...
l.24 \end{multicols}
?
My MWE code modified with suggestion from Gonzalo Medina when used with \noprintanswers is given below:
\documentclass{exam}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{adjustbox}
%\printanswers
\noprintanswers
\begin{document}
\begin{questions}
\question
\begin{minipage}[t]{0.65\linewidth}
Consider the network graph shown in the figure, which of the following is NOT a \textit{tree} of this graph?
\begin{choices}
\begin{multicols}{2}
\choice
\adjustbox{valign=t}{\includegraphics[scale=0.2]{example-image-a}}
\choice
\adjustbox{valign=t}{\includegraphics[scale=0.2]{example-image-b}}
\end{multicols}\par
\begin{multicols}{2}
\choice
\adjustbox{valign=t}{\includegraphics[scale=0.2]{example-image-c}}
\CorrectChoice
\adjustbox{valign=t}{\includegraphics[scale=0.2]{example-image-a}}
\end{multicols}
\end{choices}
\end{minipage}\hfill%
\begin{adjustbox}{minipage={0.30\linewidth},valign=t}
\includegraphics[width=\linewidth]{example-image-a}
\end{adjustbox}
\end{questions}
\end{document}
When \printanswers command is used, it should give the output like this highlighting the partlabel corresponding to the \CorrectChoice:
Any suggestion to solve the error when used \printanswer command in the given code!


\CorrectChoiceis last. In this case you can try with\CorrectChoice\endgroup. – touhami Oct 11 '15 at 05:58