DEV Community

Moznu
Moznu

Posted on Fully Autonomous

My practice tests had a cheat code: always pick the longest answer

I build QuizCram, a site of practice questions for things like the DMV permit test, phlebotomy and CompTIA A+. Each question has four options, one correct answer, an explanation and a source.

In October I ran one line of Python over every bank and found that many of my quizzes could be passed without reading the questions.

The check

The idea is simple. For each question, is the correct option strictly longer than all three wrong ones?

def strictly_longest(q):
    c = len(q["options"][q["answer"]])
    return all(len(o) < c for i, o in enumerate(q["options"]) if i != q["answer"])
Enter fullscreen mode Exit fullscreen mode

If the options were written without bias, you would expect each of the four to be the longest about a quarter of the time. So a share near 25% is fine. A share near 100% means "pick the longest" is a strategy.

What it found

I measured all 36 banks as they were on 15 Oct 2026:

Bank Correct option is strictly the longest
Ohio permit test 95%
Georgia permit test 95%
Pennsylvania permit test 94%
North Carolina permit test 94%
Phlebotomy (NHA CPT) 89%
ServSafe Manager 85%

28 of the 36 banks were over 45%. On the worst ones, a student who always picked the longest option would get about 19 questions out of 20 right without knowing anything about driving.

That's worse than a bug. A practice score is supposed to tell you whether you're ready. These scores told people they were ready when they weren't.

Why it happens

When you write a question, you take care over the correct answer. It gets the qualifier, the exception and the precise wording, because it has to be right. The wrong options get written quickly, because they only have to be wrong. So the correct one ends up longer and more specific.

Here's a real one from the phlebotomy bank:

What is the primary purpose of applying a tourniquet before venipuncture?

  • To numb the skin around the puncture site
  • To clean the skin before needle insertion
  • To increase arterial blood flow to the area
  • To distend the veins by restricting venous blood flow

The answer is the longest option, and it's also the only one with a mechanism in it.

The fix: rewrite the wrong options, never the right one

I set myself three rules:

  1. Never touch the stem, the correct option or the explanation. Those were fact-checked against sources, so editing them would mean checking them all again.
  2. Rewrite the wrong options to match the correct one in length and specificity. Padding doesn't count. A wrong option has to read like something a half-prepared student would believe.
  3. Don't overcorrect. If every correct option becomes the shortest, that's just a new cheat code.

The same question after the fix:

  • To numb the skin around the puncture site, so the patient feels less pain at insertion
  • To clean the skin before needle insertion, by pressing the antiseptic into the surface
  • To increase arterial blood flow, which makes the vein larger and the draw faster
  • To distend the veins by restricting venous blood flow

Now the correct option is the shortest, and each wrong option carries a reason that sounds plausible. You have to know what a tourniquet does.

Rule 3 is where the code comes in. For each question, the script picks a random target from 0 to 3 for how many wrong options should be longer than the correct one. That way the correct option's length rank is spread evenly. It also shuffles the answer positions so each slot (A, B, C, D) holds about a quarter of the answers:

r = rng.randrange(4)  # how many wrong options end up longer than the correct one
longer  = [w for w in new_wrong if len(w) > len(correct)]
shorter = sorted((w for w in new_wrong + old_wrong if len(w) <= len(correct)), key=len, reverse=True)
wrong = longer[:r] + shorter[:3 - r]
Enter fullscreen mode Exit fullscreen mode

The random generator is seeded with the bank name, so running the script again gives the same result and the diff in git stays readable.

One lesson took a second pass to learn. Banks where the correct answers are naturally long (clinical procedures, commercial driving) need the new wrong options written longer than the correct one from the start. Otherwise the script has nothing to choose from, and the share stalls around 55%.

Keeping it fixed

A one-time cleanup decays. New questions get written the old way. So the check now runs inside the validator that every bank passes before it ships, as a warning above 45%:

LENGTH_BIAS_MAX = 0.45
if items and longest / len(items) > LENGTH_BIAS_MAX:
    warnings.append(f"{slug}: correct option is the longest in "
                    f"{longest / len(items):.0%} of questions (target <= {LENGTH_BIAS_MAX:.0%})")
Enter fullscreen mode Exit fullscreen mode

It has already caught something real. Several banks were rebuilt in November with new questions, and their share crept back up toward the line. Today, across 58 banks, the highest is 44% and the lowest is 14%. The phlebotomy bank went from 89% to 42%, and ServSafe Manager from 85% to 32%.

45% is a warning line, not a target. The next step is to bring the banks that are drifting back toward 25%.

If you build quizzes

Run the four-line check above on your own data. It takes a minute, and if your number is high, your users' scores are partly measuring how long the options are.

Some other leaks worth checking the same way:

  • Answer position. Is "C" correct more often than the others?
  • "All of the above". Is it always correct when it appears?
  • Grammar. Does only the correct option agree with the stem ("an ___")?

If you want to see the rewritten options for yourself, the free phlebotomy practice questions are open without an account. Try "pick the longest" on them. It doesn't work anymore.
`

Top comments (0)