exam is based on article, and thus the figure environment is
defined. You can define a new environment using a minipage, but i
do not recommend to redefine the original figure-environment.
But doing this, the order of the figures (and the captions) can
be messed up pretty badly. You need to decide, let them all
float, or let none float.
--Edit--
@tohecz made me aware of the solution environment. This is a
serious thing. Traditional floats will just be lost. The just
defined questionfigure environment works, but there is another thing.
There is a switch to print answers, or not. If not, the counter
will still be refstepped and can make everything look more
than odd if no answers are printed. I would recommend to define
separate environments for questions (always printed) and
answers/solutions (only printed if toggled). This would take care
of the numbering. But then a question arises: Do you need figures
that can be referenced if inside a framed (default) environment?
I defined two separate environments and gave them pretty dumb names. Referencing to figures in question will always work, no matter if called from a question or an answer. Referencing from answers to other answers (or rather the pics in them) works as well. Referencing an answerfigure in a question will not work if printanswers is false, but what would be the use-case? »Ha Ha, there will be a real great image in the answer, but can't see it!«
Disclaimer: If you compile the following (and you should) you need to use your imagination. No ducks were harmed while writing this answer.
\documentclass[
answers
]{exam}%based on article
\usepackage{xcolor}
\usepackage{tocbasic}
\usepackage[tocindentauto]{tocstyle}
\DeclareNewTOC[
name=questionFigure,
listname={List of questionfigures},
type=qfigure,
nonfloat]{loq}
\DeclareNewTOC[
name=answerFigure,
listname={List of answerfigures},
type=afigure,
nonfloat]{loa}
\makeatletter
\renewcommand\theqfigure{\thenumquestions}
\newenvironment{questionfigure}{%
\begin{center}%
\begin{minipage}[c]{\linewidth}%
\def\@captype{qfigure}%
}{%
\end{minipage}%
\end{center}%
}
\renewcommand\theafigure{\thenumquestions-\alph{afigure}}
\newenvironment{answerfigure}{%
\begin{center}%
\begin{minipage}[c]{\linewidth}%
\def\@captype{afigure}%
}{%
\end{minipage}%
\end{center}%
}
\makeatother
\newcommand\rplcPic{\rule{4cm}{3cm}}
\usepackage{hyperref}
\begin{document}
\listofqfigures
%Print the list of afigures only if answers toggled
\ifprintanswers
\listofafigures
\fi
\begin{questions}
\question Name a place where the lights are always on.
\begin{solution} The light in my fridge is always
on.
\begin{answerfigure}
\rplcPic
\caption{Almost all refridgerators
provide the feature of \emph{eternal}
light.}
\end{answerfigure}
\end{solution}
\question Look at the following picture. What do
you conclude?
\begin{questionfigure}
\rplcPic
\caption{An open fridge. What do you conclude?}
\label{fridge}
\end{questionfigure}
\begin{solution}
Seeing the footprints in the butter, i can conclude that there must
have been an elephant in there earlier.
\end{solution}
\question Homer was one of the greatest greek
philosophers. Sum up his philosophy in as few words as
possible.
\begin{solution}
Beer, Donuts.
\end{solution}
\question Nucleaar weapons are terrible. Describe and
explain the physical reactions of an atomic bomb.
\begin{solution}
A picture is worth more than a thousand words.
\begin{answerfigure}
\begin{verbatim}
_-^--^=-_
_.-^^ -~_
_-- --_
< >)
| |
\._ _./
```--. . , ; .--'''
| | |
.-=|| | |=-.
`-=#$%&%$#=-'
| ; :|
_____.,-#%&$@%#&#~,._____
\end{verbatim}
\caption{BOOOM}
\label{boom}
\end{answerfigure}
\end{solution}
\question When to \emph{Duck and cover}?
\begin{solution} See \autoref{boom}!
\end{solution}
\question{Is it easy to change a refridgerator light bulb?}
\begin{solution} Sure, according to \autoref{fridge} an elephant
lives in there. Just place the light bulb inside, the
elephant will do the work.
\end{solution}
\question You see a block of iron glowing with an orange color
(see the picture).
What does that tell you about the temperature?
\begin{questionfigure}
{\color{orange!40!white}{\rplcPic}}
\caption{A gloowing block of iron}
\end{questionfigure}
\begin{solution} Oh, that's hot. Can't touch this!
\end{solution}
\question Did you ever use Plan 9 from Bell Labs?
\begin{solution} 42! Glenda is cool. See \autoref{boom}.
\end{solution}
\end{questions}
\end{document}