Wednesday, November 30, 2016

Sample code for Moodle Quiz questions that have source code samples in them. In Moodle XML format.

<?xml version="1.0" ?>

<!-- "Test" is the quiz question bank name -->
<question type="category">

<!-- Sample short answer question with a code sample.
See: for more details.
<question type="shortanswer">
        <text>Test question</text>
     <questiontext format="html">
         <text>Look at the following code:
<link rel="stylesheet" href="//">
<script src="//"></script>
<pre><code class="python"># Code Sample
def test_function():

What does the program print when it runs?

    <!-- Case sensitive flag -->

    <answer fraction="100">
    <answer fraction="0">
        <feedback><text>Sorry, but case matters!</text></feedback>