DEVELOPERS / ACTIVITIES

Technical reference for quizzes and games

Schemas, scoring and Player integration, separate from the teacher authoring guide.

Choose an activity

Common activity contract

Data contract, code examples and Player integration for this activity. The visual authoring walkthrough is in the separate teacher guide.

Technical gap markers can be written as {{id}} or ___.

The same questionnaire, different experiences

Questions are saved as application/vnd.p2lrn.questionnaire+json. The chosen presentation does not create another copy of the content: it tells the Player how to display that questionnaire.

The presentation should never miss questions.

If the entire questionnaire cannot be faithfully represented mechanically, that presentation is considered incompatible. P2LRN does not eliminate questions or invent answers to make it fit.

Status and score

All submissions update the same questionnaire status. To hear punctuation and completion use Events; To persist them on a platform, configure Host Adapter.

Test before integrating

The viewer allows you to open example packages and change presentation when the content is compatible.

Create and verify your own exercises in Studio. Native test courses are no longer published.

Teacher guide for this activity

Standard quiz

Data contract, code examples and Player integration for this activity. The visual authoring walkthrough is in the separate teacher guide.

Content requirements

  • Supports native quiz question types.
  • You can use embedded solution remediation or platform-managed remediation.
  • The presentation can show one question at a time or all at once.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Quick check",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "presentation": {
    "questionMode": "one-at-a-time",
    "shuffleQuestions": false,
    "showFeedback": "after-submit"
  },
  "questions": [
    {
      "id": "q1",
      "type": "single-choice",
      "prompt": "Capital of Portugal",
      "points": 1,
      "choices": [
        {
          "id": "a",
          "text": "Lisbon"
        },
        {
          "id": "b",
          "text": "Madrid"
        }
      ],
      "solution": {
        "choiceIds": [
          "a"
        ]
      }
    }
  ]
}

How to read the example

The example contains a single choice question. choices defines the options and solution.choiceIds Identify the correct answer.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "Standard questionnaire" \
  --renderer "https://p2lrn.org/renderer/questionnaire/standard"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/standard

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher guide for this activity

Memory

Data contract, code examples and Player integration for this activity. The visual authoring walkthrough is in the separate teacher guide.

Content requirements

  • In Studio, the Memory preset is edited as a question type Matching.
  • The activity needs embedded solutions and at least three pairs.
  • Clues and answers should not be repeated in a way that makes a pair ambiguous.
Additional Player support.

The Player can also convert other question types into pairs when all relationships can be deduced unambiguously. Studio uses Relate because it is the clearest visual format to create this game.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Match countries and capitals",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "matching",
      "prompt": "Match each country with its capital",
      "points": 3,
      "left": [
        {
          "id": "l1",
          "text": "Spain"
        },
        {
          "id": "l2",
          "text": "France"
        },
        {
          "id": "l3",
          "text": "Italy"
        }
      ],
      "right": [
        {
          "id": "r1",
          "text": "Madrid"
        },
        {
          "id": "r2",
          "text": "Paris"
        },
        {
          "id": "r3",
          "text": "Rome"
        }
      ],
      "solution": {
        "pairs": [
          {
            "left": "l1",
            "right": "r1"
          },
          {
            "left": "l2",
            "right": "r2"
          },
          {
            "left": "l3",
            "right": "r3"
          }
        ]
      }
    }
  ]
}

How to read the example

The example uses a question matching with three elements on each side. solution.pairs declares the three relationships and allows the six cards to be constructed.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "Memory" \
  --renderer "https://p2lrn.org/renderer/questionnaire/memory"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/memory

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher guide for this activity

Matching

Data contract, code examples and Player integration for this activity. The visual authoring walkthrough is in the separate teacher guide.

Content requirements

  • In Studio it is created as a question of type Matching.
  • The activity requires embedded solutions and at least three complete pairs.
  • The relationships must be distinguishable: duplicate texts that make the correspondence ambiguous invalidate this presentation.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Match countries and capitals",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "matching",
      "prompt": "Match each country with its capital",
      "points": 3,
      "left": [
        {
          "id": "l1",
          "text": "Spain"
        },
        {
          "id": "l2",
          "text": "France"
        },
        {
          "id": "l3",
          "text": "Italy"
        }
      ],
      "right": [
        {
          "id": "r1",
          "text": "Madrid"
        },
        {
          "id": "r2",
          "text": "Paris"
        },
        {
          "id": "r3",
          "text": "Rome"
        }
      ],
      "solution": {
        "pairs": [
          {
            "left": "l1",
            "right": "r1"
          },
          {
            "left": "l2",
            "right": "r2"
          },
          {
            "left": "l3",
            "right": "r3"
          }
        ]
      }
    }
  ]
}

How to read the example

left and right define the two columns. solution.pairs match the correct identifiers.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "Matching" \
  --renderer "https://p2lrn.org/renderer/questionnaire/matching"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/matching

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher guide for this activity

Ordering

Data contract, code examples and Player integration for this activity. The visual authoring walkthrough is in the separate teacher guide.

Content requirements

  • In Studio it is created as a question of type Ordering.
  • Each sequence must have at least three elements.
  • solution.order must contain all identifiers exactly once.
  • The activity requires embedded solutions.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Order the water cycle",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "ordering",
      "prompt": "Order the stages",
      "points": 3,
      "items": [
        {
          "id": "i1",
          "text": "Evaporation"
        },
        {
          "id": "i2",
          "text": "Condensation"
        },
        {
          "id": "i3",
          "text": "Precipitation"
        }
      ],
      "solution": {
        "order": [
          "i1",
          "i2",
          "i3"
        ]
      }
    }
  ]
}

How to read the example

items contains the visible elements. solution.order declares the correct sequence using its identifiers.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "Ordering" \
  --renderer "https://p2lrn.org/renderer/questionnaire/ordering"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/ordering

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher guide for this activity

Classification

Technical requirements, data examples and renderer integration. Course authors use the separate Studio guide.

Content requirements

  • In Studio it is created as a question of type Classification.
  • Each question needs at least two objects and two categories.
  • The solution must map all objects to a valid category.
  • The activity requires embedded solutions.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Classify living things",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "classification",
      "prompt": "Classify each item",
      "points": 2,
      "items": [
        {
          "id": "dog",
          "text": "Dog"
        },
        {
          "id": "oak",
          "text": "Oak"
        }
      ],
      "categories": [
        {
          "id": "animal",
          "text": "Animal"
        },
        {
          "id": "plant",
          "text": "Plant"
        }
      ],
      "solution": {
        "assignments": [
          {
            "item": "dog",
            "category": "animal"
          },
          {
            "item": "oak",
            "category": "plant"
          }
        ]
      }
    }
  ]
}

How to read the example

items are the objects, categories are the destinations and solution.assignments contains one assignment per object.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "Classification" \
  --renderer "https://p2lrn.org/renderer/questionnaire/classification"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/classification

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher authoring guide

True or false

Technical requirements, data examples and renderer integration. Course authors use the separate Studio guide.

Content requirements

  • In Studio it is created with questions of type True / false.
  • At least two questions are needed.
  • Each question must have exactly two unambiguous options and one embedded solution.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "True or false",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "true-false",
      "prompt": "Earth orbits the Sun",
      "points": 1,
      "choices": [
        {
          "id": "t1",
          "text": "True"
        },
        {
          "id": "f1",
          "text": "False"
        }
      ],
      "solution": {
        "choiceIds": [
          "t1"
        ]
      }
    },
    {
      "id": "q2",
      "type": "true-false",
      "prompt": "Mars is a star",
      "points": 1,
      "choices": [
        {
          "id": "t2",
          "text": "True"
        },
        {
          "id": "f2",
          "text": "False"
        }
      ],
      "solution": {
        "choiceIds": [
          "f2"
        ]
      }
    }
  ]
}

How to read the example

Each question has two choices. The solution points out which of your identifiers is correct using solution.choiceIds.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "True / False" \
  --renderer "https://p2lrn.org/renderer/questionnaire/true-false"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/true-false

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher authoring guide

Crossword

Technical requirements, data examples and renderer integration. Course authors use the separate Studio guide.

Content requirements

  • In Studio it is edited with questions of type Text answer.
  • You need between 4 and 80 responses.
  • Each standardized response must be between 3 and 17 characters and a non-empty clue.
  • All words must form a single connected crossword puzzle. If there is no complete provision, the submission is rejected.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Crossword",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "text",
      "prompt": "Place where people live",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "HOME"
        ]
      }
    },
    {
      "id": "q2",
      "type": "text",
      "prompt": "Amphibian that jumps",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "TOAD"
        ]
      }
    },
    {
      "id": "q3",
      "type": "text",
      "prompt": "Water bird",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "DUCK"
        ]
      }
    },
    {
      "id": "q4",
      "type": "text",
      "prompt": "Container with a handle",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "CUP"
        ]
      }
    }
  ]
}

How to read the example

The four questions provide the clues and the words HOUSE, TOAD, DUCK and CUP. They are answers compatible with the construction of the connected board.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "Crossword" \
  --renderer "https://p2lrn.org/renderer/questionnaire/crossword"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/crossword

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher authoring guide

Word wheel

Technical requirements, data examples and renderer integration. Course authors use the separate Studio guide.

Content requirements

  • In Studio it is edited with questions of type Text answer.
  • Every question needs exactly one usable textual answer.
  • The response must have at least two standard characters.
  • Each challenge needs a different letter that is present in its own answer. P2LRN does not invent answers or eliminate questions.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Vocabulary Word Wheel",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "text",
      "prompt": "Home",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "HOME"
        ]
      }
    },
    {
      "id": "q2",
      "type": "text",
      "prompt": "Domestic animal that barks",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "DOG"
        ]
      }
    },
    {
      "id": "q3",
      "type": "text",
      "prompt": "Furniture used for eating or working",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "TABLE"
        ]
      }
    },
    {
      "id": "q4",
      "type": "text",
      "prompt": "Earth's natural satellite",
      "points": 1,
      "solution": {
        "acceptedAnswers": [
          "MOON"
        ]
      }
    }
  ]
}

How to read the example

HOUSE, DOG, TABLE and MOON allow you to assign, for example, C, P, M and L. The Player calculates this association from the real answers; This block is a valid questionnaire, not a list of comments.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "Word Wheel" \
  --renderer "https://p2lrn.org/renderer/questionnaire/rosco"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/rosco

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher authoring guide

3D game

Technical requirements, data examples and renderer integration. Course authors use the separate Studio guide.

Content requirements

  • The Studio preset creates a question of type Ordering with complete solution.
  • The activity requires embedded solutions and distinguishable texts.
  • The Player can also reproduce 3D activities of type Matching and Classification when they are generated by Toolkit and fulfill their full contracts.
  • If the physics cannot be initiated, the experience preserves a functional alternative.

Valid data example

This example shows the data used by the activity for CLI authoring. In Studio, configure the corresponding content using the visual editor.

quiz.json
{
  "schema": "https://p2lrn.org/schema/native-questionnaire/0.4.0",
  "version": "0.4.0",
  "title": "Order the water cycle",
  "language": "en",
  "grading": {
    "mode": "embedded-key"
  },
  "questions": [
    {
      "id": "q1",
      "type": "ordering",
      "prompt": "Order the stages",
      "points": 3,
      "items": [
        {
          "id": "i1",
          "text": "Evaporation"
        },
        {
          "id": "i2",
          "text": "Condensation"
        },
        {
          "id": "i3",
          "text": "Precipitation"
        }
      ],
      "solution": {
        "order": [
          "i1",
          "i2",
          "i3"
        ]
      }
    }
  ]
}

How to read the example

The example uses sort because it is the path that Studio currently offers to create a 3D Game. The three elements and solution.order produce a complete test.

Create by CLI — advanced alternative

Use these commands for code-based authoring with Toolkit installed via npm. The quiz.json file must contain a valid questionnaire like the example above.

Terminal
p2lrn-create add-questionnaire ./workspace ./quiz.json \
  --key quiz \
  --title "3D Game" \
  --renderer "https://p2lrn.org/renderer/questionnaire/3d-order-match"

p2lrn-create build ./workspace ./course.p2lrn --strict-profiles

--renderer Select the preferred presentation. It does not create a second copy of the questions: the content remains the native questionnaire.

Technical presentation identifier

Typically Studio sets this up for you. You only need this identifier when you select presentation from code, CLI, or the viewer.

Technical identifier

https://p2lrn.org/renderer/questionnaire/3d-order-match

Profile

https://p2lrn.org/profile/native-questionnaire

Content type

application/vnd.p2lrn.questionnaire+json

Teacher authoring guide