The year 2020 saw a cataclysmic change in the tertiary education sector as a result of the global Covid-19 pandemic.  One of the immediate changes was the requirement to move to remote assessment. A robust way to ensure academic integrity when remotely assessing students is to automatically generate random questions, and corresponding solutions, that are different for each student. These random questions may differ in only a few components, ensuring that the assessment is equitable across the student cohort.

What you will learn

In this course you will learn how to: 

  • Install the software required to start generating random questions,
  • Code up a simple question and answer,
  • Formulate more complicated Q&As,
  • Export these questions to individual assessment sheets (PDF),
  • Export these questions to Moodle.

While what you will learn is ideal for assessments containing mathematical exercises, or multiple choice questions, it can also be used for generating random essay questions. In this course I cover examples using Sweave, which allows for seamless Latex integration. The exams package also allows one to use R Markdown, but this is not covered in the course.

Acknowledgment: This course has been made possible by the monumental efforts of the R community in providing freely available and open-source software. Special thanks goes to the authors of the exams software package.  Please visit for more information and resources.

Course curriculum

  • 1

    Section 1: Introduction

    • Why randomised question generation?

  • 2

    Section 2: Software Installation and Setup

    • Installing R

    • Installing RStudio

    • Installing R packages

  • 3

    Section 3: Simple Example

    • Your first random question and answer

    • Generating multiple PDFs from Q&A

    • Generating Moodle output from Q&A Part 1

    • Generating Moodle output from Q&A Part 2

  • 4

    Section 4: Additional Features

    • Essay questions with random subjects

    • Uploading essay questions to Moodle

    • Single-choice questions

    • "Prove the Result" questions: An example using integration

    • Changing templates

    • Selecting from groups of questions


Andrew Zammit-Mangion

Andrew Zammit-Mangion is currently Senior Lecturer with the School of Mathematics and Applied Statistics at the University of Wollongong, Australia. His key interests lie in spatio-temporal models and the inferential tools that enable them. Recently, he has also been looking at novel ways to combine ideas in deep learning with spatio-temporal modelling. He has authored several R packages, and in 2019 he published a co-authored book with Christopher Wikle and Noel Cressie on spatio-temporal modelling with R. He teaches many statistics courses within the School, and also offers short courses on spatio-temporal statistical modelling.


5 star rating

About the tutorial

Debasish Pandit

The tutorial about basic installation of r and library was good tutorial

The tutorial about basic installation of r and library was good tutorial

Read Less
4 star rating

Simple is the best


Very simple and very effective course. Congratulations

Very simple and very effective course. Congratulations

Read Less
5 star rating

Very Good!

Jobenil Luiz Magalhães Júnior

Thanks Andrew for this course.

Thanks Andrew for this course.

Read Less
star rating