Element pl-matching: Match statements with options

This question illustrates different use cases for the pl-matching element.

Example 1: Match each nation with its capital city. In this example, the options are implicitly created by each statement's match attribute. Only distractor options need to be added manually. All statements and options are displayed by default.

United States
France
Canada
Mexico
  1. Paris
  2. Toronto
  3. Mexico City
  4. Tijuana
  5. New York City
  6. Ottawa
  7. Washington, D.C.

Example 2: Setting counter-type="full-text" will hide the column of options. The dropdown list next to each statement will contain the inner text of each option, rather than a counter.

headshot of Matt
headshot of Mariana

Example 3: blank="false" removes the blank first entry in the dropdown list, setting the default selection to the first option.

France
United States
Canada
Mexico
  1. New York City
  2. Mexico City
  3. Tijuana
  4. Toronto
  5. Ottawa
  6. Paris
  7. Washington, D.C.

Example 4: number-statements and number-options determine how many statements and options are shown. Statements are sampled at random. The options will always include each correct match for the sampled statements, plus random distractors.

Mexico
France
United States
  1. Washington, D.C.
  2. Paris
  3. Tijuana
  4. New York City
  5. Mexico City

Example 5: if number-options is smaller than the amount of options required to match the sampled statements, None of the Above will be added.

Mexico
Canada
France
  1. Mexico City
  2. Paris
  3. None of the above

Example 6: the counter-type attribute indicates how options are identified. It can be set to lower-alpha (a, b, c, ...), upper-alpha (A, B, C, ...), or decimal (1, 2, 3).

Canada
United States
Mexico
  1. Ottawa
  2. Mexico City
  3. Washington, D.C.

Example 7: options can be added manually if they require more than simple text (e.g., images, equations or formatting). In that case, the name attribute of each pl-option must match the corresponding match attribute of the appropriate pl-statement.

$i$
$\phi$
$e$
  1. $\cfrac{1+\sqrt{5}}{2}$
  2. $\sqrt{-1}$
  3. $ \displaystyle \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^{n}$

Example 8: HTML formatting and other PrairieLearn elements can be used inside statements and options. If used in options, an explicit pl-option must be defined with a name attribute matching the corresponding match attribute of the appropriate pl-statement.

1
list(map(lambda item: item * 2, lst))
1
list(filter(lambda item: item > 0, lst))
1
list(itertools.product(lst1, lst2))
  1. 1
    [item for item in lst if item > 0]
    
  2. 1
    [(a, b) for a in lst1 for b in lst2]
    
  3. 1
    [item * 2 for item in lst]
    

Example 9: This example uses the options-placement="bottom" argument. This is useful for questions with long statements and options, which may wrap over multiple lines or cause formatting issues in the default "right" placement.

What biotechnology technique offers potential in treating genetic disorders and enhancing crop yields?
What field of computer science encompasses machine learning, natural language processing, and computer vision?
Which theory revolutionized our understanding of space, time, and gravity?
What is a branch of physics that challenges classical intuition and underpins technologies like quantum computing?
  1. The theory of relativity
  2. Traditional computing
  3. Quantum mechanics
  4. Artificial intelligence
  5. Data science
  6. Genetic engineering
  7. OPERA faster-than-light neutrino anomaly
  8. String theory

Correct answer

Student view placeholder

In student views this area is used for assessment and score info.
Tools

Staff information

Question

Title:
Element pl-matching: Match statements with options

Variant

Started at:
2026-08-04 22:49:12 (CDT)
Duration:
0s
Show/Hide answer
{
  "ex1": [
    6,
    0,
    5,
    2
  ],
  "ex2": [
    1,
    0
  ],
  "ex3": [
    5,
    6,
    4,
    1
  ],
  "ex4": [
    4,
    1,
    0
  ],
  "ex5": [
    0,
    2,
    1
  ],
  "ex6": [
    0,
    2,
    1
  ],
  "ex7": [
    1,
    0,
    2
  ],
  "ex8": [
    2,
    0,
    1
  ],
  "ex9": [
    5,
    3,
    0,
    2
  ]
}
History
dec frac
rad deg