Introducing Parson's Problems (experimental)
Parson's problems are popular with some teachers, particularly in secondary schools.
There was some discussion of Parson's problem in a forum thread in 2021 (see here) and a Parson Problem question type arose from that discussion. My thanks to Jon Witts and Paul Powell for the encouragement and help with the development.
However, that preliminary implementation didn't support distractors and authoring questions was rather clumsy. Recent CodeRunner developments have made a cleaner implementation possible, with a more user-friendly authoring interface although the process to intialise a question is still rather cumsy.
This quiz shows how the use of the new question type. The XML export of this question is here. It does not require any changes to the base CodeRunner, as it uses the HTML UI. However it does need at least CodeRunner version 4.2.3 or later (February 2022). Note: when creating questions of this type, you need to check the Twig all checkbox in the question author form.
When the student clicks the Check button the code is graded in the usual CodeRunner way:
The authoring interface uses the Answer preload section to define the list of available code lines and the Answer section contains the expected answer as shown in the following image. Distractors can be included in the Preload section if the author desires.
The following three Parson's problems introduce iterating over a dictionary in key order, building from a simple key-based iteration to the most compact version using the dictionary's items method. All three examples include two distractors.
This is still new and experimental - please report any issues to the question authors forum or email Richard Lobb at the University of Canterbury directly (you can find my email by a web search). Comments and suggestions are also welcome.