\documentclass{exam}
\usepackage[utf8]{inputenc}
\usepackage{sagetex}
\begin{document}
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
Answer the questions in the spaces provided. If you run out of room
for an answer, continue on the back of the page.}}}
\end{center}
\vspace{5mm}
\makebox[\textwidth]{Name and section:\enspace\hrulefill}
\vspace{5mm}
\makebox[\textwidth]{Instructor’s name:\enspace\hrulefill}
\begin{questions}
\question Compute the prime factorization of $\sage{ZZ.random_element(10,600)}$.
\question Find the derivative of
$$
f(x) = \sage{QQ['x'].random_element(3)}.
$$
\question What is the determinant of $$A = \sage{random_matrix(ZZ, 3)}?$$
\end{questions}
\end{document}