Different Header on each page

exams seem to have clear designations between subject matters, and to me is almost synonymous with \sectional divisions. So, instead of defining fixed per-page headings, define a \subjectmatter macro that you can change with every subject matter shift.

\documentclass{exam}

\makeatletter
\chead{\@subjectmatter}% Subject matter in centered header
\newcommand{\subjectmatter}[1]{\renewcommand{\@subjectmatter}{#1}\ignorespaces}% Update
\newcommand{\@subjectmatter}{}% Default
\makeatother

\begin{document}

\subjectmatter{Paper Details}
Some details about the paper\ldots

\clearpage

\subjectmatter{Physics}
Questions about physics\ldots

\clearpage

\subjectmatter{Chemistry}
Questions about chemistry\ldots

\clearpage

\subjectmatter{Mathematics}
Questions about mathematics\ldots

\clearpage

\subjectmatter{Biology}
Questions about biology\ldots

\end{document}

The convenience with the above approach is that if you have some subject matter spanning multiple pages, there's not real need to adjust the heading for every page.


A quick and dirty method, using \chead (the same would work for \lhead or \rhead) and a \ifcase ...\fi conditional.

\documentclass[12pt]{exam}


\chead{%
  \ifcase\value{page}
  % empty test for page = 0
  \or Paper Details% page=1
  \or Physics% page = 2
  \or Chemistry% page = 3
  \or Maths% page = 4
  \or Biology% page = 5
  \else
  % Empty chead here!
  \fi
}
\usepackage{blindtext}
\begin{document}
\blindtext[50]
\end{document}

enter image description here