Create a “choose between ” questions with exam class

I want to create an exam that has 2 parts: Part 1 will be some questions that students are force to do, and part 2 will be a choose x questions among y to do.

If it weren't for the score, I could simply use the \uplevel to specify so, but if I use \addpoints and \gradetable, I can't get the score to display as I'd like.

Does anyone knows if you can create something like that with the exam class?

Here is a MWE of what does not work:

\documentclass[addpoints,12pt]{exam}
\begin{document}
\newline Questions \ref{d} to \ref{e} are mandatory
\begin{questions}
\question[20] \label{d} Some question here
\question[20] Some other question here
\question[20] Do these parts
\begin{parts}
\part[10] First
\part[10] Second
\end{parts}
\question[20]\label{e} Do this too
\uplevel{Choose only one of the next 2 question}
\question[20] Stuff here
\question[20] Stuff here
\end{questions}
\end{document}


What I'd like on the grade table is the total to add up to 100, and maybe even break it into 2 sections if that is possible. What I have tried is to add a \noaddpoints after the penultimate question, but this gives the last question a score of 0 in the grade table.

Breaking the exam into 2 question environment does not work either.

Edit The only thing I've found so far is to put the last question as bonus questions, and then use the \bonusgradetable instead, but that feels weird.

-
Would you mind adding a minimal working example (MWE)? It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – clemens Dec 2 '12 at 16:07
@cgnieder Added something – Jean-Sébastien Dec 2 '12 at 16:21
@Jean-Sébastien I have done this already in an exam I just wrote. I will post my solution in a few minutes. – azetina Dec 4 '12 at 17:17

Here is a sample of my exam basic structure. I know there is room for improvement but I haven't had much time to deal with it. After consultation with the author the exam class, adding:

\makeatletter
\newcommand{\firstquestion}[1]{%
\@ifundefined{tbl@#1@firstq}%
{0}%
{\csname tbl@#1@firstq\endcsname}%
}
\newcommand{\lastquestion}[1]{%
\@ifundefined{tbl@#1@lastq}%
{0}%
{\csname tbl@#1@lastq\endcsname}%
}
\newcounter{qcounter}
\newcommand{\numqinrange}[1]{%
\setcounter{qcounter}{\lastquestion{#1}}%
\stepcounter{qcounter}%
\arabic{qcounter}%
}
\makeatother
%---------------------------------------------------------------------


to the preamble enables the user to access the number of questions in a range with the command \numqinrange{myrange}, first with \firstquestion{myrange} and last question with \lastquestion{myrange}. See the example below:

\documentclass[letterpaper,addpoints]{exam}
\usepackage[bottom=3cm,top=3cm,right=2cm,left=2cm]{geometry} % Optional geometry specifications
\usepackage{amsmath,amssymb,tikz,calc}                       % Optional packages
\usepackage{lipsum}
\parindent0pt
%--------------------------------------------------------------------
% Thanks to the author of the exam class Philip Hirschhorn
% This adds the option to count the number of questions in the range.
% Thus we would use \numqinrange{myrange} to get the number of questions in the range.
% You can also say \firstquestion{myrange} to get the first question and \lastquestion{myrange} to get the last question.

\makeatletter
\newcommand{\firstquestion}[1]{%
\@ifundefined{tbl@#1@firstq}%
{0}%
{\csname tbl@#1@firstq\endcsname}%
}
\newcommand{\lastquestion}[1]{%
\@ifundefined{tbl@#1@lastq}%
{0}%
{\csname tbl@#1@lastq\endcsname}%
}
\newcounter{qcounter}
\newcommand{\numqinrange}[1]{%
\setcounter{qcounter}{\lastquestion{#1}}%
\stepcounter{qcounter}%
\arabic{qcounter}%
}
\makeatother
%---------------------------------------------------------------------

\firstpageheader{Intermediate Algebra$|$MTH103}{Final Exam}{November 30, 2012}
\firstpagefooter{}{Please go on to the next page\ldots}{Page \thepage\ of \numpages}
\runningfooter{}{\iflastpage{AT THIS POINT, GO OVER YOUR WORK}{Please go on to the next page\ldots}}{Page \thepage\ of \numpages}

% This command is specific to a question so not really needed here.
\def\Bsqr{%
\lower1ex\hbox{%
\begin{tikzpicture}
\draw (0,0)rectangle(0.5,0.5);
\end{tikzpicture}}}

\begin{document}

\begin{coverpages}
\lipsum[1-2]

% Defining the grading tables. We use \fullwidth to ensure it acts as an instruction.
\fullwidth{\Large \textbf{Structured Questions}}
\begin{flushleft}
%
% Grading table for the structured questions, Part A and Part B range.
\hfill
\vskip0.5\baselineskip\hfill
\end{flushleft}
\vfill
\hrule\vspace{0.125cm}
\centerline{DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO}
\end{coverpages}

% Structured questions section.
\fullwidth{\Large \textbf{Structured Questions}}
\vskip\baselineskip
% Implementing the \numqinrange{myrange} to count the number of question in the  structured section grading range
\begin{questions}
\question
\begin{parts}
\part Simplify the following numerical expressions.\label{q1}
\begin{subparts}
\subpart[3] $\dfrac{9^{-1}2^3}{3^2}\cdot \dfrac{(-3)^3}{-2^3}$\label{q1a}\vskip\baselineskip
\subpart[3] $\dfrac{\frac{2}{5}-\left|\frac{5}{3}-\frac{5}{2}\right|}{\frac{2}{5}\div 6\div\left(-\frac{2}{39}\right)}$\label{q1b}\vskip\baselineskip
\end{subparts}
\part[2] Use the results in (\ref{q1}) above to place the appropriate relational symbol ($<,>,\mbox{ or }=$) to make the following statement true.
$\dfrac{9^{-1}2^3}{3^2}\cdot \dfrac{(-3)^3}{-2^3} \quad \Bsqr \quad \dfrac{\frac{2}{5}-\left|\frac{5}{3}-\frac{5}{2}\right|}{\frac{2}{5}\div 6\div\left(-\frac{2}{39}\right)}$
\part[4] If the results in (\ref{q1}) are rational numbers, determine their decimal representation and describe it (i.e. state whether it is terminating or recurring.)\label{q3}
\part[2] Using (\ref{q3}.) above, approximate (\ref{q1a}) and (\ref{q1b}) in (\ref{q1}) to 2 s.f. and 2 d.p. respectively.
\end{parts}\vspace{0.25cm}
\fullwidth{\hrulefill\par\flushright \textbf{Total Points: \pointsonpage{\thepage} points}}
\newpage
%--------------------------------------------------------------------------
\fullwidth{\Large \textbf{Optional Questions}}
\vskip0.5\baselineskip
\fullwidth{This section contains 2 subsections: Part A and Part B. Choose \textbf{ONE} subsection and answer \textbf{all} questions.}\vskip0.25\baselineskip
\fullwidth{%
\fbox{%
\makebox[\dimexpr\textwidth-2\fboxsep-0.79999pt\relax]{%
\rule{0pt}{1cm}\Large%
\newlength{\word}
\settoheight{\word}{\Large\textbf{Part A}}
\raisebox{\dimexpr1cm-2\word\relax}{\textbf{Part A}}}}}
\vskip\baselineskip
\question Let $f(x)=2x^3+11x^2-7x-6$
\begin{parts}
\part[1] Use the Rational Zeros Theorem to determine the potential rational zeros for $f(x)$.
\part[3] Hence, factorize completely $f(x)$.
\part[3] Solve $f(x)=0$.\vskip\baselineskip
\end{parts}
\fullwidth{\hrulefill\par\flushright \textbf{Total Points: \pointsonpage{\thepage} points}}
\newpage
\fullwidth{%
\fbox{%
\makebox[\dimexpr\textwidth-2\fboxsep-0.79999pt\relax]{%
\rule{0pt}{1cm}\Large%
%\newlength{\word}
\settoheight{\word}{\Large\textbf{Part B}}
\raisebox{\dimexpr1cm-2\word\relax}{\textbf{Part B}}}}}
\vskip\baselineskip
\question[5] Find the \textbf{sum} of $a$, $b$, $c$ and $d$ if $\dfrac{x^3-2x^2+3x+5}{x+2}=ax^2+bx+c+\dfrac{d}{x+2}$.\vskip\baselineskip
\question
\begin{parts}
\part[8] Show that $\dfrac{x+3}{x^2-y^2}\div\dfrac{x^2+2x-3}{x^2+xy}-\dfrac{y}{x^2-x-xy+y}=\dfrac{1}{x-1}$
\part[6] Simplify $3-\dfrac{3}{\raisebox{1.1ex}{$1-$}\left(\raisebox{1.1ex}{$\dfrac{3}{3-\dfrac{\mathstrut 3}{x^2}}$}\right)}$\vskip\baselineskip
\end{parts}