Creating Fill-in-the-Blank Questions

Build auto-graded fill-in-the-blank questions with fixed answers like names, dates, and years

Fill-in-the-Blank Overview

Fill-in-the-blank questions are built using the General Question type. The learner sees a prompt with a blank and types their answer into a single-line input. Answers are auto-graded against a Python expression that computes the correct value.

You can use this for fixed-answer questions (names, years, dates, vocabulary) or dynamic questions that cycle through a pool of items (e.g., different countries, different historical events).

Fill-in-the-blank questions are created using the General question type — the same type used for math and computation questions. The key difference is that your answers are fixed strings rather than computed expressions.

Fixed Single-Question Approach

Use this approach when the question is always the same — one prompt, one answer. No variables are needed.

1

Select “General Question” as the Question Type

When creating a new question in your topic or course, select General Question (with variables and expressions) from the question type options.

The General Question type is the only type that supports auto-graded text answers with expression-based evaluation — which is what fill-in-the-blank needs.
Select General Question type from the question type options
Step 1: Select "General Question" as the question type
2

Skip Variables (Not Needed)

For a fixed question with a single fixed answer, you do not need any variables. Leave the Variables section empty.

3

Write the Prompt

Write your question as plain text. Use “...” or “______” to indicate the blank. The learner will see a text input field below your prompt.

Capital of France is ...
4

Set the Answer as a String Literal

In the Answers section, enter the correct answer as a Python string literal wrapped in quotes. The system evaluates this expression and compares it against the learner's input.

'Paris'

The learner types Paris → the system checks if it matches 'Paris' (case-sensitive).

Fill-in-the-blank question form showing prompt and answer sections
Step 3-4: Write the prompt and set the answer expression

Variable Pool Approach (Dynamic Cycling)

Use this approach when you want the question to randomly pick from a pool of items each time — giving the learner limitless practice variations.

1

Define a Variable with choice()

Create a variable that randomly picks from a list of items using the choice() function.

Variable Name: country

Data Type: String

Generator Expression:

choice(['France', 'Japan', 'Brazil', 'India', 'Germany'])
2

Write the Prompt with the Variable

Use {country} in your prompt where the variable value should appear.

What is the capital of {country}?

The learner will see: "What is the capital of Brazil?" (or whichever country was picked).

3

Set the Answer Using a Dictionary Lookup

Use a Python dictionary to map each possible variable value to its corresponding answer. The expression evaluates in the variable context, so country is already defined.

{'France': 'Paris', 'Japan': 'Tokyo', 'Brazil': 'Brasília', 'India': 'New Delhi', 'Germany': 'Berlin'}[country]

When country = 'Japan' is generated, the answer evaluates to 'Tokyo'.

Variables section showing a choice() expression for cycling countries
Variable Pool approach: define variables with choice() and set answers with dictionary lookup

Examples

Example 1: Fixed Answer — Capital City

Single question, always the same. No variables needed.

Prompt: Capital of France is ...

Answer expression: 'Paris'

Example 2: Fixed Answer — Historical Year

Ask for a year. Answer is a string literal.

Prompt: The French Revolution began in the year ...

Answer expression: '1789'

Example 3: Dynamic Pool — World Capitals

Cycles through different countries each attempt.

Variables:

country = choice(['France', 'Japan', 'Brazil', 'India', 'Germany'])

Prompt: What is the capital of {country}?

Answer:

{'France': 'Paris', 'Japan': 'Tokyo', 'Brazil': 'Brasília', 'India': 'New Delhi', 'Germany': 'Berlin'}[country]

Example 4: Dynamic Pool — Historical Events

Ask about different events each attempt.

Variables:

event = choice(['French Revolution', 'American Civil War', 'World War I', 'Moon Landing'])

Prompt: The {event} occurred in the year ...

Answer:

{'French Revolution': '1789', 'American Civil War': '1861', 'World War I': '1914', 'Moon Landing': '1969'}[event]

Example 5: Dynamic Pool — Vocabulary Definitions

Test vocabulary knowledge with a cycling word bank.

Variables:

word = choice(['Photosynthesis', 'Mitosis', 'Osmosis', 'Evaporation'])

Prompt: Define the term: {word}

Answer:

{'Photosynthesis': 'process by which plants convert light to energy', 'Mitosis': 'cell division producing two identical cells', 'Osmosis': 'movement of water through a membrane', 'Evaporation': 'liquid turning into vapor'}[word]
Long text answers are tricky to auto-grade with General questions. For essays and detailed explanations, use a Long Answer question with a reference answer for AI grading instead.

Important Notes

Note Details
String literals require quotes 'Paris' (with quotes) is a Python string. Paris (without quotes) will fail because it tries to reference a variable named Paris.
Case-sensitive matching The learner's answer is compared exactly against the evaluated expression. 'Paris' will not match 'paris'. Consider using .lower() if case-insensitive matching is desired: 'Paris'.lower() (then the learner must also match the lowercase form).
Whitespace is stripped The system removes spaces from the evaluated answer before comparing. 'New York' becomes 'NewYork', so the learner can type New York or NewYork — both will match.
Test before publishing Always use the Run button (available on course-level questions) or visit the learner practice page to test that your expression evaluates correctly and matching works as expected.

Explore Other Question Types

Fill-in-the-blank is built on General Questions. See how other types work:

Questions about creating fill-in-the-blank questions?

We're here to help

Contact Us