You are viewing this question as it will appear in the manual grading interface. Return to the normal view when you are done.

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.

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

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 Mariana
headshot of Matt

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

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

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.

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

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.

France
United States
Mexico
  1. Paris
  2. Washington, D.C.
  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).

Mexico
France
United States
  1. Mexico City
  2. Washington, D.C.
  3. Paris

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$
$e$
$\phi$
  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(filter(lambda item: item > 0, lst))
1
list(itertools.product(lst1, lst2))
1
list(map(lambda item: item * 2, lst))
  1. 1
    [(a, b) for a in lst1 for b in lst2]
    
  2. 1
    [item for item in lst if item > 0]
    
  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.

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

Correct answer

b. Mexico City
Mexico
f. Ottawa
Canada
d. Washington, D.C.
United States
c. Paris
France
Mariana
headshot of Mariana
Matt
headshot of Matt
g. Paris
France
b. Ottawa
Canada
c. Mexico City
Mexico
e. Washington, D.C.
United States
e. Washington, D.C.
United States
d. Ottawa
Canada
c. Mexico City
Mexico
a. Paris
France
b. Washington, D.C.
United States
c. None of the above
Mexico
1. Mexico City
Mexico
3. Paris
France
2. Washington, D.C.
United States
b. $\sqrt{-1}$
$i$
c. $ \displaystyle \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^{n}$
$e$
a. $\cfrac{1+\sqrt{5}}{2}$
$\phi$
b.
1
[item for item in lst if item > 0]
1
list(filter(lambda item: item > 0, lst))
a.
1
[(a, b) for a in lst1 for b in lst2]
1
list(itertools.product(lst1, lst2))
c.
1
[item * 2 for item in lst]
1
list(map(lambda item: item * 2, lst))
b. The theory of relativity
Which theory revolutionized our understanding of space, time, and gravity?
d. Artificial intelligence
What field of computer science encompasses machine learning, natural language processing, and computer vision?
g. Genetic engineering
What biotechnology technique offers potential in treating genetic disorders and enhancing crop yields?
e. Quantum mechanics
What is a branch of physics that challenges classical intuition and underpins technologies like quantum computing?

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 20:43:37 (CDT)
Duration:
0s
Show/Hide answer
{
  "ex1": [
    1,
    5,
    3,
    2
  ],
  "ex2": [
    0,
    1
  ],
  "ex3": [
    6,
    1,
    2,
    4
  ],
  "ex4": [
    4,
    3,
    2
  ],
  "ex5": [
    0,
    1,
    2
  ],
  "ex6": [
    0,
    2,
    1
  ],
  "ex7": [
    1,
    2,
    0
  ],
  "ex8": [
    1,
    0,
    2
  ],
  "ex9": [
    1,
    3,
    6,
    4
  ]
}
History
dec frac
rad deg