My ongoing 1st year introductory course on computers has Moodle exams containing different kinds of automatically graded questions like:

We need to use automatically graded exams since there is 250-300 students each year, too few teachers participating, so evaluating the exams manually would take forever and would be very boring task to do.
Perhaps a necessary disclaimer: Everyone knows these conversions and arithmetics are, in practice, done oftentimes using software tools (programmer’s calculators) or web sites, when you need to. The actual learning goal here is not to say to students that doing this manually is something you have to learn to do for this profession. The learning goal is to expose the way data and simple arithmetics is handled in a computer and play around with these things to get an understanding of how computers work. And in time, you learn to see, for example, when debugging, some things that might be important in the hex, octal or binary values in memory.
Having a large set of questions for a course topic is a good thing to have. Then each exam generated for a student has different set of questions, randomly chosen by Moodle.
This poses another boring task problem. I would have to write tens or hundreds of these questions, choosing the values to convert or calculate, converting them to different radices, calculate the result and then use Moodle question editor to write the questions. And translate them to Finnish (or from Finnish to English), since I teach the course in two languages.
Well, what do you need when you have simple, boring repetitive tasks to do…?
A computer.
Well, a computer alone is just a bunch of metal, sand and plastics, so in addition, software would be needed.
Since I enjoy programming much more than writing Moodle exam questions, I implemented a command line tool using Swift. This tool generates random number conversion tasks (decimal to hex to binary) and arithmetic tasks (summing different values in different radices). Then these tasks are saved in a Moodle XML exam question format in a file.
./ConversionQs output-fi.xml 20 fi --verbose
The command above generates 20 conversion and arithmetic tasks each, in Finnish, outputs them to output-fi.xml file and shows me the progress in terminal window (--verbose flag). Below is an excerpt from an English output file:
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<question type="shortanswer">
<name>
<text>Convert between radixes</text>
</name>
<questiontext format="html">
<text><p>Convert the value 66 to radix: hexadecimal.</p> <p>Consider the values to be signed bytes, with eight bits.</p>
<p>Write in the answer the prefix for the radix (0x, 0b) asked, if it is not decimal.</p>
<p>Otherwise, use only the digits of the requested numbering system, no spaces or other punctuations.</p></text>
</questiontext>
<defaultgrade>2.0000000</defaultgrade>
<penalty>0.3333333</penalty>
<answer fraction="100" format="moodle_auto_format">
<text>0x42</text>
</answer>
</question>
...
Then I just import the XML file to Moodle, placing the questions into appropriate question category. Choosing a number of random questions from this set to an exam is an easy thing to do. Whenever I need a fresh set of questions, I just run the command again.
What a rise in productivity level of a teacher! Implementing this took around one working day. Now generating tens or even hundreds of exam questions happens in a fraction of a second, instead of hours and hours of mind consuming boredom!
