One of the most time-consuming task for teachers is creating and correcting exercises to evaluate students. This is normally performed by hand, which incurs high time costs and is error-prone. A way to alleviate this problem is to provide an assistant tool that automates such tasks. In the case of exercises based on diagrams, they can be represented as models to enable their automated model-based generation for any target environment, like web or mobile applications, or learning platforms like Moodle. In this paper, we propose an automated process for synthesizing five types of diagram-based exercises for the Moodle platform. Being model-based, our solution is domain-agnostic (i.e., it can be applied to arbitrary domains like automata, electronics, or software design). We report on its use within a university course on automata theory, as well as evaluations of generality, effectiveness and efficiency, illustrating the benefits of our approach.