You can embed an online quiz in a book, for instance using an embeddable quiz engine like Betterquiz.

At this stage, it’s best to use Liquid control flow tags to show text-only quizzes in PDF and epub, and embedded, interactive quizzes only in web output.

Here’s a quiz from a nursing textbook. How well do you know your Ebola prevention?