Articles / Engineering
Every answer is checked by a machine
A learning app that marks a right answer wrong loses your trust in one tap. How Bitpath runs every snippet, in every language, before a lesson ships.
Sooner or later, every quiz app marks a correct answer wrong. For most subjects that is annoying. For programming it is fatal: if the app says this loop prints 7 and your own terminal says 8, you stop believing the app.
Bitpath has more than a thousand exercises, each in up to three languages. Nobody can keep that many snippets correct by reading them. So nobody tries. A program does it.
Lessons are data
A Bitpath lesson is not a video or a page of text. It is a list of exercises, each one a small typed record: a prompt, code in Python, JavaScript and TypeScript, the choices or the blanks, the answer, an explanation, sometimes a hint.
Because the answer is data, it can be tested like code.
What the checker does
Before a lesson can ship, a tool goes through every exercise and actually runs it.
- “What does this print?” The snippet is executed in Python, in JavaScript and in TypeScript. The output must equal the choice marked correct, in all three.
- “Type the answer.” The program’s output must be one of the accepted answers.
- “Fill the blanks.” The blanks are filled with the answer, hidden test code is appended, and the program must produce the expected result.
- “Order the lines.” The lines are put in the stated order and the program must run and pass its test.
SQL exercises run on a real database. Shell exercises run in a real shell, and Git exercises in a freshly created repository.
One right answer, proven
The subtle bug in fill-in and ordering exercises is not a wrong answer. It is a second right answer the author did not notice.
Suppose a word bank offers < and <=, and for this particular function both happen to work. A learner picks the “wrong” one, gets marked wrong, and is completely right to be angry.
So the checker does not only test the intended answer. It tries every other arrangement of the word bank and every other ordering of the lines, and fails the lesson if any of them also passes the test. If two orderings are both valid, the exercise has to be rewritten until only one is.
Rules that are not about code
A second tool checks the house rules, the things that make a lesson work on a phone:
- Every exercise stands alone. You see one question at a time and cannot scroll back, and a missed question may return days later in Practice. So a prompt may never say “the function from the last question”. If it asks about code, the code is there. The tool rejects back-references.
- Prompts are language-neutral. A function called
count_pairsin Python iscountPairsin JavaScript, so a shared prompt must not name it. - Hints do not leak. A hint may point at the method. It may not contain the answer.
- Variety. At least four different kinds of graded exercise per lesson, and never the same kind three times in a row.
What it cannot check
A machine can prove that a snippet prints 8. It cannot prove that the explanation is clear, that the distractors are real misconceptions, or that the lesson is in the right order. Those still take reading, and they will still sometimes be wrong.
If you find one, the address on the about page goes to the person who can fix it.