QuestionMarkup
Synopsis
Mark up for interactive questions.
Description
The specification of questions is being redesigned; The information provided here is outdated.
The following types of questions are supported:
- Text: a text question with a free format answer.
- Choice: a multiple choice question.
- Type: question about the type of a Rascal expression.
- Value: question about the value of a Rascal expression.
Text gives the question text and lists all possible good answers.
Choice is a straightforward listing of good and bad answers.
Type and Value questions are based on a template that consists of an optional listing and an equality:
There should be exactly one hole (indicated by <?>
) in this template that is to be filled in by the student; it may occur in the listing
or in one of the sides of the equality. The general structure is therefore: fill in the hole such that the equality holds.
Given that the listing is optional, this template represents 5 different question styles.
Type and Value questions use Type Descriptors to describe desired values and share certain common steps (QSteps):
prep: RascalCommand
describes preparatory steps needed to execute the question. Typically, required imports can be listed here.make: Var = TypeDescriptor
: makes a new value generated according to TypeDescriptor and assigns it to a new variable Var. Var can be used in later steps in the same question.expr: Var = Expr
: introduces a new variable Var and assigns to it the result of evaluating Expr. Expr may contain references to previously introduced variables using<
Var>
.type: TypeDescriptor
hint: Text
: a hint to be given to the student in response to a wrong answer. Text may contain references to previously introduced variables.test: Expr₁ == Expr₂
: the equality that should hold. The expressions may contain references to variables. One side may contain a hole (<?>
).list: Text
: a listing that runs until the next question or the end of the concept. It may contain a hole.
Examples
prep: import List;
imports the List module before executing the following steps.make: A = set[arb[int,str]]
introducesA
and assigns it a value of the indicated type.make: B = same[A]
introducesB
and assigns it a value of the same type asA
.expr: C = <A> + <B>
: inserts the values ofA
andB
, performs the addition, and assigns the result toC
.type: set[int]
: the required type isset[int]
.hint: One or more integers separated by comma's
.test: <A> + <?> == <C>
: the student has to replace<?>
by an answwer that makes the equality true.