NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Senior0 views

Design a service for collaboratively creating and reviewing tests with a question bank, adaptive difficulty, and leak protection.

Practice

Asked at

AI answer

Architecture and data

The service can start as a modular application with PostgreSQL, object storage for attachments, and a background task queue. Core entities: Question, QuestionVersion, Tag, Review, Test, TestVersion, Attempt, Answer, Exposure. Question versions are immutable after publication; edits create a new version. Roles determine who can create, review, publish, and take tests.

Collaboration and quality

The editor saves drafts with a version number and optimistic locking checks. In case of conflicting changes, it shows the differences and requires them to be merged instead of silently overwriting data. Publication goes through review for answer correctness, unambiguous wording, tag relevance, and accessibility. Support history, comments, and rollback.

Test administration

When an attempt starts, record the test version and the selected question versions so that the result remains reproducible. Save answers and the final result transactionally; resubmitting a request must be idempotent. Adaptive difficulty can be selected based on estimates of user ability and question difficulty, updating the estimate after each answer. Start with a simple rule based on success-rate ranges, then apply IRT when data is available; monitor topic coverage and avoid sudden jumps in difficulty.

Leak prevention

Separate permissions for the question bank and exams; hide answer keys and explanations until the permitted time. Limit how often questions are presented again, randomly select equivalent questions and answer choices, and record exposure and unusual activity. Do not send the entire exam bank to the client in advance; the server checks answers and deadlines. This reduces the risk of leaks but cannot completely prevent people from photographing or sharing questions. Protect data with encryption, access auditing, backups, and recovery tests.