Advertisement
Guest User

A+ KaTeX template

a guest
Jun 4th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 38.03 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6. <!DOCTYPE html>
  7. <html lang="en">
  8.     <head>
  9.         <meta charset="utf-8" />
  10.         <meta name="viewport" content="width=device-width, initial-scale=1">
  11.  
  12.         <title>1.7 Creating questionnaire exercises | Def. Course | A+ </title>
  13.  
  14.         <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
  15.  
  16.         <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
  17.         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  18.  
  19.         <link href="https://use.fontawesome.com/releases/v5.3.1/css/solid.css" rel="stylesheet" integrity="sha384-VGP9aw4WtGH/uPAOseYxZ+Vz/vaTb1ehm1bwx92Fm8dTrE+3boLfF1SpAtB1z7HW" crossorigin="anonymous">
  20.         <link href="https://use.fontawesome.com/releases/v5.3.1/css/regular.css" rel="stylesheet" integrity="sha384-ZlNfXjxAqKFWCwMwQFGhmMh3i89dWDnaFU2/VZg9CvsMGA7hXHQsPIqS+JIAmgEq" crossorigin="anonymous">
  21.  
  22.         <link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/github.min.css" rel="stylesheet" />
  23.         <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script>
  24.  
  25.         <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.12/clipboard.min.js"></script>
  26.  
  27.         <script src="/static/js/translate.min.js"></script>
  28.  
  29.        
  30.         <link
  31.            data-translation
  32.            rel="preload"
  33.            as="fetch"
  34.            hreflang="fi"
  35.            href="/static/js-translations/teacher.fi.json"
  36.        >
  37.        
  38.  
  39.        
  40.        
  41.        
  42.  
  43.  
  44.         <link rel="stylesheet" href="/static/css/main.css" />
  45.         <link rel="stylesheet" href="/static/css/submission.css" />
  46.         <link rel="stylesheet" href="/static/django_colortag.css" />
  47.         <script src="/static/js/polyfill-find.js"></script>
  48.         <script src="/static/js/aplus.js"></script>
  49.  
  50.        
  51.  
  52.  
  53.            
  54.        
  55.  
  56.  
  57.  
  58. <script src="/static/js/external_launcher.js"></script>
  59. <link rel="stylesheet" type="text/css" href="/static/css/external_services.css">
  60. <script src="/static/exercise/poll.js"></script>
  61. <script src="/static/exercise/group.js"></script>
  62. <script src="/static/exercise/chapter.js"></script>
  63. <script
  64.    src="/static/exercise/language_link.js"
  65.    data-set-lang="/accounts/i18n/setlang/"></script>
  66. <script>
  67. // Visualize loading in case of slow POST operations.
  68. /*$(function() {
  69.     var forms = $("#exercise-page-content").find("form:not([data-aplus-exercise] form)");
  70.     forms.on("submit", function(event) {
  71.         $("#submit-progress").removeClass("hide");
  72.     });
  73. });*/
  74.  
  75. // Add an Ajax exercise event listener to refresh the info column.
  76. window.addEventListener("message", function (event) {
  77.     if (event.data.type === "a-plus-refresh-stats") {
  78.         $("#submit-progress").addClass("hide");
  79.         var $stats = $("#exercise-info"),
  80.             url = $stats.data("url");
  81.         $stats.load(url, function() {
  82.             $stats.find('[data-toggle="tooltip"]').tooltip();
  83.         });
  84.     }
  85. });
  86. </script>
  87. <link data-aplus="yes" href="http://localhost:8080/static/default/_static/default.css" rel="stylesheet" type="text/css"/>
  88. <link data-aplus="yes" href="http://localhost:8080/static/default/_static/pygments.css" rel="stylesheet" type="text/css"/>
  89. <link crossorigin="anonymous" data-aplus="" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" rel="stylesheet"/>
  90. <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>
  91. <script data-aplus="">
  92.     function render_katex() {
  93.       if (window.katex) {
  94.           renderMathInElement(document.body,{delimiters: [
  95.           {left: "\\[", right: "\\]", display: true},
  96.           {left: "\\(", right: "\\)", display: false}]}
  97.           );
  98.         console.log("Math rendered.");
  99.       } else {
  100.         console.log("KaTeX not loaded.")
  101.       };
  102.     };
  103.   </script>
  104. <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>
  105. <link data-aplus="" href="http://localhost:8080/static/default/_static/course.css" rel="stylesheet" type="text/css"/>
  106. <link data-aplus="" href="http://localhost:8080/static/default/_static/active_element.css" rel="stylesheet" type="text/css"/>
  107.  
  108.  
  109.         <!-- Some favicons courtesy of http://realfavicongenerator.net/ -->
  110.         <link rel="apple-touch-icon" sizes="57x57" href="/static/favicons/apple-touch-icon-57x57.png">
  111.         <link rel="apple-touch-icon" sizes="114x114" href="/static/favicons/apple-touch-icon-114x114.png">
  112.         <link rel="apple-touch-icon" sizes="72x72" href="/static/favicons/apple-touch-icon-72x72.png">
  113.         <link rel="apple-touch-icon" sizes="144x144" href="/static/favicons/apple-touch-icon-144x144.png">
  114.         <link rel="apple-touch-icon" sizes="60x60" href="/static/favicons/apple-touch-icon-60x60.png">
  115.         <link rel="apple-touch-icon" sizes="120x120" href="/static/favicons/apple-touch-icon-120x120.png">
  116.         <link rel="apple-touch-icon" sizes="76x76" href="/static/favicons/apple-touch-icon-76x76.png">
  117.         <link rel="apple-touch-icon" sizes="152x152" href="/static/favicons/apple-touch-icon-152x152.png">
  118.         <link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon-180x180.png">
  119.         <link rel="icon" type="image/png" href="/static/favicons/favicon-192x192.png" sizes="192x192">
  120.         <link rel="icon" type="image/png" href="/static/favicons/favicon-160x160.png" sizes="160x160">
  121.         <link rel="icon" type="image/png" href="/static/favicons/favicon-96x96.png" sizes="96x96">
  122.         <link rel="icon" type="image/png" href="/static/favicons/favicon-16x16.png" sizes="16x16">
  123.         <link rel="icon" type="image/png" href="/static/favicons/favicon-32x32.png" sizes="32x32">
  124.         <meta name="msapplication-TileColor" content="#2b5797">
  125.         <meta name="msapplication-TileImage" content="/static/mstile-144x144.png">
  126.     </head>
  127.     <body class="internal-student lang-en" data-view-tag="exercise">
  128.         <div class="page-wrap">
  129.             <nav class="topbar navbar navbar-inverse navbar-static-top">
  130.                 <div class="container-fluid">
  131.                     <div class="navbar-header">
  132.                         <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar-collapse" aria-expanded="false">
  133.                             <span class="sr-only">Toggle navigation</span>
  134.                            
  135.                            
  136.                             <span class="icon-bar"></span>
  137.                             <span class="icon-bar"></span>
  138.                             <span class="icon-bar"></span>
  139.                         </button>
  140.                         <a class="navbar-brand hidden-xs" href="/">A+</a>
  141.                         <span class="navbar-brand visible-xs">
  142.                         A+ &nbsp; Def. Course
  143.                         </span>
  144.                     </div>
  145.                     <div class="collapse navbar-collapse" id="bs-navbar-collapse">
  146.                         <ul class="nav navbar-nav hidden-xs">
  147.                             <li role="presentation" class="dropdown">
  148.                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
  149.                                    
  150.                                     DEF000 Def. Course
  151.                                    
  152.                                    
  153.                                     <span class="caret"></span>
  154.                                 </a>
  155.                                
  156. <ul class="dropdown-menu">
  157.    
  158.    
  159.     <li role="presentation">
  160.         <a href="/def/current/">
  161.             DEF000 Def. Course: Current
  162.         </a>
  163.     </li>
  164.    
  165.    
  166. </ul>
  167.  
  168.                             </li>
  169.                         </ul>
  170.                         <ul class="user-menu nav navbar-nav navbar-right hidden-xs">
  171.                            
  172.                            
  173.  
  174.  
  175.  
  176.                            
  177.  
  178.  
  179.                             <li role="presentation" class="profile-menu dropdown">
  180.                               <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
  181.                                 <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
  182.                                 Ruth Robinson <span class="caret"></span>
  183.                               </a>
  184.                               <ul class="dropdown-menu">
  185.                                 <li role="presentation">
  186.                                     <a href="/accounts/accounts/">Profile</a>
  187.                                 </li>
  188.                                 <li role="separator" class="divider"></li>
  189.                                 <li role="presentation">
  190.                                   <a href="/accounts/logout/">
  191.                                     <span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
  192.                                     Log out
  193.                                   </a>
  194.                                 </li>
  195.                               </ul>
  196.                             </li>
  197.                            
  198.                         </ul>
  199.  
  200.                        
  201.                         <ul class="nav navbar-nav visible-xs">
  202.                            
  203.  
  204.  
  205.                            
  206.  
  207.  
  208.  
  209.                            
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221. <li role="presentation" class="header">
  222.     <h4>Course</h4>
  223. </li>
  224.  
  225.  
  226. <li role="presentation" class="menu-home">
  227.     <a href="/def/current/">
  228.         <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
  229.         DEF000
  230.     </a>
  231. </li>
  232. <li role="presentation" class="menu-toc">
  233.     <a href="/def/current/toc/">
  234.         <span class="glyphicon glyphicon-book" aria-hidden="true"></span>
  235.         Course materials
  236.     </a>
  237. </li>
  238. <li role="presentation" class="menu-results">
  239.     <a href="/def/current/user/results/">
  240.         <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
  241.         Exercise results
  242.     </a>
  243. </li>
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254. <li role="presentation" class="header">
  255.     <h4>Course staff</h4>
  256. </li>
  257.  
  258. <li role="presentation" class="menu-participants">
  259.     <a href="/def/current/teachers/participants/">
  260.         <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
  261.         Participants
  262.     </a>
  263. </li>
  264.  
  265. <li role="presentation" class="menu-groups-edit">
  266.     <a href="/def/current/teachers/groups/">
  267.         <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
  268.         Groups
  269.     </a>
  270. </li>
  271.  
  272.  
  273.  
  274. <li role="presentation" class="menu-all-results">
  275.     <a href="/def/current/teachers/results/">
  276.         <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
  277.         All results
  278.     </a>
  279. </li>
  280.  
  281. <li role="presentation" class="menu-analytics">
  282.     <a href="/def/current/teachers/analytics/">
  283.         <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
  284.         Visualizations
  285.     </a>
  286. </li>
  287.  
  288.  
  289. <li role="presentation" class="menu-edit-news">
  290.         <a href="/def/current/teachers/news/">
  291.                 <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
  292.                 Edit news
  293.         </a>
  294. </li>
  295. <li role="presentation" class="menu-edit-course">
  296.         <a href="/def/current/teachers/">
  297.                 <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
  298.                 Edit course
  299.         </a>
  300. </li>
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.                             <li role="presentation" class="header"><h4>Site</h4></li>
  309.                             <li role="presentation">
  310.                                 <a href="/">
  311.                                     <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
  312.                                     Home
  313.                                 </a>
  314.                             </li>
  315.                            
  316. <ul class="dropdown-menu">
  317.    
  318.    
  319.     <li role="presentation">
  320.         <a href="/def/current/">
  321.             DEF000 Def. Course: Current
  322.         </a>
  323.     </li>
  324.    
  325.    
  326. </ul>
  327.  
  328.                            
  329.                             <li role="presentation">
  330.                                 <a href="/accounts/accounts/">
  331.                                     <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
  332.                                     Ruth Robinson
  333.                                 </a>
  334.                             </li>
  335.                             <li role="presentation">
  336.                                 <a href="/accounts/logout/">
  337.                                     <span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
  338.                                     Log out
  339.                                 </a>
  340.                             </li>
  341.                            
  342.                         </ul>
  343.                     </div>
  344.                 </div>
  345.             </nav>
  346.  
  347.             <div class="site-content container-fluid">
  348.                
  349.                
  350.  
  351.                
  352. <div data-taggings=""  class="row">
  353.     <div class="col-sm-2 hidden-xs">
  354.         <nav class="course-menu" id="main-course-menu">
  355.             <ul class="nav nav-pills nav-stacked">
  356.                
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366. <li role="presentation" class="header">
  367.     <h4>Course</h4>
  368. </li>
  369.  
  370.  
  371. <li role="presentation" class="menu-home">
  372.     <a href="/def/current/">
  373.         <span class="glyphicon glyphicon-home" aria-hidden="true"></span>
  374.         DEF000
  375.     </a>
  376. </li>
  377. <li role="presentation" class="menu-toc">
  378.     <a href="/def/current/toc/">
  379.         <span class="glyphicon glyphicon-book" aria-hidden="true"></span>
  380.         Course materials
  381.     </a>
  382. </li>
  383. <li role="presentation" class="menu-results">
  384.     <a href="/def/current/user/results/">
  385.         <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
  386.         Exercise results
  387.     </a>
  388. </li>
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399. <li role="presentation" class="header">
  400.     <h4>Course staff</h4>
  401. </li>
  402.  
  403. <li role="presentation" class="menu-participants">
  404.     <a href="/def/current/teachers/participants/">
  405.         <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
  406.         Participants
  407.     </a>
  408. </li>
  409.  
  410. <li role="presentation" class="menu-groups-edit">
  411.     <a href="/def/current/teachers/groups/">
  412.         <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
  413.         Groups
  414.     </a>
  415. </li>
  416.  
  417.  
  418.  
  419. <li role="presentation" class="menu-all-results">
  420.     <a href="/def/current/teachers/results/">
  421.         <span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
  422.         All results
  423.     </a>
  424. </li>
  425.  
  426. <li role="presentation" class="menu-analytics">
  427.     <a href="/def/current/teachers/analytics/">
  428.         <span class="glyphicon glyphicon-stats" aria-hidden="true"></span>
  429.         Visualizations
  430.     </a>
  431. </li>
  432.  
  433.  
  434. <li role="presentation" class="menu-edit-news">
  435.         <a href="/def/current/teachers/news/">
  436.                 <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
  437.                 Edit news
  438.         </a>
  439. </li>
  440. <li role="presentation" class="menu-edit-course">
  441.         <a href="/def/current/teachers/">
  442.                 <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
  443.                 Edit course
  444.         </a>
  445. </li>
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.             </ul>
  453.         </nav>
  454.  
  455.         <!--div class="calendar-view">
  456.            <h4>Calendar</h4>
  457.            <div id="study-calendar"></div>
  458.            <p>
  459.                <a href="/def/current/user/export-calendar/">
  460.                    <small>Download calendar (ics)</small>
  461.                </a>
  462.            </p>
  463.        </div-->
  464.     </div>
  465.     <div class="col-sm-10">
  466.        
  467.  
  468.  
  469.  
  470. <nav class="row siblings">
  471.  
  472.    
  473.    
  474.    
  475.     <a href="/def/current/m02_programming_exercises/" class="pull-right btn btn-link">
  476.         2. Module 2 - Programming exercises &raquo;
  477.     </a>
  478.    
  479.    
  480.  
  481.    
  482.    
  483.    
  484.     <a href="/def/current/m01_introduction/06_languages/" class="pull-left btn btn-link">
  485.         &laquo; 1.6 Multilingual course (i18n)
  486.     </a>
  487.    
  488.    
  489.  
  490.     <span class="hidden-md hidden-sm hidden-xs" style="display: block; margin: auto; text-align: center;">
  491.         <a href="/def/current/toc/">
  492.             Course materials
  493.         </a>
  494.     </span>
  495.  
  496. </nav>
  497.  
  498.  
  499.        
  500.         <ol class="breadcrumb">
  501.            
  502.  
  503.             <li><a href="/def/current/">DEF000</a></li>
  504.            
  505. <li><a href="/def/current/m01_introduction/">1. Module 1 - Introduction</a></li>
  506.  
  507.  
  508. <li class="active">1.7 Creating questionnaire exercises</li>
  509.  
  510.  
  511.         </ol>
  512.        
  513.         <div class="row">
  514.            
  515. <div class="col-lg-12 exercise-column">
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523. <div
  524.    id="exercise-page-content"
  525.    
  526. >
  527.   <div class="overlay-parent">
  528.    
  529.     <div >
  530.      
  531.                   <div class="content">
  532.   <div class="section" id="creating-questionnaire-exercises">
  533. <h1>Creating questionnaire exercises<a class="headerlink" href="#creating-questionnaire-exercises" title="Permalink to this headline"></a></h1>
  534. <p>One can easily create simple questionnaire exercises for an A+ course, such as
  535. one-line text answers and multiple choice exercises. This page shows many
  536. examples on these.</p>
  537. <p><em>Technical remark.</em> The most recent and complete documentation on this can
  538. 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
  539. provide specific Sphinx directives for writing course HTML and configuration
  540. files, and then A+ and mooc-grader implement the actual functionality.</p>
  541. <div class="section" id="general-description-of-the-options">
  542. <h2>General description of the options<a class="headerlink" href="#general-description-of-the-options" title="Permalink to this headline"></a></h2>
  543. <p>The <code class="docutils literal"><span class="pre">questionnaire</span></code> directive implements a questionnaire exercise. Its
  544. arguments define the exercise key (exercise identifier for A+) and max points
  545. 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,
  546. <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>,
  547. 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
  548. does not affect any scorekeeping, but only works as an indicator for the
  549. student. (The A+ REST API can group earned points by the difficulty so that
  550. the teacher may use the difficulties for computing final course grades.)</p>
  551. <p>The questionnaire directive accepts the following options:</p>
  552. <ul class="simple">
  553. <li><code class="docutils literal"><span class="pre">submissions</span></code>: max submissions</li>
  554. <li><code class="docutils literal"><span class="pre">points-to-pass</span></code>: points to pass</li>
  555. <li><code class="docutils literal"><span class="pre">feedback</span></code>: If set, assumes the defaults for a feedback questionnaire</li>
  556. <li><code class="docutils literal"><span class="pre">no-override</span></code>: If set, the conf.py override setting is ignored</li>
  557. <li><code class="docutils literal"><span class="pre">pick_randomly</span></code>: integer. Set the pick_randomly setting for the quiz
  558. (select N questions randomly on each load)</li>
  559. <li><code class="docutils literal"><span class="pre">category</span></code>: exercise category</li>
  560. </ul>
  561. <p>The contents of the questionnaire directive define the questions and possible
  562. instructions to students.</p>
  563. <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
  564. the points of the question as the first argument. The sum of the question points
  565. should be equal to the questionnaire max points. The question directives accept
  566. the following options:</p>
  567. <ul class="simple">
  568. <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>
  569. <li><code class="docutils literal"><span class="pre">required</span></code>: If set, the question is required and empty answers are rejected</li>
  570. <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>
  571. element and the key in the submission data. If no key is set, note that
  572. automatically added keys change when the order and amount of questions is
  573. modified.</li>
  574. </ul>
  575. <p>The <code class="docutils literal"><span class="pre">freetext</span></code> directive also accepts the following options in addition to
  576. the common question options:</p>
  577. <ul class="simple">
  578. <li><code class="docutils literal"><span class="pre">length</span></code>: (horizontal) length for the HTML text input in characters</li>
  579. <li><code class="docutils literal"><span class="pre">height</span></code>: vertical height of the text input in rows. If this is greater than
  580. 1, the <strong>textarea</strong> HTML element is used. Otherwise, a text input is used.</li>
  581. <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>,
  582. but they mainly affect the CSS classes and they were implemented for very
  583. narrow usecases.</li>
  584. </ul>
  585. <p>The <code class="docutils literal"><span class="pre">freetext</span></code> directive accepts a second positional argument after the points.
  586. It defines the compare method for the model solution. A textual input can be
  587. 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>,
  588. 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>
  589. which takes the correct answer as a regular expression and tries to match the
  590. submission with it using the <a class="reference external" href="https://docs.python.org/3/library/re.html">Python re library</a>.</p>
  591. <p>Strings have comparison modifiers that are separated with a hyphen (<code class="docutils literal"><span class="pre">-</span></code>).
  592. For example, to create a freetext question which compares the answer to the
  593. correct answer as string, and ignores whitespace characters and quotes, write
  594. <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>
  595. <ul class="simple">
  596. <li><code class="docutils literal"><span class="pre">ignorews</span></code>: ignore whitespace (all space characters, applies to regexp too)</li>
  597. <li><code class="docutils literal"><span class="pre">ignorequotes</span></code>: iqnore quotes <code class="docutils literal"><span class="pre">"</span></code> around</li>
  598. <li><code class="docutils literal"><span class="pre">requirecase</span></code>: require identical lower and upper cases (only with the string type)</li>
  599. <li><code class="docutils literal"><span class="pre">ignorerepl</span></code>: ignore REPL prefixes</li>
  600. <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>
  601. </ul>
  602. <p>The question directives may define instructions. After the instructions,
  603. the contents of the directive define the choices, the correct solution, and
  604. possible hints. The hints are targeted to specific choices and they are shown
  605. after answering. See the example below.</p>
  606. </div>
  607. <div class="section" id="examples">
  608. <h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
  609. <p>Matikkaa kyselylomakkeen ulkopuolella:</p>
  610. <div class="math">
  611. \[F(b) - F(a) = \int_a^b f(x)\,\mathrm d x\]</div>
  612. <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.
  613. 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>
  614. <p>When <span class="math">\((x + 1)^2 = 16\)</span>, what is <span class="math">\(x\)</span>?</p>
  615. </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
  616. input.</p>
  617. <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
  618. <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).
  619. What is <span class="math">\(3 / 8\)</span> in decimal? (When the question uses the float type,
  620. 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">
  621. <h3>Testing the questionnaries<a class="headerlink" href="#testing-the-questionnaries" title="Permalink to this headline"></a></h3>
  622. <p>It is good practise to test your questionnaire, especially if there are
  623. several correct answers. Note that A+ will show the correct answers for the
  624. students who have submitted for the maximum number of times (but not for anyone
  625. else).</p>
  626. <div class="info admonition">
  627. <p class="first admonition-title">String, int, or float?</p>
  628. <p>Use the <code class="docutils literal"><span class="pre">int</span></code> answer type always when the answer is an integer. Of course
  629. the answer could be compared to the right answer as a string. However, the
  630. 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
  631. characters are always ignored. Second, A+ shows a histogram of the numerical
  632. answers to the teacher when they click on <em>View all submissions</em> on the
  633. exercise box in A+, and then <em>Summary</em>. See Figure “the summary a
  634. float-freetext questionnaire” below.</p>
  635. <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
  636. to be correct if the difference between student’s answer and the model
  637. solution is at most 0.02.</p>
  638. </div>
  639. <div class="figure" id="id1">
  640. <img alt="Screenshot of A+: summary of a float-type freetext question" src="http://localhost:8080/static/default/_images/summary-freetext-float.png"/>
  641. <p class="caption"><span class="caption-text"><strong>Figure:</strong> <em>the summary of a float-freetext questionnaire</em>. In this case, 304
  642. students (83 %) have answered the question and most of them (300) have
  643. received 20 points. There is only one question whose correct answer is
  644. between 4.8 and 5.0, with 300 students giving that answer. Four students
  645. have an incorrect answer having value between 1.4 and 1.6.</span></p>
  646. </div>
  647. <div class="figure" id="id2">
  648. <img alt="Screenshot of A+: summary of a string-type freetext question" src="http://localhost:8080/static/default/_images/summary-freetext-string.png"/>
  649. <p class="caption"><span class="caption-text"><strong>Figure:</strong> <em>the summary of a string-freetext questionnaire</em>. The answer
  650. is an SQL query, and A+ shows the unique answers. There are four identical
  651. answers of one type and three identical answers of another type.</span></p>
  652. </div>
  653. <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
  654. ignored in the solution as well as whitespace everywhere. (modifiers
  655. 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
  656. “cacophonic”? Correct answers are: aio, aoi, iao, ioa, oai, oia, and
  657. also the versions with two o’s, because <em>unsortedchars</em> always compares
  658. 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
  659. one wants to have some tolerance in numeric questions, like accept real
  660. numbers beginning with 0.014, 0.015, or 0.016.</p>
  661. <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?
  662. 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,
  663. <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>
  664. </div>
  665. <div class="section" id="additional-information">
  666. <h2>Additional information<a class="headerlink" href="#additional-information" title="Permalink to this headline"></a></h2>
  667. <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>
  668. 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>
  669. </div>
  670. </div>
  671.  
  672.  
  673.                   </div>
  674.                
  675.     </div>
  676.   </div>
  677. </div>
  678.  
  679. <div id="submit-progress" class="hide progress">
  680.   <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%;">
  681.     Posting submission...
  682.   </div>
  683. </div>
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690. <div id="loading-indicator" class="hide progress"
  691.  data-msg-load="Loading exercise..."
  692.  data-msg-submit="Posting submission..."
  693.  data-msg-error="Communication error with the exercise.">
  694.   <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%;"></div>
  695. </div>
  696.  
  697. <div id="quiz-success" class="hide">
  698.   <h3 class="text-center">Submission received.</h3>
  699.   <p class="text-center badge-placeholder"></p>
  700.   <button type="button" class="btn btn-success center-block read-feedback" data-dismiss="modal">
  701.     Go to feedback
  702.   </button>
  703. </div>
  704.  
  705.  
  706. </div>
  707.  
  708.  
  709.  
  710.         </div>
  711.        
  712.  
  713.  
  714.  
  715. <nav class="row siblings">
  716.  
  717.    
  718.    
  719.    
  720.     <a href="/def/current/m02_programming_exercises/" class="pull-right btn btn-link">
  721.         2. Module 2 - Programming exercises &raquo;
  722.     </a>
  723.    
  724.    
  725.  
  726.    
  727.    
  728.    
  729.     <a href="/def/current/m01_introduction/06_languages/" class="pull-left btn btn-link">
  730.         &laquo; 1.6 Multilingual course (i18n)
  731.     </a>
  732.    
  733.    
  734.  
  735.     <span class="hidden-md hidden-sm hidden-xs" style="display: block; margin: auto; text-align: center;">
  736.         <a href="/def/current/toc/">
  737.             Course materials
  738.         </a>
  739.     </span>
  740.  
  741. </nav>
  742.  
  743.  
  744.     </div>
  745. </div>
  746.  
  747.             </div>
  748.  
  749.            
  750.             <nav class="site-footer navbar navbar-default navbar-fixed-bottom">
  751.                 <div class="container-fluid">
  752.                     <ul class="nav navbar-nav">
  753.                        
  754.                         <li role="presentation"><a href="/accounts/privacy-notice/">Privacy Notice</a></li>
  755.                     </ul>
  756.                 </div>
  757.             </nav>
  758.            
  759.         </div>
  760.         <div id="page-modal" class="modal" role="dialog">
  761.             <div class="modal-dialog modal-lg">
  762.                 <div class="modal-content">
  763.                     <div class="modal-progress">
  764.                       <div class="progress">
  765.                         <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%" data-msg-error="Loading failed!">
  766.                           Loading...
  767.                         </div>
  768.                       </div>
  769.                     </div>
  770.                     <div class="modal-body"></div>
  771.                     <div class="modal-footer">
  772.                       <button type="button" class="btn btn-default" data-dismiss="modal">
  773.                         Close
  774.                       </button>
  775.                     </div>
  776.                 </div>
  777.             </div>
  778.         </div>
  779.         <div id="file-modal" class="modal" role="dialog">
  780.             <div class="modal-dialog modal-lg">
  781.                 <div class="modal-content">
  782.                     <div class="modal-progress">
  783.                       <div class="progress">
  784.                         <div class="progress-bar progress-bar-striped active" role="progressbar" style="width:100%" data-msg-error="Loading failed!">
  785.                           Loading...
  786.                         </div>
  787.                       </div>
  788.                     </div>
  789.                     <div class="modal-header">
  790.                         <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  791.                             <span aria-hidden="true">&times;</span>
  792.                         </button>
  793.                         <h4 class="modal-title"></h4>
  794.                     </div>
  795.                     <div class="modal-body"></div>
  796.                 </div>
  797.             </div>
  798.         </div>
  799.         <div id="search-select-widget" class="hide">
  800.             <ul class="list-inline search-selected">
  801.                 <li><button type="button"><span class="name">None</span> <span aria-label="Remove">&times;</span></button></li>
  802.             </ul>
  803.             <div class="input-group">
  804.                 <span class="input-group-btn dropdown-toggle" aria-haspopup="true" aria-expanded="false">
  805.                     <button class="btn btn-default" data-toggle="dropdown" type="button" aria-label="Search">
  806.                         <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
  807.                     </button>
  808.                     <ul class="dropdown-menu search-options">
  809.                         <li class="not-found"><a>No matches</a></li>
  810.                     </ul>
  811.                 </span>
  812.                 <input type="text" class="form-control" placeholder="Search for..." />
  813.             </div>
  814.         </div>
  815.        
  816.     </body>
  817. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement