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.

Canada
Mexico
France
United States
  1. Toronto
  2. Paris
  3. Washington, D.C.
  4. Tijuana
  5. New York City
  6. Ottawa
  7. Mexico 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 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.

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

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.

France
Mexico
Canada
  1. Ottawa
  2. Paris
  3. Mexico City
  4. Toronto
  5. Tijuana

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
Canada
Mexico
  1. Mexico City
  2. Ottawa
  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
France
  1. Paris
  2. Washington, D.C.
  3. Ottawa

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.

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

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
    [item * 2 for item in lst]
    
  2. 1
    [(a, b) for a in lst1 for b in lst2]
    
  3. 1
    [item for item in lst if item > 0]
    

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

Correct answer

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

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