The exam package

Hans van der Meer hansm@fwi.uva.nl

vs.3.19 - 1995/03/10

Contents

1 Usage 1 1.1 Exam production . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Format of a problem . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 Multiple Choice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1 Usage

1.1 Exam production

An exam can be built from the following template. For special issues as the use of default names for various directories, language selection, etc. see the implementation section. You may customize the typesetting by providing a file exam.cfg in the search path; this file is read just before typesetting begins.

 \documentclass[options]{exam}
 \title{title of exam}
 \author{the examinator}
 \target{the students}
 \begin{document}
 \begin{exam}[startvalue random generator]{date of exam}
 \question{directory}{file}
 \question[parameter value]{directory}{file} % parametrized
 ....
 \end{exam}
 ... % possibly other exams
 \end{document}

1.2 Format of a problem

A problem is built by environment problem. In it several elements can be placed. These are:

1. \parameterproblem{text}: used to communicate to the maintainer of the problems the possibilities offered by the transfer of macro \parameter on posing the question; an example of this will follow. Can also find a place before the problem declaration.

2. \begin{problem}[#1]; the optional parameter can have the value \compact (no pagebreak within problem, default) or the value \split (pagebreak may occur in problem).

3. \problemdate{date}: a macro to remember on which day the problem was born;

4. \score{value}: use this macro for the number of points the answer is worth; it is possible to include several score items in one problem for partial rewards. The score value is not shown when an exam is typeset, the student must earn these points!

5. text of the question.

6. the answer or multiple choice list; see the description below.

7. \remark[h]{b}: a boxed remark with heading h and body b.

8. \end{problem}.

problem — coding —

\begin{problem}
\problemdate{\today}
What is the question?
\score{2}
\shortanswer{To be or not to be.}
\end{problem}

problem — result — left without answers, right with answers, series Problem 0. What is the

question?

Answer: . . . . . . . . . . . . . . .

Problem 0. What is the

question?

Answer: To be or not to be.

April 23, 1995

The next example shows the use of a parameter for the selection of alternate questions.

\begin{problem}

parameterproblem — coding — \parameterproblem{1= to be\\2= not to be}

\problemdate{\today}
\score{2}
\def\parameter{2} % normally comes from \question[2]...
What is\ifnum\parameter=1\relax\else n't\fi\ the question?
\shortanswer{\ifnum\parameter=1\relax To be or n\else N\fi ot to be.}
\end{problem}

parameterproblem — result — left parameter = 1, right parameter = 2

Parameter Problem: 1= to be 2= not to be

Problem 0. What is the question? Answer: To be or not to be.

April 23, 1995

Parameter Problem: 1= to be 2= not to be

Problem 0. What isn’t the question? Answer: Not to be.

April 23, 1995

Another method for the selection of alternatives is via the mechanism implemented in macros \loaditem and friends (See sections ?? and ??. Pieces text can be loaded (in this implementation at most 5) and selectively dumped into the typeset input stream.

Macro \loaditem can be used to load from one to five items in a data store. This data store can be shuffled by a call to \shuffle. Popping items from the store is effected by macros \dumpitem (pop one item) and \dumpitems (all items). Clearing of the store is done by \resetloadcounter. With \SRtest{1}{2} one can make a random choice between two alternatives.

load and dump — coding —

\SRset{349}              % startup random generator
\resetloadcounter        % initialize load stack
\loaditem{\fbox{item 1}\space} % load 4 items of text
\loaditem{\fbox{item 2}\space}
\loaditem{\fbox{item 3}\space}
\loaditem{\fbox{item 4}\space}
Here comes nr~2: \dumpitemno{2}\par
\shuffle                 % randomize
Here comes nr~2 again after randomization: \dumpitemno{2}\par
Dump the whole lot: \dumpitems

load and dump — result —

Here comes nr 2: item 2

Nr 2 again after randomization: item 4

Dump the whole lot: item 1 item 3 item 4 item 2

1.3 Answers

The basic macros for showing and suppressing answers are \answer that shows its argument when the answers option is chosen, and \altanswer that alternates its two arguments. Both macros have a first, optional argument for specifying the width of the box wherein the text is placed.

answer/altanswer — coding —

 \answer[.3\linewidth]{answer}\\
 \altanswer[.3\linewidth]{answers NO}{answers YES}

answer/altanswer — result — left without answers, right with answers

answers NO  answer answers YES

Some questions can be answered by a few words, a short sentence. The command \shortanswer serves this purpose; its first argument is optional and used for the width of the answerbox, its second argument is the answer itself.

short answer — coding —

 Answer the next question:
 \shortanswer[.35\linewidth]{The answer.}

short answer — result — left without answers, right with answers Answer the next question:

Answer: . . . . . . . .

Answer the next question: Answer: The answer.

When however more space is needed by the student, the environment longanswer can be used. This environment has one optional parameter, meant for specifying the amount of white space to be reserved for the students answer.

long answer — coding —

 Answer the next question:
 \begin{longanswer}[5mm]
 The answer.
 \end{longanswer}

long answer — result — left without answers, right with answers Answer the next question:

Answer:

Answer the next question:

Answer:

The answer.

The answer is headed by a call to \answerstart; redefine to your taste.

The default of white space reserved for the depth of the short answer can be changed by redefinition of \shortwhite. The default for the white space of the long answer can be changed by redefinition of \longwhite.

1.4 Multiple Choice

Multiple choice is provided for by environment choice. Within this environment a itemized list of alternatives is given. However instead of \item one codes \baditem{text} for wrong answers and \gooditem{text} for the correct one; the answer being put into the argument of these two macros. The optional parameter of this environment can be \ordered for production of the alternatives in the order specified, or \random for randomization; randomize is the default, unless the series option is specified in the \documentclass call.

multiple choice example — coding —

 Choose the most appropriate alternative:
 \begin{choice}[\ordered]
 \baditem{first wrong answer}
 \gooditem{the right answer}
 \baditem{second wrong answer}
 \end{choice}

multiple choice — result — left without answers, right with answers Choose appropriate alternative:

◯ first wrong answer ◯ the right answer ◯ second wrong an-

swer Choose appropriate alternative:

◯ first wrong answer √ the right answer ◯ second wrong an-

swer

The marks for the multiple choice items are produced by the macros \badmark and \goodmark. For their redefinition see the implementation section of this document.