Synopsis Mark up for interactive questions.
Description 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 TypeDescriptors 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: Expr1 == Expr2: 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.
  • prep: import List; imports the List module before executing the following steps.
  • make: A = set[arb[int,str]] introduces A and assigns it a value of the indicated type.
  • make: B = same[A] introduces B and assigns it a value of the same type as A.
  • expr: C = <A> + <B>: inserts the values of A and B, performs the addition, and assigns the result to C.
  • type: set[int]: the required type is set[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.
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit