Write code

A program written and run against test cases.

As the student meets it, replayed

Write a function that returns the nth Fibonacci number.

Run the tests3 cases, hidden from the student
fib(0) → 0fib(1) → 1fib(10) → 55
3 of 3 tests pass · marked on the server
The facts
Category
Specialised input. Maths, code, music, chemistry.
The student gives
A program, run against tests
Marked
By rule, at once
The prompt carries
Text, and anything you add
In the builder
Now.
Settings this template rules out
  • Copy and paste offThis template needs copy and paste.
  • Keyboard shortcuts offThis template needs the keyboard.
  • The webCode work usually needs the references.

About write code.

Why this shape

A program written and run against test cases: the only honest test of whether someone can code.

An example. Write a function that returns the largest number in a list.

What it is

Specialised shapes fit particular subjects: a maths expression typed and checked, working shown step by step, code read or written, a chemical equation balanced, notes on a staff, cells in a grid, a number scored by how close it is, a passage highlighted.

Why it is needed

Every field has a form of answer that the general shapes mangle: an equation is not a word, a proof is not a paragraph, a program is not prose. A shape built for the form marks what the field marks and nothing else, and it lets Procto AI write questions in the form the subject uses.

When to use it

Use the maths shapes for calculation and working, the code shapes for programming courses and hiring, the chemistry shape for equations, estimation wherever a range is the honest answer, and highlighting for reading with evidence.

How to write one well

State the form the answer must take: an expression, a number to a given precision, a balanced equation, a language. Give the tolerance where a range is acceptable. For working, mark each step in the rubric so partial credit is fair.

For write code in particular. Include edge cases in the tests: empty input, one item, negatives.

Mistakes to avoid

Accepting one written form of an expression when several are equivalent. No tolerance on a measured answer. Code questions that depend on formatting. A highlight that could reasonably span more or fewer words.

How EdProcto marks it

Expressions, numbers and single-form answers are marked by rule, with tolerances and half-credit tolerances where you set them. A typed expression or chemical equation is compared sign for sign, with spacing ignored, so each form you accept is listed, and a slip that would be forgiven in a word is never forgiven here; working and code are marked by a reader against your rubric, step by step.

Questions.

How does a student answer a write code question?
A program, run against tests. A program written and run against test cases.
How is write code marked?
By rule, the moment the answer is given: the mark needs no reader.
Can Procto AI write write code questions?
Yes: from a chapter, notes or a handout, in this shape, at the level of thinking you set, written from your material only if you say so.