Skip to content

Instantly share code, notes, and snippets.

@drconopoima
Created June 21, 2026 11:37
Show Gist options
  • Select an option

  • Save drconopoima/3410e2a8d436c2dc7291d972ca081b4e to your computer and use it in GitHub Desktop.

Select an option

Save drconopoima/3410e2a8d436c2dc7291d972ca081b4e to your computer and use it in GitHub Desktop.
Generate Practice Test & mock exam questions from a desired curriculum input (text, webpage, PDF, URLs).
name practice-test-mock-exam
description Generate Practice Test & mock exam questions from a desired curriculum input (text, webpage, PDF, URLs). Produces completely accurate, real exam-like questions in interactive mode delivered one-by-one, detail-oriented design to probe concept-awareness with proper explanations and randomized options order
tags
exam
exam-prep
mock-exam
practice-test
questions
certification
education
triggers
practice test
practice test
exam questions
generate practice test
certification exam questions
exam prep
mock exam

Practice Test / Mock exam Generator

Purpose

Convert any source material (text, webpage, PDF, URLs) into a perfect mock exam with a number of questions desired by the user. Questions must be real-exam-like, completely accurate, with proper explanations for every option and randomized order for the correct option.

Rules:

  1. Question Type: Only two values allowed, each with at least 4 or (ocassionally with 5% frequency) up to 7 labeled (A through D, ocassionally E through G) options:
    • multiple-choice = exactly ONE correct answer
    • multi-answer = select ONE or MORE (up to 1 fewer than available choices) correct answers
  2. Correct Answers:
    • For multiple-choice: single letter (e.g., B)
    • For multi-answer: comma-separated letters (e.g., A,C,E,F)

Input Handling by Source Type

Raw Text / Pasted Content

  • Use directly as source material
  • Split into logical sections/topics for domain mapping

URLs / Webpages

  • Load the page and extract full content
  • For multi-page content, follow pagination/next links
  • If content is behind auth or blocked, ask user to paste it

PDF Files

  • Extract text
  • For scanned PDFs, use OCR
  • Preserve headings/structure for domain mapping

Multiple Sources

  • Process each source independently first
  • Merge extracted content, deduplicate overlapping topics
  • Cross-reference facts across sources for accuracy

Batch Size Guidelines

Source Size Questions to Generate
1-5 pages / short article 15-25 questions
5-20 pages / medium doc 30-60 questions
20-50 pages / large doc 60-120 questions
50+ pages / book/course 120-200 questions
User specifies count Exactly that many

Rule of thumb: 5-10 questions per page of dense technical content, 3-5 per page of general content. Always ask user if they want a specific count.

Exam Limits

  • Min questions per practice test: One per exam topic in randomized block order
  • Max questions per practice test: No hard cap, but 150-250 is typical for certification exams, weighted by exam topics weight, randomized exam block topic order
  • Max options per question: 7
  • Min options per question: 4 (True or False questions can have 2)
  • Question text max length: ~600 characters recommended (no hard limit but UI truncates long text)
  • Option text max length: ~200 characters recommended
  • Explanation max length: ~1000 characters recommended
  • Domain field: Free text, keep short (1-3 words ideal)
  • File encoding: UTF-8 (Python csv module default)
  • Max 2 practice tests per regular course (unlimited for practice test courses)

Generation Process

Step 1: Analyze Source Material

  • Read/extract content from all provided sources (text, PDFs, URLs, webpages)
  • Identify key concepts, facts, procedures, definitions, and relationships
  • Map content to domains/topics for balanced coverage

Step 2: Question Design Principles

  • Real exam style: Questions should mimic actual certification/professional exam patterns
  • Difficulty distribution: 20% easy, 45% medium, 35% hard
  • Question types to use:
    • Scenario-based ("A company wants to..." / "You are tasked with...")
    • Direct knowledge ("Which of the following...")
    • Best practice ("What is the recommended approach...")
    • Troubleshooting ("A user reports X error. What is the most likely cause?")
    • multi-answer for "select ALL that apply" patterns
  • Distractor quality: Wrong answers must be plausible, not obviously wrong, with explanation why someone might lean to it
  • No trick questions: Questions should test knowledge, not reading comprehension

Step 3: Explanation Quality Standards

  • Per-option explanations: Explain WHY each option is correct OR incorrect
    • For correct: Confirm with supporting detail
    • For incorrect: Explain what makes it wrong and what it actually refers to
  • Overall explanation: Provide comprehensive context, relevant theory, and exam tips
  • Be specific: Reference official docs, specifications, or standards where applicable

Step 4: Keep track of knowledge area per question

Use method D'Hondt (greatest divisors method) to distribute knowledge areas among quiz/exam questions-

Example for a 25-question quiz:

| Curriculum Area                       | Weight in Exam | Questions                  |
|---------------------------------------|----------------|----------------------------|
| Overview of Cloud Native Security     |  14%           | Q5, Q11, Q19               |
| Kubernetes Cluster Component Security |  22%           | Q1, Q6, Q12, Q17, Q20, Q25 |
| Kubernetes Security Fundamentals      |  22%           | Q2, Q7, Q13, Q18, Q21      |
| Kubernetes Threat Model               |  16%           | Q3, Q9, Q15, Q23           |
| Platform Security                     |  16%           | Q4, Q10, Q16, Q24          |
| Compliance & Frameworks               |  10%           | Q8, Q14, Q22               |

Step 5: Deliver an outline of misses per topic

Keep track of wrong answers by exam topic for later preparing context-aware personalized study sessions.

| Curriculum Area                       | Misses     | Weight in Exam |
|---------------------------------------|------------|----------------|
| Overview of Cloud Native Security     | 1: Q5      | 14%            |
| Kubernetes Cluster Component Security | 1: Q12     | 22%            |
| Kubernetes Security Fundamentals      | 2: Q7, Q21 | 22%            |
| Kubernetes Threat Model               | 1: Q16     | 16%            |
| Platform Security                     | 0          | 16%            |
| Compliance & Frameworks               | 1: Q8      | 10%            |

Step 6: Validation Checklist

Before delivering, verify:

  • Every question either has at least 4 options or asks True or False (standard for exams)
  • multiple-choice questions have exactly 1 correct answer
  • multi-answer questions have 1+ correct answers
  • Correct answer numbers reference valid option positions (A-D, A-G, True/False)
  • No empty Question or Question Type fields
  • Explanations are substantive (not just "Correct" or "Incorrect")
  • Questions are factually accurate to the source material
  • Domain field populated for all questions
  • Mix of multiple-choice (~70%), and multi-answer (~25%), and True or False (~5%)

Quality Targets

  • Accuracy: Every fact must be verifiable from the source material
  • Coverage: Questions should cover ALL major topics from the source
  • Balance: Even distribution across domains
  • Exam-like: Should feel like a real certification exam
  • Explanations: Every option needs WHY it's right or wrong

Pitfalls

  • Don't use more than 7 options per question
  • multi-answer MUST have 1+ correct answers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment