LaTeX exam template

A LaTeX exam template for a midterm or a final you print and hand out, with the answer key in the same file.

First page of the Exam template

Open in LaTeX.to Download all files (zip)

Files:
main.tex

Download main.tex

% addpoints keeps a running total, which is what fills the grade table.
\documentclass[addpoints,12pt]{exam}

\usepackage{amsmath}
\usepackage{amssymb}

% Uncomment the next line to print the answer key: the solutions appear and
% the correct choices are marked. Comment it out again for the student copy.
% \printanswers

\pagestyle{headandfoot}
\firstpageheader{Course 101}{Midterm Exam}{\today}
\runningheader{Course 101}{Midterm Exam}{Page \thepage\ of \numpages}
\firstpagefooter{}{}{}
\runningfooter{}{}{}
\headrule

\begin{document}

\begin{center}
  {\Large\bfseries Course 101: Calculus I} \\[2mm]
  {\large Midterm Exam} \\[2mm]
  University of Somewhere
\end{center}

\vspace{8mm}

% One line per thing the student writes on the cover.
\makebox[\textwidth]{Name:\enspace\hrulefill}

\vspace{6mm}

\makebox[\textwidth]{Student number:\enspace\hrulefill}

\vspace{10mm}

\begin{center}
  \fbox{\parbox{0.86\textwidth}{
    This exam has \numquestions{} questions, for a total of \numpoints{}
    points. You have 90 minutes.

    Write your answers in the space under each question and show your work:
    an answer with no working earns no credit. A basic calculator is allowed,
    notes and phones are not. If you need more room, use the back of the page
    and say so under the question.
  }}
\end{center}

\vspace{10mm}

\begin{center}
  \gradetable[v][questions]
\end{center}

\newpage

\begin{questions}

% Points go in the brackets. A question with parts leaves them off: its points
% are the points of its parts, added up.
\question
Differentiate each function. You do not have to simplify the result.

\begin{parts}
  \part[4] $f(x) = x^3 \ln x$
  \vspace{3cm}

  \part[4] $\displaystyle g(x) = \frac{\sin x}{1 + x^2}$
  \vspace{3cm}
\end{parts}

\question[6]
Which of the following is the derivative of $h(x) = e^{2x}$?

\begin{choices}
  \choice $e^{2x}$
  \CorrectChoice $2 e^{2x}$
  \choice $2x e^{2x - 1}$
  \choice $\dfrac{e^{2x}}{2}$
\end{choices}

\question[4]
The value of $\displaystyle \int_{0}^{1} 3x^2 \, dx$ is

% oneparchoices puts short choices on one line instead of one each.
\begin{oneparchoices}
  \choice $0$
  \choice $\dfrac{1}{3}$
  \CorrectChoice $1$
  \choice $3$
\end{oneparchoices}

\question[10]
Find the equation of the tangent line to the curve $y = x^2 - 4x + 5$ at the
point where $x = 3$.

\begin{solution}
  The derivative is $y' = 2x - 4$, so the slope at $x = 3$ is $2$. The point
  on the curve is $(3, 2)$, and the tangent line is
  \[
    y - 2 = 2(x - 3), \quad \text{that is} \quad y = 2x - 4 .
  \]
\end{solution}

\fillwithlines{5cm}

\question
A ball is thrown upward, and its height in meters after $t$ seconds is
$s(t) = 20t - 5t^2$.

\begin{parts}
  \part[4] Find the velocity of the ball after $t$ seconds.

  \begin{solution}
    $v(t) = s'(t) = 20 - 10t$ meters per second.
  \end{solution}
  \vspace{2.5cm}

  \part[4] At what time does the ball reach its highest point?

  \begin{solution}
    The velocity is zero at $t = 2$ seconds.
  \end{solution}
  \vspace{2.5cm}

  \part[4] How high does it get?

  \begin{solution}
    $s(2) = 40 - 20 = 20$ meters.
  \end{solution}
  \vspace{2.5cm}
\end{parts}

\end{questions}

\end{document}

How to use this template

Everything runs in your browser: nothing to install, no login, no compile timeout.

How to print the answer key

One line switches between the student copy and the key.

How to add a question

Questions and points are counted for you, and the grade table on the cover fills itself in.

How to change the header

The course name and the exam title are set in two places.

More templates: Lecture notes and all templates.