Options
All
  • Public
  • Public/Protected
  • All
Menu

Module response/fitb

Index

Type aliases

FITBSpecification: { kind: "fill_in_the_blank"; content: string; sample_solution?: ViableSubmission<FITBSubmission>; default_grader?: GraderSpecificationFor<"fill_in_the_blank"> }

An FITB response includes markdown-formatted content containing "blanks" and "boxes" that students fill in to compose their response.

The FITBSpecification type alias represents the information needed to specify an FITB response as part of a question.

Here's an example of a question with an FITB response. The content is specified as a backtick-quoted multi-string literal in typescript. (Note there are also escaped backticks around a markdown code block).

image

export const Practice_Questions_Iterators_And_Functors_Replacer: QuestionSpecification = {
question_id: "practice_iterators_and_functors_replacer_fitb",
tags: [],
points: 8,
mk_description:
`
Complete the implementation of \`Replacer\` below by filling in the boxes.

If you believe a blank/box should be **empty**, write \`BLANK\`.
`,
response: {
kind: "fill_in_the_blank",
content:
`
\`\`\`cpp
template <typename T>; // Note: T must support ==
class Replacer {
private:
const T &target;
const T &replacement;

public:
Replacer(_________________________________BLANK_________________________________)
: _________________________________BLANK_________________________________ { }

// Function call operator
_______BLANK_______ operator()(_______________BLANK_______________ item) const {
[[BOX___________________________________________________________


]]
}
};
\`\`\`
`,
sample_solution: [
"const T &target_in, const T &replacement_in",
"target(target_in), replacement(replacement_in)",
"void",
"T &",
"if (item == target) {\n item = replacement;\n}"
]
}
};

Blanks and Boxes

To specify a blank, use a pattern like ____BLANK____. Blanks are rendered as an HTML text input. The number of underscores controls the size and maxlength of that text input - students may not enter more content than will "fit" in the box. A blank may occur in the middle of a line or on its own.

To specify a box, use a pattern like [[____BOX____\n\n\n]]. Boxes are rendered as an HTML textarea input. The number of underscores controls the width of the textarea, and the number of newlines controls the height. There must be at least one newline (otherwise use a blank). If there are no underscores, the box will take up the full available width. A box may occur in the middle of a line or on its own. Those are real newlines, though if you're writing in code you'd use the escape sequence \n. Or, if you use backtick-quoted multi-line string literals, those can just contain natural newlines.

Markdown Formatting

The content specification for an FITB response element may contain markdown formatting. In particular, blank/box placeholders may be included inside code boxes.

FITB Submissions

A submission for an FITB response is an array of strings that specify the content submitted for each blank/box. See FITBSubmission for details.

Type declaration

  • kind: "fill_in_the_blank"

    The discriminant "fill_in_the_blank" is used to distinguish FITB specifications.

  • content: string

    The content specification of the FITB response. May include markdown and placeholders for blanks/boxes.

  • Optional sample_solution?: ViableSubmission<FITBSubmission>

    A sample solution, which may not be blank or invalid.

  • Optional default_grader?: GraderSpecificationFor<"fill_in_the_blank">

    A default grader, used to evaluate submissions for this response.

FITBSubmission: readonly string[] | typeof BLANK_SUBMISSION

A submission for an FITB response is an array of strings that specify the content submitted for each blank. The submission may also be the symbol BLANK_SUBMISSION.

Variables

FITB_HANDLER: ResponseHandler<"fill_in_the_blank"> = ...

Generated using TypeDoc