0

I want to create a document in the following format:

Part 1: Multiple choice

Question 1

Question 2

....

Answer keys for Part 1

Then some paragraphs, text, instructions ...

Part 2: Multiple choice

Question 1

Question 2

....

Answer keys for Part 2


I tried:

\documentclass[a4paper]{exam}

    \usepackage{exam-randomizechoices}

    \begin{document}

     \begin{questions}
     
       \question[] 
    
       What is 1+1?

       \begin{randomizechoices}
        \CorrectChoice 2
        \choice 1
        \choice 3
        \choice 4
        \choice 5
       \end{randomizechoices}

        \question[] 
    
        What is $3x4$?
    
         \begin{randomizechoices}
        \CorrectChoice 12
        \choice 13
        \choice 3
        \choice 4
        \choice 5
         \end{randomizechoices}
   
      \end{questions}
    
       This is the answers for Part 1-multiple choice questions. 
    
       \printkeytable
    
    This is a paragraph. Then more multiple choice questions.
    
    \begin{questions}
    
    \question[] 
    
    What is 7-5?
    
    \begin{randomizechoices}
        \CorrectChoice 2
        \choice 1
        \choice 3
        \choice 4
        \choice 5
    
    \end{randomizechoices}
    
    \question[] 
    
   

     What is $6x4$?
        
        \begin{randomizechoices}
            \CorrectChoice 24
            \choice 13
            \choice 3
            \choice 4
            \choice 5
        
        \end{randomizechoices}
        
        \end{questions}
        
        This is the answers for Part 2-multiple choice questions. 
        
        
        \printkeytable
        
        \end{document}

But I didn't get the right answer table for Part 1. In fact it just copied the answers for part 2 and put that for part 1 also.

How to get the right answer tables?

Thank a lot.

1
  • You could use \question \begin{parts} \part ... \part ... \end{parts}. Right now you have two questions with possibly the same number. Nov 26, 2022 at 4:54

1 Answer 1

0

You can separate questions into parts, but no two questions can have the same page number.

In the example, the last question number in the first part is saved and is used to continue numbering the questions in the second part.

\printkeytable[<first number>-<last number>] accepts an optional range and

\printkeytable[<first number>-] will print the key table from the first question number to the last question.

c

\documentclass[a4paper]{exam}

\usepackage{exam-randomizechoices}

\newcounter{lastquestion}% added <<<<<<<<<<

\begin{document}
    
    \section{Part I}
    
    \begin{questions}
        
        \question
        What is 1+1?
        
        \begin{randomizechoices}
            \CorrectChoice 2
            \choice 1
            \choice 3
            \choice 4
            \choice 5
        \end{randomizechoices}

        \question 
        What is $3x4$?
        
        \begin{randomizechoices}
            \CorrectChoice 12
            \choice 13
            \choice 3
            \choice 4
            \choice 5
        \end{randomizechoices}
    
    \setcounter{lastquestion}{\arabic{question}}% store end question number <<<<<<<<<<
         
    \end{questions}
    
    These are the answers for Part 1-multiple choice questions. 
    
    
    \printkeytable  \bigskip
    
    This is a paragraph. Then more multiple choice questions.
    
    \section{Part II}
        
    \begin{questions}
        
         \setcounter{question}{\thenumquestions}% use as base numbering  <<<<<<<<<
         \setcounter{lastquestion}{\thenumquestions}% store  base question number <<<<<<<<<

        \question       
        What is 7-5?
        
        \begin{randomizechoices}
            \CorrectChoice 2
            \choice 1
            \choice 3
            \choice 4
            \choice 5           
        \end{randomizechoices}

        \question           
        What is $6x4$?
        
        \begin{randomizechoices}
            \CorrectChoice 24
            \choice 13
            \choice 3
            \choice 4
            \choice 5           
        \end{randomizechoices}  

    \end{questions} 
    
    These are the answers for Part 2-multiple choice questions. 

    \stepcounter{lastquestion} % <<<<<
    \printkeytable[\thelastquestion-] % from first question of the second part to the end <<<<<<<<<<
        
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .