# How to change text on answerline in exam class

How to replace text on answerline

As per exam class manual; i'm able to add answerline for MCQ using tex mentioned below

\begin{questions}
\question
Who’s buried in Grant’s tomb?
\question
What was the color of George Washington’s white horse?
\question
Which is heavier: A pound of feathers, or a pound of lead?
\end{questions}


which gives output as

I'm looking for option to get it updated as

Can you please suggest; how to achieve this?

-

You can redefine \answerline:

\documentclass{exam}

\makeatletter
% One optional argument, the default value of which is empty.
\ifx\@queslevel\ques@ref
\let\ans@l=\questionlabel
\else
\ifx\@queslevel\part@ref
\let\ans@l=\partlabel
\else
\ifx\@queslevel\subpart@ref
\let\ans@l=\subpartlabel
\else
\ifx\@queslevel\subsubpart@ref
\let\ans@l=\subsubpartlabel
\else
% Oops; no question level defined.
% We must be outide of the questions environment.
% Just leave out the label, I guess:
\def\ans@l{}%
\fi
\fi
\fi
\fi
%\ans@l~
\CorrectChoice@Emphasis \hfil #1\hss}%
\else
%\ans@l~
\fi
\par
\makeatother
\begin{document}

\begin{questions}
\question
Who’s buried in Grant’s tomb?
\question
What was the color of George Washington’s white horse?
\question
Which is heavier: A pound of feathers, or a pound of lead?
\end{questions}

\end{document}


-
Thanks a lot Sir. This is very much useful. – Pawan Mude Feb 10 '14 at 14:14

At the expense of loading an additional package (xpatch), you can quickly patch the existing \answerline macro.

\documentclass{exam}
\usepackage{xpatch}% http://ctan.org/pkg/etoolbox
{\questionlabel}% <search>
{}{}% <success><failure>
\begin{document}
\begin{questions}
\question
Who’s buried in Grant’s tomb?
\question
What was the color of George Washington’s white horse?
\question
Which is heavier: A pound of feathers, or a pound of lead?

I learned about \answerline and patching it from the following questions/answers: