[R/exams](http://www.R-exams.org/) is a one-for-all exams generator that can export Moodle XML (among various other output formats) from potentially dynamic exercises written in R/Markdown or R/LaTeX. A brief tutorial for Moodle is available at: [E-Learning Quizzes with R/exams for Moodle and OpenOLAT](http://www.R-exams.org/tutorials/elearning/).
Thanks for your consideration & best wishes,
Achim Zeileis