[Tex/LaTex] Total number of Questions and Grads/Points in Exam class

exam

I am using the exam template and wonder how to count the total number of questions and the total number of marks to provide the totals on a cover sheet (before declaring them)?

Here is what I have. I am sure it is easy, but was not able to find an example or the right commands in the documentation…

Can anybody help?

\documentclass[11pt]{exam}
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
\RequirePackage{tikz, pgflibraryplotmarks}
\usepackage[margin=1in]{geometry}

\begin{document} 

% some hearder and student info here, excluded for simplicity

% instructions
\textbf{Instructions:}

% how to count questions and marks to give the totals on a cover sheet?
This exam contains XXX questions, \numpages pages (including the cover) for the total of XXX marks.

\begin{questions}
% Basic question
\addpoints
\question[10] Differentiate $f(x)=x^2$ with respect to $x$.
% Basic question
\addpoints
\question[10] Differentiate $f(x)=x^3$ with respect to $x$.
\end{questions}

\end{document}

Best Answer

Section 4.7 of the exam document reveals that there are some commands as

\numquestions, \numpages, \numpoints amongst others which just print the value of the relevant counter at the end of the document. exam uses a totcounter - like approach.

Note: \numquestions questions will print 2questions, i.e. either use \numquestions{} questions (as proposed by touhami) or \numquestions\ questions to provide the necessary explicit space.

\documentclass[11pt]{exam}
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
\RequirePackage{tikz, pgflibraryplotmarks}
\usepackage[margin=1in]{geometry}

\begin{document} 

% some hearder and student info here, excluded for simplicity

% instructions
\textbf{Instructions:}

% how to count questions and marks to give the totals on a cover sheet?
This exam contains \numquestions\ questions, \numpages\ pages (including the cover) for the total of \numpoints\ marks.

\begin{questions}
% Basic question
\addpoints
\question[10] Differentiate $f(x)=x^2$ with respect to $x$.
% Basic question
\addpoints
\question[10] Differentiate $f(x)=x^3$ with respect to $x$.
\end{questions}

\end{document}

enter image description here