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

Examples from element documentation

Examples below are taken from the documentation page for PrairieLearn Elements in question.html .


Submission Elements


pl-multiple-choice
Example of a multiple choice element.

Correct Input: negative

pl-checkbox
Example of a multiple selection element.

Correct Input: A-B, B-C, and D-E.

Checkbox options
Select all possible options that apply.
pl-number-input
Example of a fill in the blank element that accepts numeric values.

Correct Input: 1.339713339197286

$x =$

Correct Input: 1.34

$x =$
pl-integer-input
Example of a fill in the blank element that accepts integer values.

Correct Input: 42

$y =$
pl-symbolic-input
Example of a fill in the blank element that accepts mathematical expression values.

Correct Input: x + y + 1

$z =$
pl-string-input
Example of a fill in the blank element that accepts string values.

Correct Input: Learn

Prairie
pl-matrix-component-input
Example of a fill in the blank element that provides input fields for each entry of a matrix.

Correct Input:

  • 1 in location 1x1
  • 2 in location 1x2
  • 3 in location 2x1
  • 4 in location 2x2
pl-matrix-input
Example of a fill in the blank element that provides an input field for supplying the underlying code required to create the matrix.

Correct Input:

  • MATLAB: [1 2; 3 4]
  • Python: [[1, 2], [3, 4]]
pl-file-editor
Example of an inbrowser code file editor submission element.
fib.py
pl-file-upload
Example of a file submission element.

Correct Input: foo.py, bar.c, and filename with, comma.txt

Files

Decorative Elements


pl-code

Example of embedding code blocks with syntax highlighting.

1
2
def square(x):
    return x * x
pl-figure

Example of displaying an image in a question.

pl-file-download

Example of providing a file download option.

data.txt
pl-variable-output

Example of displaying matrices using a code export.

1
2
C = [5.000 6.000; 7.000 8.000];
D = [-1.000 4.000; 3.000 2.000];
1
2
Cm = {{5, 6}, {7, 8}};
Dm = {{-1,  4}, { 3,  2}};
1
2
3
4
import numpy as np

C = np.array([[5, 6], [7, 8]])
D = np.array([[-1,  4], [ 3,  2]])
1
2
C = matrix(c(5, 6, 7, 8), nrow = 2, ncol = 2, byrow = TRUE)
D = matrix(c(-1,  4,  3,  2), nrow = 2, ncol = 2, byrow = TRUE)
1
2
3
4
from sympy import *

C = Matrix([[5, 6], [7, 8]])
D = Matrix([[-1,  4], [ 3,  2]])
pl-matrix-latex

Example of displaying a matrix using latex.

$C = \begin{bmatrix} 5 & 6\\ 7 & 8\\\end{bmatrix}$
pl-graph

Example of a graphviz visualization.

G A A B B A->B

Example of a graphviz visualization.

A A A->A 0.28 B B A->B 0.09 C C A->C 0.63 B->A 0.40 B->B 0.23 B->C 0.37 C->A 0.35 C->B 0.45 C->C 0.20
pl-python-variable

Displaying contents of a Python dictionary.

1
{'a': 1, 'b': 2, 'c': 3}
pl-dataframe

Displaying contents of a Pandas DataFrame from Python.

  col1 col2
0 1 3
1 2 4

2 rows x 2 columns

pl-overlay

What is the length of the hypotenuse?

$$3$$
$$3$$

Correct answer


Submission Elements


pl-multiple-choice
  • (a) negative
pl-checkbox
  • (b) A-B
  • (d) D-E
  • (f) B-C
pl-number-input
$x =$ 1.3397133392
$x =$ 1.3
pl-integer-input
$y =$ 42
pl-symbolic-input
$z =$ $x + y + 1$
pl-string-input
Prairie Learn
pl-matrix-component-input
$A=$ $\begin{bmatrix} 1 & 2\\ 3 & 4\\\end{bmatrix}$
pl-matrix-input

$B=$ [1 2; 3 4]

$B=$ [[1, 2], [3, 4]]

pl-file-editor
pl-file-upload

Decorative Elements


pl-code
1
2
def square(x):
    return x * x
pl-figure
pl-file-download
pl-variable-output
1
2
C = [5.000 6.000; 7.000 8.000];
D = [-1.000 4.000; 3.000 2.000];
1
2
Cm = {{5, 6}, {7, 8}};
Dm = {{-1,  4}, { 3,  2}};
1
2
3
4
import numpy as np

C = np.array([[5, 6], [7, 8]])
D = np.array([[-1,  4], [ 3,  2]])
1
2
C = matrix(c(5, 6, 7, 8), nrow = 2, ncol = 2, byrow = TRUE)
D = matrix(c(-1,  4,  3,  2), nrow = 2, ncol = 2, byrow = TRUE)
1
2
3
4
from sympy import *

C = Matrix([[5, 6], [7, 8]])
D = Matrix([[-1,  4], [ 3,  2]])
pl-matrix-latex
$C = \begin{bmatrix} 5 & 6\\ 7 & 8\\\end{bmatrix}$
pl-graph
G A A B B A->B
A A A->A 0.28 B B A->B 0.09 C C A->C 0.63 B->A 0.40 B->B 0.23 B->C 0.37 C->A 0.35 C->B 0.45 C->C 0.20
pl-python-variable
1
{'a': 1, 'b': 2, 'c': 3}
pl-dataframe
  col1 col2
0 1 3
1 2 4

2 rows x 2 columns

pl-overlay

What is the length of the hypotenuse?

$$3$$
$$3$$
4.24264068712

Student view placeholder

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

Staff information

Question

Title:
Examples from element documentation

Variant

Started at:
2026-08-04 23:54:51 (CDT)
Duration:
0s
Show/Hide answer
{
  "c": 4.242640687119285,
  "acc": {
    "key": "a",
    "html": "negative",
    "score": 1,
    "feedback": null
  },
  "vpos": [
    {
      "key": "b",
      "html": "A-B",
      "feedback": null
    },
    {
      "key": "d",
      "html": "D-E",
      "feedback": null
    },
    {
      "key": "f",
      "html": "B-C",
      "feedback": null
    }
  ],
  "ans_sig": 1.34,
  "matrixA": {
    "_type": "ndarray",
    "_dtype": "int64",
    "_value": [
      [
        1,
        2
      ],
      [
        3,
        4
      ]
    ]
  },
  "matrixB": {
    "_type": "ndarray",
    "_dtype": "int64",
    "_value": [
      [
        1,
        2
      ],
      [
        3,
        4
      ]
    ]
  },
  "ans_rtol": 1.339713339197286,
  "int_value": 42,
  "string_value": "Learn",
  "symbolic_math": {
    "_type": "sympy",
    "_value": "x + y + 1",
    "_variables": [
      "x",
      "y"
    ],
    "_assumptions": {
      "x": {
        "commutative": true
      },
      "y": {
        "commutative": true
      }
    },
    "_custom_functions": []
  }
}
History
dec frac
rad deg