Designing an Online Exam and Quiz Platform (System Design Interview)
6 views
"Design an online exam system" covers platforms used by universities, certification bodies, and hiring assessments. It's a good interview prompt because the traffic pattern is unusual: thousands of people start at the same minute, save answers constantly, and must never lose work, while the system also needs to keep exams fair and secure.
Requirements
Functional: instructors create question banks (multiple choice, short answer, code, essay) and assemble exams with time limits and schedules; students log in, start the exam in a window, answer questions, and submit; answers auto-save; the timer is enforced; objective questions are auto-graded and others are queued for manual grading; results are published later.
Non-functional: handle a sharp spike when a scheduled exam starts (for example 50,000 students in five minutes); no lost answers, even if a browser crashes; consistent timing across clients; fairness through randomized question order and versions; audit logs for disputes.
Core components
1. Exam service: exam definitions, schedules, and versions.
2. Session service: creates an attempt when a student starts, recording start time, deadline, and the specific question set and order assigned.
3. Answer service: receives auto-save writes and the final submission.
4. Grading service: auto-grades objective items and creates tasks for human graders.
5. Proctoring and integrity service (optional): browser focus events, webcam snapshots, or plagiarism checks.
Handling the start-time spike
Pre-generate attempts shortly before the exam opens, and serve exam content (questions without answer keys) from a cache or CDN with signed URLs, so the database isn't hit by every student at once. A short randomized delay in the client's "start" request can smooth the spike. Authentication should be warmed up and scaled ahead of time, since login is often the real bottleneck.
Auto-save without losing work
The client saves each answer locally first (browser storage), then sends it to the answer service every few seconds or on change. Each save carries attempt_id, question_id, a client sequence number, and the answer. The service writes to a durable store with an upsert keyed by (attempt_id, question_id), ignoring saves with an older sequence number. If the network drops, the client keeps a queue and retries; on reconnection it syncs. This makes saves idempotent and order-safe.
Timer enforcement
Never trust the client clock. The server stores the deadline when the attempt starts; the client shows a countdown based on the server's time. Saves after the deadline plus a small grace period are rejected, and a scheduled job auto-submits attempts whose deadline has passed.
Integrity and fairness
Randomize question order and choose from equivalent question pools per student. Never send answer keys to the client. Log key events for audits. Grading of objective questions runs only after the exam window closes, so scores can't leak early.
Wrap-up
Highlight the key trade-offs: local-first saving for durability, server-side deadlines for fairness, and caching to survive the start spike. Rehearsing designs like this aloud builds confidence, and Linkjob AI (https://linkjob.ai) provides real-time help during live job interviews and technical interviews if you want extra support in a system design round.