\answerline to the right of a question

You can remove the separation by patching \answerline with xpatch:

enter image description here

\documentclass[a4paper]{exam}
\usepackage{xpatch}% http://ctan.org/pkg/etoolbox
\xpatchcmd{\answerline}% <cmd>
  {\par\nobreak\vskip\answerskip}% <search>
  {}% <replace>
  {}{}% <success><failure>
\begin{document}
\begin{questions}
\question Write hello  \answerline[hello]
\end{questions}
\end{document}

This will remove the skip for all \answerlines. Alternatively, on a case-by-case basis, you can set \answerskip carefully:

\question Write hello%
\setlength{\answerskip}{\dimexpr-\baselineskip-\parskip}
\answerline[hello]

Further modifications are also possible. The following MWE incorporates the above changes, but also provides a starred variant of \answerline that removes the number before the answer and allows for things to follow \answerline:

enter image description here

\documentclass[a4paper]{exam}
\usepackage{letltxmacro}% http://ctan.org/pkg/letltxmacro
\usepackage{xpatch}% http://ctan.org/pkg/etoolbox
\xpatchcmd{\answerline}% <cmd>
  {\par\nobreak\vskip\answerskip}% <search>
  {}% <replace>
  {}{}% <success><failure>
\xpatchcmd{\answerline}{\fi \par}{\fi}{}{}% Remove line break after \answerline
\makeatletter
\LetLtxMacro{\oldanswerline}{\answerline}
\RenewDocumentCommand{\answerline}{s o}{%
  \begingroup
  \IfBooleanTF{#1}
    {\def\@queslevel{\relax}}% \answerline*
    {}% \answerline
  \IfNoValueTF{#2}
    {\oldanswerline[{}]}% \answerline
    {\oldanswerline[#2]}% \answerline[..]
  \endgroup
}
\makeatother
\begin{document}
\begin{questions}
\question Write hello  \answerline[hello] to your mother
\question Write hello  \answerline*[hello] to your mother
\question Write hello  \answerline[hello] to your mother
\end{questions}
\end{document}

letltxmacro provides the means to store macros with optional arguments created using \newcommand.


You can use the \fillin environment instead. See 5.6 Fill in the blank questions of Using the exam document class

\documentclass[a4paper]{exam}
\begin{document}
\begin{questions}
\question Write hello \fillin[hello] to your mother
\end{questions}
\end{document}