# exam: Conditionally printing singular/plural form of marks/questions/pages

Following-up this answer, I would like to know to make \NAMEquestions print the word "questions" in case of multiple questions exam and "question" in case of a single question exam?

For example, in a two-question exam, \NAMEquestions prints TWO questions, while in a single question exam, it prints ONE question. The same applies to \NAMEpages and \NAMEpoints.

So, in the MWE below, the desired output is:

This exam contains ONE question in ONE page (including the cover) for a total of TEN marks.

\documentclass[addpoints]{exam}

\usepackage{fmtcount,etoolbox}

\makeatletter
\let\NAMEquestions\numquestions
\patchcmd{\NAMEquestions}{\exam@numquestions}{{\NUMBERstringnum\exam@numquestions}}{}{}
\let\NAMEpages\numpages
\patchcmd{\NAMEpages}{\exam@lastpage}{{\NUMBERstringnum\exam@lastpage}}{}{}
\let\NAMEpoints\numpoints
\patchcmd{\NAMEpoints}{\exam@numpoints}{{\NUMBERstringnum\exam@numpoints}}{}{}
\makeatother

\begin{document}

This exam contains \textbf{\NAMEquestions} in \textbf{\NAMEpages} (including the cover) for a total of \textbf{\NAMEpoints}.

\begin{questions}
\question[10] single question
\end{questions}

\end{document}


You can condition on the value of the respective macros used to print the named numbers:

\documentclass[addpoints]{exam}

\usepackage{fmtcount,etoolbox}

\makeatletter
\let\NAMEquestions\numquestions
\patchcmd{\NAMEquestions}{\exam@numquestions}{{\NUMBERstringnum\exam@numquestions} question\ifnum\exam@numquestions>1 s\fi}{}{}
\let\NAMEpages\numpages
\patchcmd{\NAMEpages}{\exam@lastpage}{{\NUMBERstringnum\exam@lastpage} page\ifnum\exam@lastpage>1 s\fi}{}{}
\let\NAMEpoints\numpoints
\patchcmd{\NAMEpoints}{\exam@numpoints}{{\NUMBERstringnum\exam@numpoints} mark\ifnum\exam@numpoints>1 s\fi}{}{}
\makeatother

\begin{document}

This exam contains \textbf{\NAMEquestions} in \textbf{\NAMEpages} (including the cover) for a total of \textbf{\NAMEpoints}.

\begin{questions}
\question[10] single question
\end{questions}

\end{document}