\documentclass{article}
\usepackage[output = exam, numberofversions=3, version = 3]{mcexam}
\usepackage{sagetex}
\usepackage{etex}
\usepackage{amsmath}
\begin{document}
\begin{sagesilent}
var('x')
a= ZZ.random_element(2,7)
f(x) = x^a
\end{sagesilent}
Here goes the title
\begin{mcquestions}
\question How much is $2+2$?
\begin{mcanswerslist}
\answer two
\answer[correct] four
\answer five
\end{mcanswerslist}
\question How much is $5-3$?
\begin{mcanswerslist}
\answer 1
\answer[correct] $\sage{5-3}$
\answer 3
\end{mcanswerslist}
\question How much is $0 \times 2$?
\begin{mcanswerslist}[fixlast]
\answer 1
\answer 2
\answer[correct] none of the above
\end{mcanswerslist}
\question Find the derivative of $\sage{f(x)}$
\begin{mcanswerslist}[fixlast]
\answer $x^\sage{a-1}$
\answer $x^\sage{a+1}$
\answer[correct] $\sage{a}x^\sage{a-1}$
\end{mcanswerslist}
\end{mcquestions}
\end{document}