How can I set a length of \dotfill ? I used \dotfill {3 cm} and \dotfill \phantom{3 cm} without success. I can create a box and put dotted line there, but can it not be simpler?
\documentclass{article}
\begin{document}
Write down your name ? \dotfill \newline
What is your age ? \dotfill {3 cm} and Gender \dotfill {3cm}
\end{document}

\fillinand\answerlinein the answers provide exactly what you are asking for. – gernot Oct 03 '16 at 10:49