Changes between Version 36 and Version 37 of BoltRef


Ignore:
Timestamp:
Oct 24, 2008, 12:43:41 PM (16 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BoltRef

    v36 v37  
    5656== Exercises ==
    5757
    58 Exercises are PHP scripts that call Bolt API functions.
    59 Here's an example consisting of a multiple-choice question:
     58Exercises are PHP scripts that call Bolt API functions to create questions.
     59The API is:
     60{{{
     61exclusive_choice(
     62    'option1',
     63    'option2',
     64     ...
     65    [ weight(X) ]
     66);
     67}}}
     68This specifies a multiple-choice question where at most one answer can be chosen.
     69The correct choice is the first one
     70(when the question is shown, the choices are presented in a random order).
     71
     72An exercise script can contain multiple questions.
     73If '''weight()''' is given, it specifies this question's grading weight;
     74the default is 1.
     75
     76{{{
     77inclusive_choice(
     78    array('option1', true|false),
     79    array('option2', true|false),
     80    [ weight(X) ]
     81);
     82}}}
     83This specifies a multiple-choice question where any number of answers can be chosen.
     84
     85{{{
     86image_rect(
     87   image_filename,
     88   array(100, 60, 110, 70)
     89);
     90?>
     91}}}
     92This specifies a question where the student clicks on an image;
     93a correct answer is a click in the indicated subrectangle.
     94
     95In addition to calling these functions,
     96an exercise script can put text before or after the questions.
     97Example:
    6098{{{
    6199<?php
    62100echo 'Conifers are so named because:';
    63101exclusive_choice(
    64    array(
    65       'They carry their seeds in cones.'
    66       'They are cone-shaped.',
    67       'They originated during the Coniceous era.',
    68    ),
    69 );
    70 ?>
    71 }}}
    72 The correct choice is the first element of the array.
    73 Each time the question is shown,
    74 the choices are presented in a random order.
    75 
    76 Here's an example that shows an image;
    77 a correct answer is a click in the indicated subrectangle.
    78 {{{
    79 <?php
    80 echo "Click on the dog's nose:<p>";
    81 image_rect(
    82    'dog.jpg',
    83    array(100, 60, 110, 70)
    84 );
    85 ?>
    86 }}}
    87 
    88 Bolt supplies functions for other types of questions,
    89 such as inclusive multiple-choice and fill-in-the-blank.
    90 An exercise can include multiple questions.
     102   'They carry their seeds in cones.'
     103   'They are cone-shaped.',
     104   'They originated during the Coniceous era.'
     105);
     106?>
     107}}}
     108
    91109
    92110== Course documents ==