答案1
你必须改变\answerline
定义。它只对部分起作用。
\documentclass{exam}
\makeatletter
\renewcommand\answerline[1][{}]{%
% One optional argument, the default value of which is empty.
\ifx\@queslevel\ques@ref
\let\ans@l=\questionlabel
\else
\ifx\@queslevel\part@ref
\def\ans@ll{\thequestion\thepartno.} % <---
\let\ans@l\ans@ll % <---
\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
\par \nobreak \vskip \answerskip
\hfill
\ifprintanswers
\ans@l~\hbox to 0pt{\hbox to \answerlinelength{\hrulefill}\hss}%
\raise \answerclearance\hbox to \answerlinelength{%
% 2016/05/10: Added \color@begingroup and \color@endgroup:
\color@begingroup
\CorrectChoice@Emphasis \hfil #1\hss
\color@endgroup}%
\else
\ans@l~\hbox to \answerlinelength{\hrulefill}%
\fi
\par
}% answerline
\makeatother
% Longer answer lines
%\setlength\answerlinelength{1.5in}
\begin{document}
\begin{questions}
\question
Subquestions
\begin{parts}
\part[5] $f(x) = x^2+2x+1$. Find $f(2)$. \answerline
\part[5] $g(x) = x^3-2x^2+x+1$. Find $g(3)$. \answerline
\end{parts}
\end{questions}
\end{document}