egreg has answers for almost every thing. For your first issue, you may use this solution give by egereg:
%%------------------egreg's code starts-------------
\usepackage{environ,xparse}
\ExplSyntaxOn
\cs_undefine:N \choices
\cs_undefine:N \endchoices
\NewEnviron{choices}{%
\par\nopagebreak
\harish_dochoices:V \BODY
\par
}
\tl_new:N \l_harish_choices_tl
\seq_new:N \l_harish_choices_seq
\seq_new:N \l_harish_choices_final_seq
\cs_new_protected:Npn \harish_dochoices:n #1
{
\setcounter{choice}{0}
\tl_set:Nn \l_harish_choices_tl { #1 }
\tl_replace_once:Nnn \l_harish_choices_tl { \CorrectChoice } { \choice* }
\seq_set_split:NnV \l_harish_choices_seq { \choice } \l_harish_choices_tl
\seq_pop_left:NN \l_harish_choices_seq \l_tmpa_tl
\seq_set_map:NNn \l_harish_choices_final_seq \l_harish_choices_seq
{ \exp_not:n { \makechoice ##1 } }
%\seq_map_inline:Nn \l_harish_choices_final_seq { \makebox[.5\linewidth][l]{##1}\hspace{0pt plus .3\linewidth} }
% }
\seq_map_inline:Nn \l_harish_choices_final_seq
{
\makebox[.5\linewidth][l]{
\parbox[t]{.45\linewidth}{\raggedright \hangindent1.5em ##1\strut}
}\hspace{0pt plus .3\linewidth}
}
}
\cs_generate_variant:Nn \harish_dochoices:n { V }
\ExplSyntaxOff
\makeatletter
\NewDocumentCommand{\makechoice}{s}
{%
\stepcounter{choice}
\makebox[1.2em][l]{\IfBooleanT{#1}{\ifprintanswers\CorrectChoice@Emphasis\fi}\Alph{choice}.}
}
\makeatother
\CorrectChoiceEmphasis{\bfseries\boldmath}
%%------------------egreg's code ends-------------
He helped me once upon a time when I was a victim of similar requirement while I was doing some question paper.
For the second issue, you can load the adjustbox
package (as Gonzalo did) but with export
option. This will make keys like valign
etc available for \includegraphics
command. So you have to use
\includegraphics[scale=0.2,valign=t]{example-image-a}
Remember that in this case graphicx
is loaded by adjustbox
.
Here is the full code:
\documentclass{exam}
\usepackage[export]{adjustbox}
%%------------------egreg's code starts-------------
\usepackage{environ,xparse}
\ExplSyntaxOn
\cs_undefine:N \choices
\cs_undefine:N \endchoices
\NewEnviron{choices}{%
\par\nopagebreak
\harish_dochoices:V \BODY
\par
}
\tl_new:N \l_harish_choices_tl
\seq_new:N \l_harish_choices_seq
\seq_new:N \l_harish_choices_final_seq
\cs_new_protected:Npn \harish_dochoices:n #1
{
\setcounter{choice}{0}
\tl_set:Nn \l_harish_choices_tl { #1 }
\tl_replace_once:Nnn \l_harish_choices_tl { \CorrectChoice } { \choice* }
\seq_set_split:NnV \l_harish_choices_seq { \choice } \l_harish_choices_tl
\seq_pop_left:NN \l_harish_choices_seq \l_tmpa_tl
\seq_set_map:NNn \l_harish_choices_final_seq \l_harish_choices_seq
{ \exp_not:n { \makechoice ##1 } }
%\seq_map_inline:Nn \l_harish_choices_final_seq { \makebox[.5\linewidth][l]{##1}\hspace{0pt plus .3\linewidth} }
% }
\seq_map_inline:Nn \l_harish_choices_final_seq
{
\makebox[.5\linewidth][l]{
\parbox[t]{.45\linewidth}{\raggedright \hangindent1.5em ##1\strut}
}\hspace{0pt plus .3\linewidth}
}
}
\cs_generate_variant:Nn \harish_dochoices:n { V }
\ExplSyntaxOff
\makeatletter
\NewDocumentCommand{\makechoice}{s}
{%
\stepcounter{choice}
\makebox[1.2em][l]{\IfBooleanT{#1}{\ifprintanswers\CorrectChoice@Emphasis\fi}\Alph{choice}.}
}
\makeatother
\CorrectChoiceEmphasis{\bfseries\boldmath}
%%------------------egreg's code ends-------------
\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{multicols}{2}
\begin{choices}
\choice
\includegraphics[scale=0.2,valign=t]{example-image-a}
\choice
\includegraphics[scale=0.2,valign=t]{example-image-b}
\choice
\includegraphics[scale=0.2,valign=t]{example-image-c}
\CorrectChoice
\includegraphics[scale=0.2,valign=t]{example-image-a}
\end{choices}
%\end{multicols}
\end{minipage}
\hfill%
\begin{minipage}[t]{0.3\linewidth}
\vspace{-\baselineskip}
\includegraphics[width=\linewidth]{example-image-a}
\end{minipage}
\end{questions}
\end{document}
If you are not struck with exam
class, I suggest you to use exsheets
class which has a native support for this kind of lists.