创建带有考试类别的“选择题”

创建带有考试类别的“选择题”

我想创建一个包含两部分的考试:第 1 部分是一些学生必须做的问题,第 2 部分是从 y 个问题中选择 x 个问题来做。

如果不是因为分数,我可以简单地使用\uplevel来指定,但如果我使用\addpoints\gradetable,我就无法按我想要的方式显示分数。

有人知道你是否可以用这个exam班级创造类似的东西吗?

以下是不起作用的 MWE:

\documentclass[addpoints,12pt]{exam} 
\begin{document} 
\gradetable
\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 
\noaddpoints 
\begin{parts}
\part[10] First 
\part[10] Second 
\end{parts} 
\addpoints
\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}

我希望成绩表上的总分加起来为 100,如果可能的话,甚至可以将其分成两部分。我尝试在\noaddpoints倒数第二个问题后添加,但这会使成绩表中最后一个问题的分数为 0。

将考试分成 2 个问题的环境也不起作用。

编辑到目前为止我发现的唯一办法就是把最后一个问题作为奖励问题,然后用它\bonusgradetable代替,但这感觉很奇怪。

答案1

以下是我的考试基本结构的示例。我知道还有改进的空间,但我没有太多时间来处理它。在与作者讨论后exam,我添加了以下内容:

\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}}%
  \addtocounter{qcounter}{-\firstquestion{#1}}%
  \stepcounter{qcounter}%
  \arabic{qcounter}%
}
\makeatother
%---------------------------------------------------------------------

序言部分允许用户使用命令 访问一定范围内的问题数量 \numqinrange{myrange},第一个问题使用\firstquestion{myrange},最后一个问题使用\lastquestion{myrange}。请参阅以下示例:

\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}}%
  \addtocounter{qcounter}{-\firstquestion{#1}}%
  \stepcounter{qcounter}%
  \arabic{qcounter}%
}
\makeatother
%---------------------------------------------------------------------
\pagestyle{headandfoot}                                      % Used for the header and footer options
\firstpageheadrule                                           % Head rules for fancy page style
\runningheadrule

% Header is optional and may vary depending on your exams.

\firstpageheader{Intermediate Algebra$|$MTH103}{Final Exam}{November 30, 2012}
\runningheader{MTH103}{Final Exam}{\iflastpage{End of exam}{\emph{continued}}}
\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}
% Here you can put anything as your cover page. Specifics about your exam.
\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.
\partialgradetable{structuredquestions}[h][questions]
\hfill
\partialgradetable{OptionalPartA}[h][questions] \raisebox{1.5\baselineskip}{\rotatebox{-90}{\textbf{Part A}}}
\vskip0.5\baselineskip\hfill
\partialgradetable{OptionalPartB}[h][questions] \raisebox{1.5\baselineskip}{\rotatebox{-90}{\textbf{Part B}}}
\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
This section contains \numqinrange{structuredquestions} question(s) of which \textbf{all} must be answered on your answer sheet.
\begingradingrange{structuredquestions}
\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}
\endgradingrange{structuredquestions}
\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
\begingradingrange{OptionalPartA}
\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}
\endgradingrange{OptionalPartA}
\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
\begingradingrange{OptionalPartB}
\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}
\endgradingrange{OptionalPartB}
\fullwidth{\hrulefill\par\flushright \textbf{Total Points: \pointsonpage{\thepage} points}}
\end{questions}
\end{document}

在此处输入图片描述 在此处输入图片描述

相关内容