The exam I am planning to write has several sections. Is it possible to distribute the questions by the respective sections while using a LaTeX template?
Yes, but then you need to hard-code the number of questions. Other than that it is very straightforward. Rather than putting a single placeholder into the LaTeX template:
%% \exinput{exercises}
you need to input the exact exercise files, e.g.,
\section{Quiz questions}
\begin{enumerate}
\input{exercise1.tex}
\input{exercise2.tex}
\end{enumerate}
\section{Practical exercises}
\begin{enumerate}
\input{exercise3.tex}
\input{exercise4.tex}
\end{enumerate}
This gives you full control over how and where the exercises are included. More details are given in Section 3 of vignette("exams", package = "exams")
.
Caveat: Leading zeros are added in the exercise number if there is more than one digit in the number of exercises, e.g., exercise01.tex
if there are between ten and 99 exercises.