5

I use the exam document class to prepare my question papers. While it may have some limitations compared to the similar others available, it has nicely fulfilled my purpose so far.

Now, I need to prepare a question with true/false questions and the exam class do not seem to have this feature.

I understand that I can achieve the same effect if I decide to switch to some other class available, but that will need a major overhauling in my setup which may prove to very expensive considering the time I can afford.

One solution could be to use the eqexam style file, and prepare something like the ones shown here (page 3), but the exam document class and the eqexam style file conflict since they define environments with identical names (parts along with other ones).

What will be your suggestion to prepare true/false questions in the exam class which should have the facility to print answers when I decide to just like the other questions.

  • I think with shortanswer, choices or checkboxes environments can have true or false questions. – Ignasi Sep 30 '14 at 7:19
  • @Ignasi shortanswer is a definite alternative though it is not actually a true/false environment per se. Thanks for the idea, that will salvage the current situation. Please see this docuemnt, section 2.2.3, page 7. Surprisingly this package had an identical name to the one in question. – Masroor Sep 30 '14 at 7:43
  • Jason Alexander's exam class was renamed examdesign some years ago to avoid the problem with Philip Hirschhorn's one. – Ignasi Sep 30 '14 at 7:47
7

I use the following True/False format in the Exam class. It may or may not suit your needs. I find this layout especially convenient for grading. Part of the true/false question format is based on this answer by Gonzalo Medina.

\documentclass[11pt]{exam}

%\printanswers

% Create a True False question format
\newcommand*{\TrueFalse}[1]{%
\ifprintanswers
    \ifthenelse{\equal{#1}{T}}{%
        \textbf{TRUE}\hspace*{14pt}False
    }{
        True\hspace*{14pt}\textbf{FALSE}
    }
\else
    {True}\hspace*{20pt}False
\fi
} 
%% The following code is based on an answer by Gonzalo Medina
%% https://tex.stackexchange.com/a/13106/39194
\newlength\TFlengthA
\newlength\TFlengthB
\settowidth\TFlengthA{\hspace*{1.16in}}
\newcommand\TFQuestion[2]{%
    \setlength\TFlengthB{\linewidth}
    \addtolength\TFlengthB{-\TFlengthA}
    \parbox[t]{\TFlengthA}{\TrueFalse{#1}}\parbox[t]{\TFlengthB}{#2}}

\begin{document}
\begin{questions}
\fullwidth{%
Circle True or False.  Read each statement in original Greek before answering. (2 points each)
}
\question\TFQuestion{F}{This sentence is false.}
\question\TFQuestion{T}{This sentence is false.}
\question\TFQuestion{T}{A man says that he is lying. Is what he says true or false?}

\end{questions}
\end{document}

enter image description here

With \printanswers uncommented, you get the following output.

enter image description here

  • Can not thank you enough for the answer. I like it specially for the fact that it makes the grading process so much easier. – Masroor Oct 1 '14 at 14:00
  • How can we do these kind of questions in article class? – ARAT Oct 16 '15 at 18:45
  • I have an answer for you (with code) but you should ask this as a separate question. In short, I used the ifthenselse package to replace the \ifprintanswers command in the exam class. It was a straightfoward replacement so you may be able to figure it out on your own, using my code from above. – Michael S Taylor Oct 18 '15 at 0:52
  • I like your answer, but one thing is still unclear for me. How to make the questions' numbering consistent with other questions? I mean, if I paste your answer between two questions, I disturb the questions order. – dawicz Dec 4 '16 at 18:56
  • @dawicz The question number should contiue automatically, regardless of where you use them. The first part of the command \question\TFQuestion is the \question command from the exam class. That is how exam knows it is a question and continues numbering. I am not clear what you mean when you say you paste the answer between two questions. Everything above \begin{document} should be in the preamble of your document. What is disturbed about the numbering? Does it restart at 1? – Michael S Taylor Dec 12 '16 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.