# Printing answer on dotted line exam class

I am making a worksheet for a task for my teachertraining. My worksheet should leave the students enough place to answer, but also show what answer I expect.

The exam-class is perfect for making worksheets, however, I have one problem: I am using dotted lines for answers. If I print the answer, the dotted lines disappear and instead, my answer is printed in a box (which wraps perfectly around the answer, thus not showing how much place I would leave for the students to answer).

Is there some way, to make the answer appear on the dotted lines? This way, I can show my expected answer and how much place I think students would need. I am aware of the answerline-command, but I prefer dotted lines.

EDIT: As per comment, some code to show my problem:

\documentclass[11pt]{exam}

\setlength\dottedlinefillheight{.25in}

\begin{document}
\begin{questions}
\question What is $2 + 2$?
\begin{solutionordottedlines}[0.5in]
This sum equals $4$.
\end{solutionordottedlines}
\end{document}


2) version with answer, but the dotted lines disappeared

\documentclass[11pt, answers]{exam}

\setlength\dottedlinefillheight{.25in}

\begin{document}
\begin{questions}
\question What is $2 + 2$?
\begin{solutionordottedlines}[0.5in]
This sum equals $4$.
\end{solutionordottedlines}
\end{document}


Question: how to combine both documents, such that, when the answer is displayed, it appears on top of the dotted lines, while keeping the original amount of dotted lines?

Based on this answer, with some changes (using ulem package), following solution maybe used.

    \documentclass[11pt, answers]{exam}
\usepackage[normalem]{ulem}
{%
}%
{%
\bigbreak
\egroup
}
\begin{document}
\begin{questions}
\question What is $2 + 2$?
\dotuline{ This sum equals $4$. Hence the answer is "four". Also the answer is $2^2$}
\vspace{0.5cm}
\end{questions}
\end{document}


EDIT: The answer is displayed, it appears on top of the dotted lines, while keeping the original amount of dotted lines.

\documentclass[11pt]{exam}
{%
}%
{%
\bigbreak
\egroup
}
\setlength\dottedlinefillheight{.25in}
\begin{document}
\begin{questions}
\question What is $2 + 2$?
This sum equals $4$. This sum equals $4$. This sum equals $4$. This sum equals $4$. This sum equals $4$.This sum equals $4$. This sum equals $4$. This sum equals $4$. This sum equals $4$.
\begin{solutionordottedlines}[0.5in]
\end{solutionordottedlines}