\documentclass[]{exam} % use the 'answer' option to compile solutions
\usepackage{subfiles}
\usepackage[utf8]{inputenc}
\usepackage{lastpage}
\usepackage[american,siunitx]{circuitikz}
\sisetup{detect-all}
\begin{document}
\title{ENGR 40M Final Examination}
\date{INSERT DATE HERE}
\begin{center}
\Large
{\bfseries\makeatletter\@title\makeatother}
\bigskip
Stanford University
\makeatletter\@date\makeatother
\ifanswer
\vspace{1pc}
{\sffamily\bfseries SOLUTIONS}
\vspace{1pc}
\else
\vfill
\begin{tabular}{rp{10cm}}
Name: & \hrulefill \\[1pc]
SUNet ID: & \hrulefill @stanford.edu
\end{tabular}
\vfill
\fi
\normalsize
\begin{tabular}{| >{\bfseries}c | c |}
\hline
Question & \bfseries Points \\
\hline
\hline
% You need to fill this table in yourself, sadly.
1 & 0 \\ \hline
2 & 0 \\ \hline
3 & 0 \\ \hline
4 & 0 \\ \hline
5 & 0 \\ \hline
6 & 0 \\ \hline
\hline
Total & 0 \\
\hline
\end{tabular}
\end{center}
\ifanswer\else
\vfill
\textbf{Instructions:}
\begin{enumerate}[label=\arabic*.]
\item This examination contains \pageref{LastPage} pages, including this page.
\item You have \textbf{three (3) hours} to complete the examination. As a courtesy to your classmates, we ask that you not leave during the last fifteen minutes.
\item Write your answers in this booklet. We scan this into Gradescope, so \textbf{please try to avoid writing on the backs of pages}. If you must do so, please indicate \textbf{very} clearly on the front of the page that you have written on the back of the page.
\item You may use two (2) double-sided 8.5"\,$\times$\,11" pages with notes that you have prepared. You may not use any other resources, including lecture notes, books, other students or other engineers.
\item You may use a calculator. You may not share a calculator with anyone. If you didn’t bring a calculator, you may use your phone, \textbf{but} you must put it on \textbf{flight mode} and clear all visible notifications \textbf{before} the examination starts, and you must not open any applications other than the calculator and a timer.
\item Please sign the below Honor Code statement.
\end{enumerate}
\fbox{\parbox{\textwidth}{
In recognition of and in the spirit of the Stanford University Honor Code, I certify that I will neither give nor receive unpermitted aid on this examination.
\vspace{1cm}
\hspace*{\fill}
Signature: \quad \rule{10cm}{0.5pt}
\hspace*{\fill}
\bigskip
}}
\clearpage
\fi
% Include questions from subfiles here:
\subfile{example}
\end{document}