QCM-UNISTRA
Author
JR Luttringer
Last Updated
2 years ago
License
Creative Commons CC BY 4.0
Abstract
Simple QCM template
Simple QCM template
\documentclass{exam}
\usepackage{amssymb}
\usepackage{geometry}
\geometry {margin=30mm, bottom=15mm, top=15mm}
\usepackage{fancyvrb}
\usepackage{fontspec}
\usepackage{tppda}
\usepackage{pbox}
% Used to randomize answers
%\usepackage[randomize,nokeeplast]{exam-randomizechoices}
\def\extra{\rule{1ex}{0ex}}
\makeatletter
\renewcommand\fillin{\@ifstar{\@cenmath}{\@centext}}
\newcommand\@cenmath[1]{%
\protect\rule[-.3ex]{\widthofpbox{\extra$#1$}}{0.3ex}}
\newcommand\@centext[1]{%
\protect\rule[-.3ex]{\widthofpbox{\extra#1abc}}{0.1ex}}
\makeatother
%% This template is a simple "wrapper" to the
% exam class
\begin{document}
% Credits to Pierre David for this "entete" , I merely
% change the font to fit the Unistra chart
\entete
{Réseaux IP}
{Licence Math-Info -- Semestre 4}
{2022/2023}
{Examen sur table}
% Adds a header with some important info, in particular
% you can easily display the total number of points and questions
\info{Durée : 30 minutes. Ce sujet contient \numquestions\ questions sur \numpages\ pages, pour un total de \numpoints\ points.}
% Checkbox for MCQ as square and not circle
\checkboxchar{$\square$}
\large
% Add the points in the right margin
\pointsinrightmargin
\marginpointname{ \points}
\addpoints
\extrawidth{0.75in}
\section{QCM}
\begin{questions}
% The exam class does not like section very much when you want to display the grades at the end of the exam (as done here). To ensure that grades can be displayed properly, you need one gradingrange per section, as done here
\begingradingrange{exo1}
%%% EXAMPLE OF MULTI-LINE MCQ
\question[1] Si je répond à cette question aléatoirement, quelle est la chance que ma réponse soit correcte ?
\begin{checkboxes}
\choice 25\% \choice 50\% \choice 25\% \choice 0\%
\end{checkboxes}
%%% MONOLINE MCQ
\question[10] Autre format ?
\begin{oneparcheckboxes}
\choice 25\% \choice 50\% \choice 25\% \choice 0\%
\end{oneparcheckboxes}
\endgradingrange{exo1}
\end{questions}
%%%% FILL THE BLANKS
\section{Texte à trou}
\begin{questions}
\setcounter{question}{0}
\begingradingrange{exo2}
%%% Fillin has been modified (compared to standard exam class). The size of the "blank" now adapts to the size of the awaited answer (+ a small padding)
\question[2] La question numéro \fillin{2} est un exemple de \fillin{texte à trou}.
\endgradingrange{exo2}
\end{questions}
\section{Questions ouvertes}
\begin{questions}
\setcounter{question}{0}
\begingradingrange{exo3}
%% OPEN QUESTION
\question[1]
Quelle est la réponse à cette question ?
\fillwithdottedlines{1in}
\endgradingrange{exo3}
\end{questions}
%% DISPLAY GRADES (one per grading range)
\section{Note}
\begin{center}
\hqword{QCM}
\partialgradetable{exo1}[h][questions]
\hqword{Texte à trou}
\partialgradetable{exo2}[h][questions]
\hqword{Questions ouvertes}
\partialgradetable{exo3}[h][questions]
\end{center}
\end{document}