Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>1.7 Creating questionnaire exercises | Def. Course | A+ </title>
- <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
- <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
- <link href="https://use.fontawesome.com/releases/v5.3.1/css/solid.css" rel="stylesheet" integrity="sha384-VGP9aw4WtGH/uPAOseYxZ+Vz/vaTb1ehm1bwx92Fm8dTrE+3boLfF1SpAtB1z7HW" crossorigin="anonymous">
- <link href="https://use.fontawesome.com/releases/v5.3.1/css/regular.css" rel="stylesheet" integrity="sha384-ZlNfXjxAqKFWCwMwQFGhmMh3i89dWDnaFU2/VZg9CvsMGA7hXHQsPIqS+JIAmgEq" crossorigin="anonymous">
- <link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/github.min.css" rel="stylesheet" />
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.12/clipboard.min.js"></script>
- <script src="/static/js/translate.min.js"></script>
- <link
- data-translation
- rel="preload"
- as="fetch"
- hreflang="fi"
- href="/static/js-translations/teacher.fi.json"
- >
- <link rel="stylesheet" href="/static/css/main.css" />
- <link rel="stylesheet" href="/static/css/submission.css" />
- <link rel="stylesheet" href="/static/django_colortag.css" />
- <script src="/static/js/polyfill-find.js"></script>
- <script src="/static/js/aplus.js"></script>
- <script src="/static/js/external_launcher.js"></script>
- <link rel="stylesheet" type="text/css" href="/static/css/external_services.css">
- <script src="/static/exercise/poll.js"></script>
- <script src="/static/exercise/group.js"></script>
- <script src="/static/exercise/chapter.js"></script>
- <script
- src="/static/exercise/language_link.js"
- data-set-lang="/accounts/i18n/setlang/"></script>
- <script>
- // Visualize loading in case of slow POST operations.
- /*$(function() {
- var forms = $("#exercise-page-content").find("form:not([data-aplus-exercise] form)");
- forms.on("submit", function(event) {
- $("#submit-progress").removeClass("hide");
- });
- });*/
- // Add an Ajax exercise event listener to refresh the info column.
- window.addEventListener("message", function (event) {
- if (event.data.type === "a-plus-refresh-stats") {
- $("#submit-progress").addClass("hide");
- var $stats = $("#exercise-info"),
- url = $stats.data("url");
- $stats.load(url, function() {
- $stats.find('[data-toggle="tooltip"]').tooltip();
- });
- }
- });
- </script>
- <link data-aplus="yes" href="http://localhost:8080/static/default/_static/default.css" rel="stylesheet" type="text/css"/>
- <link data-aplus="yes" href="http://localhost:8080/static/default/_static/pygments.css" rel="stylesheet" type="text/css"/>
- <link crossorigin="anonymous" data-aplus="" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" rel="stylesheet"/>
- <script crossorigin="anonymous" data-aplus="" defer="" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" onload="console.log('Hello, this is KaTeX!');" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" type="text/javascript"></script>
- <script data-aplus="">
- function render_katex() {
- if (window.katex) {
- renderMathInElement(document.body,{delimiters: [
- {left: "\\[", right: "\\]", display: true},
- {left: "\\(", right: "\\)", display: false}]}
- );
- console.log("Math rendered.");
- } else {
- console.log("KaTeX not loaded.")
- };
- };
- </script>
- <script crossorigin="anonymous" data-aplus="" defer="" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" onload="setTimeout(render_katex,500);" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" type="text/javascript"></script>
- <link data-aplus="" href="http://localhost:8080/static/default/_static/course.css" rel="stylesheet" type="text/css"/>
- <link data-aplus="" href="http://localhost:8080/static/default/_static/active_element.css" rel="stylesheet" type="text/css"/>
- <!-- Some favicons courtesy of http://realfavicongenerator.net/ -->
- <link rel="apple-touch-icon" sizes="57x57" href="/static/favicons/apple-touch-icon-57x57.png">
- <link rel="apple-touch-icon" sizes="114x114" href="/static/favicons/apple-touch-icon-114x114.png">
- <link rel="apple-touch-icon" sizes="72x72" href="/static/favicons/apple-touch-icon-72x72.png">
- <link rel="apple-touch-icon" sizes="144x144" href="/static/favicons/apple-touch-icon-144x144.png">
- <link rel="apple-touch-icon" sizes="60x60" href="/static/favicons/apple-touch-icon-60x60.png">
- <link rel="apple-touch-icon" sizes="120x120" href="/static/favicons/apple-touch-icon-120x120.png">
- <link rel="apple-touch-icon" sizes="76x76" href="/static/favicons/apple-touch-icon-76x76.png">
- <link rel="apple-touch-icon" sizes="152x152" href="/static/favicons/apple-touch-icon-152x152.png">
- <link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon-180x180.png">
- <link rel="icon" type="image/png" href="/static/favicons/favicon-192x192.png" sizes="192x192">
- <link rel="icon" type="image/png" href="/static/favicons/favicon-160x160.png" sizes="160x160">
- <link rel="icon" type="image/png" href="/static/favicons/favicon-96x96.png" sizes="96x96">
- <link rel="icon" type="image/png" href="/static/favicons/favicon-16x16.png" sizes="16x16">
- <link rel="icon" type="image/png" href="/static/favicons/favicon-32x32.png" sizes="32x32">
- <meta name="msapplication-TileColor" content="#2b5797">
- <meta name="msapplication-TileImage" content="/static/mstile-144x144.png">
- </head>
- <body class="internal-student lang-en" data-view-tag="exercise">
- <div class="page-wrap">
- <nav class="topbar navbar navbar-inverse navbar-static-top">
- <div class="container-fluid">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar-collapse" aria-expanded="false">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand hidden-xs" href="/">A+</a>
- <span class="navbar-brand visible-xs">
- A+ Def. Course
- </span>
- </div>
- <div class="collapse navbar-collapse" id="bs-navbar-collapse">
- <ul class="nav navbar-nav hidden-xs">
- <li role="presentation" class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
- DEF000 Def. Course
- <span class="caret"></span>
- </a>
- <ul class="dropdown-menu">
- <li role="presentation">
- <a href="/def/current/">
- DEF000 Def. Course: Current
- </a>
- </li>
- </ul>
- </li>
- </ul>
- <ul class="user-menu nav navbar-nav navbar-right hidden-xs">
- <li role="presentation" class="profile-menu dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
- <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
- Ruth Robinson <span class="caret"></span>
- </a>
- <ul class="dropdown-menu">
- <li role="presentation">
- <a href="/accounts/accounts/">Profile</a>
- </li>
- <li role="separator" class="divider"></li>
- <li role="presentation">
- <a href="/accounts/logout/">
- <span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
- Log out
- </a>
- </li>
- </ul>
- </li>
- </ul>
- <ul class="nav navbar-nav visible-xs">
- <li role="presentation" class="header">
- <h4>Course</h4>
- </li>
- <li role="presentation" class="menu-home">
- <a href="/def/current/">
- <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
- DEF000
- </a>
- </li>
- <li role="presentation" class="menu-toc">
- <a href="/def/current/toc/">
- <span class="glyphicon glyphicon-book" aria-hidden="true"></span>
- Course materials
- </a>
- </li>
- <li role="presentation" class="menu-results">
- <a href="/def/current/user/results/">
- <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
- Exercise results
- </a>
- </li>
- <li role="presentation" class="header">
- <h4>Course staff</h4>
- </li>
- <li role="presentation" class="menu-participants">
- <a href="/def/current/teachers/participants/">
- <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
- Participants
- </a>
- </li>
- <li role="presentation" class="menu-groups-edit">
- <a href="/def/current/teachers/groups/">
- <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
- Groups
- </a>
- </li>
- <li role="presentation" class="menu-all-results">
- <a href="/def/current/teachers/results/">
- <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
- All results
- </a>
- </li>
- <li role="presentation" class="menu-analytics">
- <a href="/def/current/teachers/analytics/">
- <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
- Visualizations
- </a>
- </li>
- <li role="presentation" class="menu-edit-news">
- <a href="/def/current/teachers/news/">
- <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
- Edit news
- </a>
- </li>
- <li role="presentation" class="menu-edit-course">
- <a href="/def/current/teachers/">
- <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
- Edit course
- </a>
- </li>
- <li role="presentation" class="header"><h4>Site</h4></li>
- <li role="presentation">
- <a href="/">
- <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
- Home
- </a>
- </li>
- <ul class="dropdown-menu">
- <li role="presentation">
- <a href="/def/current/">
- DEF000 Def. Course: Current
- </a>
- </li>
- </ul>
- <li role="presentation">
- <a href="/accounts/accounts/">
- <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
- Ruth Robinson
- </a>
- </li>
- <li role="presentation">
- <a href="/accounts/logout/">
- <span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
- Log out
- </a>
- </li>
- </ul>
- </div>
- </div>
- </nav>
- <div class="site-content container-fluid">
- <div data-taggings="" class="row">
- <div class="col-sm-2 hidden-xs">
- <nav class="course-menu" id="main-course-menu">
- <ul class="nav nav-pills nav-stacked">
- <li role="presentation" class="header">
- <h4>Course</h4>
- </li>
- <li role="presentation" class="menu-home">
- <a href="/def/current/">
- <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
- DEF000
- </a>
- </li>
- <li role="presentation" class="menu-toc">
- <a href="/def/current/toc/">
- <span class="glyphicon glyphicon-book" aria-hidden="true"></span>
- Course materials
- </a>
- </li>
- <li role="presentation" class="menu-results">
- <a href="/def/current/user/results/">
- <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
- Exercise results
- </a>
- </li>
- <li role="presentation" class="header">
- <h4>Course staff</h4>
- </li>
- <li role="presentation" class="menu-participants">
- <a href="/def/current/teachers/participants/">
- <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
- Participants
- </a>
- </li>
- <li role="presentation" class="menu-groups-edit">
- <a href="/def/current/teachers/groups/">
- <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
- Groups
- </a>
- </li>
- <li role="presentation" class="menu-all-results">
- <a href="/def/current/teachers/results/">
- <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
- All results
- </a>
- </li>
- <li role="presentation" class="menu-analytics">
- <a href="/def/current/teachers/analytics/">
- <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
- Visualizations
- </a>
- </li>
- <li role="presentation" class="menu-edit-news">
- <a href="/def/current/teachers/news/">
- <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
- Edit news
- </a>
- </li>
- <li role="presentation" class="menu-edit-course">
- <a href="/def/current/teachers/">
- <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
- Edit course
- </a>
- </li>
- </ul>
- </nav>
- <!--div class="calendar-view">
- <h4>Calendar</h4>
- <div id="study-calendar"></div>
- <p>
- <a href="/def/current/user/export-calendar/">
- <small>Download calendar (ics)</small>
- </a>
- </p>
- </div-->
- </div>
- <div class="col-sm-10">
- <nav class="row siblings">
- <a href="/def/current/m02_programming_exercises/" class="pull-right btn btn-link">
- 2. Module 2 - Programming exercises »
- </a>
- <a href="/def/current/m01_introduction/06_languages/" class="pull-left btn btn-link">
- « 1.6 Multilingual course (i18n)
- </a>
- <span class="hidden-md hidden-sm hidden-xs" style="display: block; margin: auto; text-align: center;">
- <a href="/def/current/toc/">
- Course materials
- </a>
- </span>
- </nav>
- <ol class="breadcrumb">
- <li><a href="/def/current/">DEF000</a></li>
- <li><a href="/def/current/m01_introduction/">1. Module 1 - Introduction</a></li>
- <li class="active">1.7 Creating questionnaire exercises</li>
- </ol>
- <div class="row">
- <div class="col-lg-12 exercise-column">
- <div
- id="exercise-page-content"
- >
- <div class="overlay-parent">
- <div >
- <div class="content">
- <div class="section" id="creating-questionnaire-exercises">
- <h1>Creating questionnaire exercises<a class="headerlink" href="#creating-questionnaire-exercises" title="Permalink to this headline">¶</a></h1>
- <p>One can easily create simple questionnaire exercises for an A+ course, such as
- one-line text answers and multiple choice exercises. This page shows many
- examples on these.</p>
- <p><em>Technical remark.</em> The most recent and complete documentation on this can
- be found at <a class="reference external" href="https://github.com/Aalto-LeTech/a-plus-rst-tools">the source code of the A+ RST tools package</a>. Technically A+ RST tools
- provide specific Sphinx directives for writing course HTML and configuration
- files, and then A+ and mooc-grader implement the actual functionality.</p>
- <div class="section" id="general-description-of-the-options">
- <h2>General description of the options<a class="headerlink" href="#general-description-of-the-options" title="Permalink to this headline">¶</a></h2>
- <p>The <code class="docutils literal"><span class="pre">questionnaire</span></code> directive implements a questionnaire exercise. Its
- arguments define the exercise key (exercise identifier for A+) and max points
- with the optional difficulty (<code class="docutils literal"><span class="pre">A</span></code>, <code class="docutils literal"><span class="pre">B</span></code>, <code class="docutils literal"><span class="pre">C</span></code>, etc.). For example,
- <code class="docutils literal"><span class="pre">..</span> <span class="pre">questionnaire::</span> <span class="pre">easyexercise</span> <span class="pre">A50</span></code> sets key to <code class="docutils literal"><span class="pre">easyexercise</span></code>,
- maximum points to <code class="docutils literal"><span class="pre">50</span></code> and difficulty <code class="docutils literal"><span class="pre">A</span></code>. The difficulty parameter
- does not affect any scorekeeping, but only works as an indicator for the
- student. (The A+ REST API can group earned points by the difficulty so that
- the teacher may use the difficulties for computing final course grades.)</p>
- <p>The questionnaire directive accepts the following options:</p>
- <ul class="simple">
- <li><code class="docutils literal"><span class="pre">submissions</span></code>: max submissions</li>
- <li><code class="docutils literal"><span class="pre">points-to-pass</span></code>: points to pass</li>
- <li><code class="docutils literal"><span class="pre">feedback</span></code>: If set, assumes the defaults for a feedback questionnaire</li>
- <li><code class="docutils literal"><span class="pre">no-override</span></code>: If set, the conf.py override setting is ignored</li>
- <li><code class="docutils literal"><span class="pre">pick_randomly</span></code>: integer. Set the pick_randomly setting for the quiz
- (select N questions randomly on each load)</li>
- <li><code class="docutils literal"><span class="pre">category</span></code>: exercise category</li>
- </ul>
- <p>The contents of the questionnaire directive define the questions and possible
- instructions to students.</p>
- <p>The <strong>question directives</strong> <code class="docutils literal"><span class="pre">pick-one</span></code>, <code class="docutils literal"><span class="pre">pick-any</span></code>, and <code class="docutils literal"><span class="pre">freetext</span></code> take
- the points of the question as the first argument. The sum of the question points
- should be equal to the questionnaire max points. The question directives accept
- the following options:</p>
- <ul class="simple">
- <li><code class="docutils literal"><span class="pre">class</span></code>: <a class="reference external" data-aplus-chapter="yes" href="../03_css">CSS class</a></li>
- <li><code class="docutils literal"><span class="pre">required</span></code>: If set, the question is required and empty answers are rejected</li>
- <li><code class="docutils literal"><span class="pre">key</span></code>: a manually set key for the question. This affects the HTML <strong>input</strong>
- element and the key in the submission data. If no key is set, note that
- automatically added keys change when the order and amount of questions is
- modified.</li>
- </ul>
- <p>The <code class="docutils literal"><span class="pre">freetext</span></code> directive also accepts the following options in addition to
- the common question options:</p>
- <ul class="simple">
- <li><code class="docutils literal"><span class="pre">length</span></code>: (horizontal) length for the HTML text input in characters</li>
- <li><code class="docutils literal"><span class="pre">height</span></code>: vertical height of the text input in rows. If this is greater than
- 1, the <strong>textarea</strong> HTML element is used. Otherwise, a text input is used.</li>
- <li>Also other options are defined in the <a class="reference external" href="https://github.com/Aalto-LeTech/a-plus-rst-tools/blob/master/directives/questionnaire.py">questionnaire code of A+ RST tools</a>,
- but they mainly affect the CSS classes and they were implemented for very
- narrow usecases.</li>
- </ul>
- <p>The <code class="docutils literal"><span class="pre">freetext</span></code> directive accepts a second positional argument after the points.
- It defines the compare method for the model solution. A textual input can be
- compared with the model solution as <code class="docutils literal"><span class="pre">int</span></code>, <code class="docutils literal"><span class="pre">float</span></code>, <code class="docutils literal"><span class="pre">string</span></code>,
- or <code class="docutils literal"><span class="pre">unsortedchars</span></code> (unsorted character set). Another option is <code class="docutils literal"><span class="pre">regexp</span></code>
- which takes the correct answer as a regular expression and tries to match the
- submission with it using the <a class="reference external" href="https://docs.python.org/3/library/re.html">Python re library</a>.</p>
- <p>Strings have comparison modifiers that are separated with a hyphen (<code class="docutils literal"><span class="pre">-</span></code>).
- For example, to create a freetext question which compares the answer to the
- correct answer as string, and ignores whitespace characters and quotes, write
- <code class="docutils literal"><span class="pre">..</span> <span class="pre">freetext::</span> <span class="pre">30</span> <span class="pre">string-ignorews-ignorequotes</span></code>.</p>
- <ul class="simple">
- <li><code class="docutils literal"><span class="pre">ignorews</span></code>: ignore whitespace (all space characters, applies to regexp too)</li>
- <li><code class="docutils literal"><span class="pre">ignorequotes</span></code>: iqnore quotes <code class="docutils literal"><span class="pre">"</span></code> around</li>
- <li><code class="docutils literal"><span class="pre">requirecase</span></code>: require identical lower and upper cases (only with the string type)</li>
- <li><code class="docutils literal"><span class="pre">ignorerepl</span></code>: ignore REPL prefixes</li>
- <li><code class="docutils literal"><span class="pre">ignoreparenthesis</span></code>: ignore parenthesis <code class="docutils literal"><span class="pre">(</span> <span class="pre">)</span></code></li>
- </ul>
- <p>The question directives may define instructions. After the instructions,
- the contents of the directive define the choices, the correct solution, and
- possible hints. The hints are targeted to specific choices and they are shown
- after answering. See the example below.</p>
- </div>
- <div class="section" id="examples">
- <h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
- <p>Matikkaa kyselylomakkeen ulkopuolella:</p>
- <div class="math">
- \[F(b) - F(a) = \int_a^b f(x)\,\mathrm d x\]</div>
- <div class="exercise" data-aplus-exercise="/def/current/m01_introduction/07_questionnaires/m01_introduction_07_questionnaires_questionnaire_demo/" data-aplus-quiz="yes" id="chapter-exercise-1"><form action="questionnaire_demo" method="post"><div class="form-group"><label>Question 1</label><div>Subdirective <code class="docutils literal"><span class="pre">pick-one</span></code> defines a single-choice question.
- When <span class="math">\((x + 1)^3 = 27\)</span>, what is <span class="math">\(x\)</span>?</div><div class="radio"><label><input name="field_0" type="radio" value="a"/><span>9</span></label></div><div class="radio"><label><input name="field_0" type="radio" value="b"/><span>2</span></label></div><div class="radio"><label><input name="field_0" type="radio" value="c"/><span>3</span></label></div></div><div class="form-group"><label>Question 2</label><div><p>Subdirective <code class="docutils literal"><span class="pre">pick-any</span></code> defines a multiple-choice question.</p>
- <p>When <span class="math">\((x + 1)^2 = 16\)</span>, what is <span class="math">\(x\)</span>?</p>
- </div><div class="radio"><label><input name="field_1" type="checkbox" value="a"/><span>4</span></label></div><div class="radio"><label><input name="field_1" type="checkbox" value="b"/><span>an integer</span></label></div><div class="radio"><label><input name="field_1" type="checkbox" value="c"/><span>3</span></label></div><div class="radio"><label><input name="field_1" type="checkbox" value="d"/><span>an irrational number</span></label></div><div class="radio"><label><input name="field_1" type="checkbox" value="e"/><span>-3</span></label></div><div class="radio"><label><input name="field_1" type="checkbox" value="f"/><span>-5</span></label></div></div><input class="btn btn-primary" type="submit" value="Submit"/></form></div><p>The <code class="docutils literal"><span class="pre">freetext</span></code> subdirective creates text boxes and grades based on their
- input.</p>
- <div class="exercise" data-aplus-exercise="/def/current/m01_introduction/07_questionnaires/m01_introduction_07_questionnaires_questionnaire_text_demo/" data-aplus-quiz="yes" id="chapter-exercise-2"><form action="questionnaire_text_demo" method="post"><div class="form-group voluntary standard place-inline"><label>Question 1</label><div>This is the most basic free text questionnaire. The correct answer is
- <code class="docutils literal"><span class="pre">test</span></code>. You can write at most 10 characters into the box.</div><input class="place-inline" size="10" type="text"/></div><div class="form-group voluntary standard place-inline"><label>Question 2</label><div>The answer can be a number, an integer. What is <span class="math">\(3 + 8\)</span>?</div><input class="place-inline" size="7" type="text"/></div><div class="form-group voluntary standard place-inline"><label>Question 3</label><div>The answer can also be a decimal number (floating point number).
- What is <span class="math">\(3 / 8\)</span> in decimal? (When the question uses the float type,
- the grader accepts also answers that slightly differ from the model solution.)</div><input class="place-inline" size="7" type="text"/></div><input class="btn btn-primary" type="submit" value="Submit"/></form></div><div class="section" id="testing-the-questionnaries">
- <h3>Testing the questionnaries<a class="headerlink" href="#testing-the-questionnaries" title="Permalink to this headline">¶</a></h3>
- <p>It is good practise to test your questionnaire, especially if there are
- several correct answers. Note that A+ will show the correct answers for the
- students who have submitted for the maximum number of times (but not for anyone
- else).</p>
- <div class="info admonition">
- <p class="first admonition-title">String, int, or float?</p>
- <p>Use the <code class="docutils literal"><span class="pre">int</span></code> answer type always when the answer is an integer. Of course
- the answer could be compared to the right answer as a string. However, the
- benefits of <code class="docutils literal"><span class="pre">int</span></code> over <code class="docutils literal"><span class="pre">string</span></code> are the following. First, extra space
- characters are always ignored. Second, A+ shows a histogram of the numerical
- answers to the teacher when they click on <em>View all submissions</em> on the
- exercise box in A+, and then <em>Summary</em>. See Figure “the summary a
- float-freetext questionnaire” below.</p>
- <p class="last"><code class="docutils literal"><span class="pre">float</span></code> works the same way as <code class="docutils literal"><span class="pre">int</span></code>. Currently it considers the answer
- to be correct if the difference between student’s answer and the model
- solution is at most 0.02.</p>
- </div>
- <div class="figure" id="id1">
- <img alt="Screenshot of A+: summary of a float-type freetext question" src="http://localhost:8080/static/default/_images/summary-freetext-float.png"/>
- <p class="caption"><span class="caption-text"><strong>Figure:</strong> <em>the summary of a float-freetext questionnaire</em>. In this case, 304
- students (83 %) have answered the question and most of them (300) have
- received 20 points. There is only one question whose correct answer is
- between 4.8 and 5.0, with 300 students giving that answer. Four students
- have an incorrect answer having value between 1.4 and 1.6.</span></p>
- </div>
- <div class="figure" id="id2">
- <img alt="Screenshot of A+: summary of a string-type freetext question" src="http://localhost:8080/static/default/_images/summary-freetext-string.png"/>
- <p class="caption"><span class="caption-text"><strong>Figure:</strong> <em>the summary of a string-freetext questionnaire</em>. The answer
- is an SQL query, and A+ shows the unique answers. There are four identical
- answers of one type and three identical answers of another type.</span></p>
- </div>
- <div class="exercise" data-aplus-exercise="/def/current/m01_introduction/07_questionnaires/m01_introduction_07_questionnaires_questionnaire_text_demo_2/" data-aplus-quiz="yes" id="chapter-exercise-3"><form action="questionnaire_text_demo_2" method="post"><div class="form-group voluntary standard place-inline"><label>Question 1</label><div>Here the correct answer is “anothertest”. Surrounding quotes are
- ignored in the solution as well as whitespace everywhere. (modifiers
- ignorequotes and ignorews).</div><input class="place-inline" size="10" type="text"/></div><div class="form-group voluntary standard place-inline"><label>Question 2</label><div>An <code class="docutils literal"><span class="pre">unsortedchars</span></code> example. What are the unique vovels in the word
- “cacophonic”? Correct answers are: aio, aoi, iao, ioa, oai, oia, and
- also the versions with two o’s, because <em>unsortedchars</em> always compares
- unique characters.</div><input class="place-inline" size="7" type="text"/></div><input class="btn btn-primary" type="submit" value="Submit"/></form></div><p>Regular expressions are useful when there are multiple solutions, or when
- one wants to have some tolerance in numeric questions, like accept real
- numbers beginning with 0.014, 0.015, or 0.016.</p>
- <div class="exercise" data-aplus-exercise="/def/current/m01_introduction/07_questionnaires/m01_introduction_07_questionnaires_questionnaire_regexp/" data-aplus-quiz="yes" id="chapter-exercise-4"><form action="questionnaire_regexp" method="post"><div class="form-group voluntary standard place-inline"><label>Question 1</label><div>Type either “cat” or “dog”.</div><input class="place-inline" size="7" type="text"/></div><div class="form-group voluntary standard place-inline"><label>Question 2</label><div>What is the value of <span class="math">\(\pi\)</span> with four most significant digits?
- This will accept <code class="docutils literal"><span class="pre">3.141</span></code>, <code class="docutils literal"><span class="pre">3.1415</span></code>, <code class="docutils literal"><span class="pre">3.1416</span></code>, <code class="docutils literal"><span class="pre">3.14159</span></code>, that is,
- <code class="docutils literal"><span class="pre">3.141</span></code> and zero or more digits after that.</div><input class="place-inline" size="7" type="text"/></div><input class="btn btn-primary" type="submit" value="Submit"/></form></div></div>
- </div>
- <div class="section" id="additional-information">
- <h2>Additional information<a class="headerlink" href="#additional-information" title="Permalink to this headline">¶</a></h2>
- <p>See the source code of <a class="reference external" href="https://github.com/Aalto-LeTech/a-plus-rst-tools/blob/master/directives/questionnaire.py">the A+ RST tools questionnaire directive</a>
- and the corresponding <a class="reference external" href="https://github.com/Aalto-LeTech/mooc-grader/blob/master/access/types/forms.py">form implementation in mooc-grader</a>.</p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id="submit-progress" class="hide progress">
- <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%;">
- Posting submission...
- </div>
- </div>
- <div id="loading-indicator" class="hide progress"
- data-msg-load="Loading exercise..."
- data-msg-submit="Posting submission..."
- data-msg-error="Communication error with the exercise.">
- <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%;"></div>
- </div>
- <div id="quiz-success" class="hide">
- <h3 class="text-center">Submission received.</h3>
- <p class="text-center badge-placeholder"></p>
- <button type="button" class="btn btn-success center-block read-feedback" data-dismiss="modal">
- Go to feedback
- </button>
- </div>
- </div>
- </div>
- <nav class="row siblings">
- <a href="/def/current/m02_programming_exercises/" class="pull-right btn btn-link">
- 2. Module 2 - Programming exercises »
- </a>
- <a href="/def/current/m01_introduction/06_languages/" class="pull-left btn btn-link">
- « 1.6 Multilingual course (i18n)
- </a>
- <span class="hidden-md hidden-sm hidden-xs" style="display: block; margin: auto; text-align: center;">
- <a href="/def/current/toc/">
- Course materials
- </a>
- </span>
- </nav>
- </div>
- </div>
- </div>
- <nav class="site-footer navbar navbar-default navbar-fixed-bottom">
- <div class="container-fluid">
- <ul class="nav navbar-nav">
- <li role="presentation"><a href="/accounts/privacy-notice/">Privacy Notice</a></li>
- </ul>
- </div>
- </nav>
- </div>
- <div id="page-modal" class="modal" role="dialog">
- <div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-progress">
- <div class="progress">
- <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%" data-msg-error="Loading failed!">
- Loading...
- </div>
- </div>
- </div>
- <div class="modal-body"></div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">
- Close
- </button>
- </div>
- </div>
- </div>
- </div>
- <div id="file-modal" class="modal" role="dialog">
- <div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-progress">
- <div class="progress">
- <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%" data-msg-error="Loading failed!">
- Loading...
- </div>
- </div>
- </div>
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- <h4 class="modal-title"></h4>
- </div>
- <div class="modal-body"></div>
- </div>
- </div>
- </div>
- <div id="search-select-widget" class="hide">
- <ul class="list-inline search-selected">
- <li><button type="button"><span class="name">None</span> <span aria-label="Remove">×</span></button></li>
- </ul>
- <div class="input-group">
- <span class="input-group-btn dropdown-toggle" aria-haspopup="true" aria-expanded="false">
- <button class="btn btn-default" data-toggle="dropdown" type="button" aria-label="Search">
- <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
- </button>
- <ul class="dropdown-menu search-options">
- <li class="not-found"><a>No matches</a></li>
- </ul>
- </span>
- <input type="text" class="form-control" placeholder="Search for..." />
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement