I am using exam class to prepare a question bank and I wanted to mark the source of the question(that is from where I have taken) at the end of the question.

How to achieve this?


\oddsidemargin 0in \evensidemargin 0in \topmargin 0in \textheight
9.2in \textwidth 6.5in
%\hoffset -1in
%\voffset -1in
%\evensidemargin 14pt

%%%---------------For Title drop

\cfoot{\iflastpage{$\maltese\maltese\maltese \maltese

%    command name
\hfuzz1pc % Don't bother to report overfull boxes if overage is < 1pc



        \large{\textbf{Question Bank\\ Answer key\\\hrule height 1pt}}
    \end{center}        \par\unvbox\allanswers}}

{\begin{answer}\thequestion. (a)~#1\end{answer}}
    {\begin{answer}\thequestion. (b)~#2\end{answer}}
        {\begin{answer}\thequestion. (c)~#3\end{answer}}
            {\begin{answer}\thequestion. (d)~#4\end{answer}}
            {\begin{answer}\textbf{\thequestion. (#5)~Invalid answer 

%usage \choice{ }{ }{ }{ }
    (a)~#1 & (b)~#2 & (c)~#3 & (d)~#4

    (a)~#1 & (b)~#2
    (c)~#3 & (d)~#4

(a)~#1 \par (b)~#2 \par (c)~#3 \par (d)~#4



\def\vhrulefill#1{\leavevmode\leaders\hrule\@height#1\hfill \kern\z@}

    \large{\textbf{Question Bank} }

    \section{Linear Algebra}
    \question[MU2017] What are all the subspaces of $\mathbb{R},\mathbb{R}^2,\mathbb{R}^3$?

    \question Which of the following matrix is/are diagonalizable?

\question[NEST2015] There are 10 black balls in a box. A person picks 5 balls from the box, paints them white
and puts them back into the box. Now the person picks 5 balls from the box at random. The
probability that exactly 3 of these 5 balls are white is 

\question[NEST2015] For three arbitrary real numbers $ r, s, t $ the mathematical identity is
\choice{  $(\min\{r,s,t\})^3 = \min \{ r^3, s^3, t^3\}$}
{  $(\min\{r,s,t\})^2 = \min \{ r^2, s^2, t^2\}$}
{  $|\min\{r,s,t\}| = \min \{ |r|, |s|, |t|\}$}
{$\sin(\min{r, s, t}) = \min{\sin r, \sin s, \sin t}$} {a}

    %\vskip 1in \centering{\large\decotwo\decofourleft\floweroneright $~~All ~~The~~ Best~~$\floweroneleft\decofourright\decotwo}
\showallanswers % Phil Hirschorn
%\cfoot{\iflastpage{$\maltese\maltese\maltese \maltese \maltese$}{\thepage}} \rfoot{}

enter image description here

  • The texts whichever I have written in the points place, (for example, \question[NEST2015]), prints the same about 5 times just above the question.
  • A nd more over I get an error if I include some text instead of numbers in the first question.

Something's wrong--perhaps a missing \item. \question W

  • For what I can see from your MWE, is that you didn't redefine \question which is essentially \item. Now \question takes an optional number which is the points given to a question. Using a non-number will probaply break things. If you change strings like MU2017into a number the errors disappear. – Jesse op den Brouw Jul 26 '18 at 6:53
  • Is it possible to redefine \quetion and post as an answer?? @JesseopdenBrouw – David Jul 26 '18 at 6:56
  • A quick solution is to use \titledquestion. It has an optional parameter which can be printed at the end of the question like this: \titledquestion{MU2017}[10] What are all the subspaces of $\mathbb{R},\mathbb{R}^2,\mathbb{R}^3$? \par From exam: \thequestiontitle – Jesse op den Brouw Jul 26 '18 at 8:37
  • @JesseopdenBrouw I have tried this solution and somehow, I dont know why, it didnt serve what it supposed to. – David Jul 26 '18 at 9:28
  • Are you running TexLive 2018? Maby you have to update the exam class file. – Jesse op den Brouw Jul 26 '18 at 10:12

Your Answer

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

Browse other questions tagged or ask your own question.