I don't know what's expected for this item during the exam (I haven't taken this exam yet). We'll probably have to use an inventory plugin in a playbook, rather than writing the code.
References to the documentation for dynamic inventories are given at the bottom of section 5.1 of the DO374 course. “Working with dynamic inventory” link gives some inventory scripts examples, "Inventory plugins" gives information on how to use inventory plugins, and "Developing dynamic inventory" explains how to write your own inventory plugins.
Get used to finding information in the official Ansible documentation, this is what will be available during the exam.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.