Author questions: a teacher's guide
This guide walks teachers and coordinators through creating, checking, publishing, and reusing questions in iCode. It covers the question types currently offered in exam and bank question grids, plus the smaller set available in practice exercises.
Where to create questions
You can author questions in three places:
- Exam: open the course, choose Exams, create or open an exam, then open its Questions grid.
- Practice exercise: turn on Edit Mode, add or open an Exercise resource in a section, then open its Questions grid. Exercises support only the auto-graded question types listed below; Text and File submit are not offered there.
- Question Bank: open the course Question Bank to create reusable questions. Bank questions can later be imported into exams or exercises, subject to the exercise type limits.
In the grid, choose Create Question and select a type (Text appears as Long Answer Question). The exact fields depend on the type. Preview the question before publishing it. For exam and exercise questions, check the question's own Published state as well as the parent exam, exercise, section, and resource state. Students cannot see unpublished content.
A reliable authoring workflow
- Write the learning objective first. Decide what evidence would demonstrate the skill, then choose the simplest suitable question type.
- Write a self-contained question body. State the task, required input or response format, constraints, and any assumptions. Put long reference material in the question body, not only in a hint.
- Set the mark and tags. Add a mark, relevant CLOs, keywords, and difficulty level where those fields are available. CLO tags on exercise questions help organize and transfer questions; exercise marks do not contribute to course Grades or CLO weights.
- Enter the answer key. For objective questions, identify the correct choice, blank answers, or matching pairs. For Text and File submit, write a grading rubric because those responses are manually graded.
- Preview as a student. Check layout, directions, choices, blank order, file requirements, and code editor behavior.
- Publish deliberately. New material is commonly unpublished. Confirm both the question and its containing exam/exercise/section are published when you intend students to see it.
- For code, run every case against the Key Solution. Check that the input format matches the program, outputs are deterministic, and the non-sample weights add to 100%.
Question types and worked examples
| Type | Best for | Automatic scoring | Available in exercises |
|---|---|---|---|
| Code | Programs, scripts, web pages, and algorithmic work | Weighted test cases when Auto-grading is enabled | Yes |
| Multiple choice | One best/correct answer | Exact key match | Yes |
| True/False | One claim with a binary answer | Exact key match | Yes |
| Multi-select | Several correct options | Partial credit, with a penalty for extra selections | Yes |
| Fill in the blanks | A sequence of short, objectively checkable answers | Proportional credit per blank | Yes |
| Matching | Pairing related items | Proportional credit per pair | Yes |
| Text | Explanations, proofs, or other open responses | Manual grading | No |
| File submit | Work that must be uploaded as a file | Manual grading | No |
Multiple choice
Use this when exactly one option is correct. Enter the question body and answer choices, mark the correct option as the key, and preview the student view. If the question’s Shuffle switch is on, iCode changes the displayed choice order for each student without changing which choice is correct.
Example
- Question body: Which expression evaluates to
14whenxis4? - Choices:
x + 10;x * 3;x + 8;x * 4 - Key:
x + 10 - Mark: 2
Keep options parallel in wording and avoid giving away the key through length or grammar.
True/False
Use a statement that can be judged as one unambiguous proposition. Enter the statement and set its key to True or False.
Example
- Question body: In Python, list indexing starts at zero.
- Key: True
- Mark: 1
Avoid combining multiple claims: if one clause is false and another is true, students may reasonably interpret the item differently.
Multi-select
Use this when more than one choice may be correct. Select every correct option in the key. Students receive partial credit, and selecting extra incorrect options is penalized.
Example
- Question body: Select every value that is an even integer.
- Choices:
-4;3;0;2.5 - Key:
-4and0 - Mark: 4
Tell students whether to select all that apply. Do not rely on a particular partial-credit formula unless your institution has separately documented it.
Fill in the blanks
Use short answers with a clear expected form. Put the blanks in the question body in the order students should answer them, then enter the corresponding key answers in that same order. Each blank contributes a share of the question mark.
Example
- Question body: A loop that checks its condition before each iteration is a
[blank 1]loop. A loop that runs its body at least once is a[blank 2]loop. - Answers in order:
pre-test;post-test - Mark: 2
Preview the item to confirm the number and order of blanks. State accepted terminology or spelling in the question body when more than one answer could be valid.
Matching
Use this when students pair items from two related sets. Enter each prompt and its corresponding correct match, then verify every pair in Preview. Each pair contributes a share of the total mark.
Example
| Language | Correct characteristic |
|---|---|
| Python | Indentation defines blocks |
| Java | Runs on the Java Virtual Machine |
| C | Commonly compiled to native machine code |
Avoid ambiguous pairs; each prompt should have one defensible match. If the interface allows distractors, make clear that not every option must be used.
Text (manual grading)
Use Text for explanations, design justifications, proofs, or other responses that need human judgment. State the expected scope and any length or evidence requirements. Add a rubric before publishing; the response remains manual until a grader assigns a mark.
Example
- Question body: Explain why binary search requires sorted input. Give a two- or three-sentence explanation and identify what fails if the input is not sorted.
- Mark: 4
- Suggested rubric: 2 points for explaining the ordered search space; 1 for describing how a midpoint comparison eliminates half; 1 for a correct consequence of unsorted input.
The rubric is guidance for graders; it is not an automatic scoring key.
File submit (manual grading)
Use File submit when the evidence is an uploaded document, image, archive, or other permitted file. State the required deliverable and file format in the question body. In the question, choose whether students may submit text, files, or both (Allow Submit Text, Allow Submit File), whether Allow Multiple Files is on, and which file types are accepted. Grade the uploaded work manually on Results.
Example
- Question body: Submit one PDF containing your state diagram and a short explanation of each transition. Use the filename
state-machine.pdf. - Mark: 10
- Suggested rubric: correctness of states (4), transitions (4), clarity of explanation (2).
Accepted types are set on the question; the maximum file size is a site setting. Test the upload flow before the exam.
Code questions: setup and scoring
A Code question includes a rich-text question body, language, mark, Auto-grading setting, optional input/output hints, Pre Solution (starter code), Key Solution, and test cases. The same authoring pattern is used in exams, exercises, and the Question Bank. See the Code questions reference for language and HTML DSL details.
Author a code question
Creating a Code question opens four tabs in this UI order:
| Tab (left → right) | What you set |
|---|---|
| 1. Question Settings | Question body (task text), language, mark, Auto-grading, Show Mark On Run, optional input/output hints, CLOs / keywords / level. The first editor file is named for the language (main.cpp, main.py, Main.java, …). |
| 2. Test Cases | Inputs, expected outputs, weights, sample runs, and comparison options. Prefer filling this via Generate Cases after the Key Solution is ready. |
| 3. Pre Solution | Starter code students see before they have a saved answer (scaffolding, empty main, helper stubs, and so on). |
| 4. Key Solution | Your complete reference program (last tab). Run it here to confirm it compiles and that trial inputs produce the outputs you expect. Generate Cases uses this tab. |
Easiest way to build the cases
You do not have to fill the tabs strictly left-to-right. The fastest path is:
- Finish Question Settings (question body, language, mark, Auto-grading on for auto-scored papers).
- Jump to the last tab, Key Solution. Type the reference solution and Run it. Fix compile errors, try a few inputs in the runner, and check the printed output. Do not print unstable values (memory addresses, wall-clock time) when outputs must match exactly.
- Click Generate Cases. In the dialog, add as many inputs as you need and set how many leading cases are sample runs (visible under the question body, weight 0). Click Run in the dialog.
- iCode runs your Key Solution on each input and fills the expected outputs on the Test Cases tab automatically. Graded weights are split evenly across the non-sample cases so they total 100%. Review Test Cases, adjust ignore-case / spaces / lines or
output_contains(...)if needed, set Pre Solution, then publish.
Generate Cases works for the compiled languages and JavaScript. HTML cases use the HTML output DSL and are written on the Test Cases tab by hand — see Code questions.
Input is split on newline characters, not spaces. 5 6 7 is one input line; 5, 6, and 7 on separate lines are three lines. For JavaScript and HTML/JavaScript questions, each input line supplies one prompt() response in order. Expected JavaScript output comes from console.log.
Several coding-question examples
The following are ready-to-adapt question designs. In each, use the listed cases as the Input and Expected Output. The first case may be a visible sample (weight 0); distribute 100% over the remaining graded cases.
Example 1 — C++: sum only the positive values
- Question body: Read an integer
n, followed bynintegers. Print the sum of values greater than zero. If there are no positive values, print0. - Language: C++
- Mark: 5 · Auto-grading: On
- Pre Solution: Provide
main()and input-reading scaffolding, leaving the sum logic for students. - Key Solution: Read
n, loop through the values, add only values greater than zero, and print the sum followed by a newline.
| Input | Expected output | Weight |
|---|---|---|
5 then 4 -2 6 0 -3 on the next line |
10 |
50 |
3 then -1 0 -8 on the next line |
0 |
50 |
Key Solution
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long sum = 0;
for (int i = 0; i < n; ++i) {
int value;
cin >> value;
if (value > 0) sum += value;
}
cout << sum << '\n';
}
Example 2 — Python: count words in one line
- Question body: Read one line and print the number of whitespace-separated words. An empty or whitespace-only line contains zero words.
- Language: Python
- Mark: 4 · Auto-grading: On
- Pre Solution: Start with
line = input()and a placeholder for the count. - Key Solution: Read the line, split it into whitespace-separated tokens, and print the token count.
| Input | Expected output | Weight |
|---|---|---|
iCode helps students code |
4 |
50 |
practice every day |
3 |
50 |
Key Solution
line = input()
print(len(line.split()))
Example 3 — Java: find the largest value
- Question body: Read
nfollowed bynintegers, wheren >= 1. Print the largest integer. Do not sort the input. - Language: Java
- Mark: 6 · Auto-grading: On
- Pre Solution: Provide the
Mainclass and input-reading setup, leaving the comparison logic for students. - Key Solution: Initialize the maximum from the first value, compare each remaining value, then print the maximum.
| Input | Expected output | Weight |
|---|---|---|
5 then -4 12 3 12 0 |
12 |
50 |
1 then -7 |
-7 |
50 |
Key Solution
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int largest = in.nextInt();
for (int i = 1; i < n; i++) {
largest = Math.max(largest, in.nextInt());
}
System.out.println(largest);
}
}
Example 4 — JavaScript: add two prompted numbers
- Question body: Ask for two numbers using
prompt(). Print their sum usingconsole.login the exact formatTotal: <sum>. - Language: JavaScript
- Mark: 4 · Auto-grading: On
- Input: Put each prompt response on its own line. The grader supplies lines to
prompt()in order. - Key Solution: Convert both prompt strings to numbers, add them, and log the required label and result.
| Input | Expected output | Weight |
|---|---|---|
12 newline 8 |
Total: 20 |
50 |
-3 newline 10 |
Total: 7 |
50 |
Key Solution
const first = Number(prompt());
const second = Number(prompt());
console.log(`Total: ${first + second}`);
Example 5 — C++: swap values using pointers
- Question body: Read two integers, swap them by calling a function that receives pointers, then print the values in their new order. Print values, not pointer addresses.
- Language: C++
- Mark: 5 · Auto-grading: On
- Pre Solution: Provide the function signature and a
main()scaffold. - Key Solution: Exchange the pointed-to values and print the resulting pair.
| Input | Expected output | Weight |
|---|---|---|
3 7 |
7 3 |
50 |
-2 0 |
0 -2 |
50 |
This assesses pointer use through a stable observable result. Printed addresses vary between runs and are not reliable expected output.
Example 6 — HTML: check structure and visible text
- Question body: Create a page with one
<h1>containingWelcomeand a button with idsendwhose text isSubmit. - Language: HTML
- Mark: 5 · Auto-grading: On
- Student files:
main.htmlcontaining the requested elements. - Expected Output: HTML questions use the structured DSL below, not plain stdout. Quote CSS and attribute values.
main.html: {
h1: text={"Welcome"}
button#send: text={"Submit"}
elements: ["h1", "button#send"]
}
Example student file
<!doctype html>
<html>
<body>
<h1>Welcome</h1>
<button id="send">Submit</button>
</body>
</html>
Use one weighted case for the criteria when practical. The browser checks the student's DOM; additional supported checks include CSS, attributes, links, scripts, files, meta tags, and console output. See Code questions for syntax and multi-page examples.
Before publishing: author checklist
- Does the question body say exactly what students must submit or print?
- Are all answer choices, blanks, matches, and keys unambiguous?
- Do manual questions have a usable rubric?
- Are file constraints and accepted formats clear?
- For code, do all cases pass on the Key Solution, including boundary cases?
- Do graded case weights total 100%, with visible sample runs at weight 0?
- Are random, time-based, or address-based outputs avoided or made deterministic?
- Have you previewed the student view and checked the publish state?
For exam setup and live-sitting limits, see Create & configure exams. For the type-by-type scoring summary, see Question types.