Reorder the code

Scrambled lines of code put back into a working program.

As the student meets it, replayed

Order these lines into a working loop.

  • for i in range(5):
  • total = 0
  • print(total)
  • total += i
Each position marked; the items were shuffled per student
The facts
Category
Pair and order. Match, sort, sequence.
The student gives
Items in sequence
Marked
By rule, at once
The prompt carries
Text, and anything you add
In the builder
Now.
Settings this template rules out

None. Every setting of a quiz applies to it.

About reorder the code.

Why this shape

Scrambled lines of a program restored to working order test reading code for control flow and dependency.

An example. Put these lines in the order that prints the numbers one to ten.

What it is

Pair-and-order questions ask the student to arrange: match items across two columns, put steps in sequence, sort items into groups, rank by a criterion. The knowledge tested is relational: not what a thing is, but how it goes with other things.

Why it is needed

Much of what is worth knowing is a structure: which term goes with which definition, which step follows which, which example belongs to which category. A single multiple-choice question cannot test a structure; an arrangement can, and it does so with partial credit, so a student who has most of it is told so.

When to use it

Use matching for terms and definitions, symbols and meanings, causes and effects. Use sequencing for processes, procedures, timelines and code. Use sorting for classification. Use ranking where the criterion is settled and the order is the knowledge.

How to write one well

Keep the items in a set of one kind, so the arrangement tests knowledge and not the reading of a mixed list. Give more items on the right than the left in a matching question, or make the extras plausible, so elimination does not do the work. For sequences, use four to seven steps; fewer is trivial, more is a memory test.

For reorder the code in particular. Use a program with one valid order; avoid lines that could swap.

Mistakes to avoid

A matching question with the same number of items each side and an obvious last pair. Steps that could reasonably be done in another order. Groups that overlap. A ranking whose criterion is a matter of opinion.

How EdProcto marks it

EdProcto marks arrangements by rule: each pair and each placement is its own small question when partial credit is on, and a sequence earns credit for every pair of steps that is the right way round, less every pair that is not, so the score reflects how much of the structure the student holds. The right-hand side of a matching question and the items of a sequence are shuffled with a seed the student does not have, so the page carries no key.

Questions.

How does a student answer a reorder the code question?
Items in sequence. Scrambled lines of code put back into a working program.
How is reorder the code marked?
By rule, the moment the answer is given: the mark needs no reader.
Can Procto AI write reorder the 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.