Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mock Exam

See https://reemeijer.nl/mock_exam/ for a sales pitch!

A fully interactive Rust CLI tool that quizzes you on built-in questions and gives you detailed results with the option to save them. The base for mock_exam is vibe coded with Claude. The example exams are also created with AI and I did NOT check if the answers are correct. They are mainly as example in the repository.

Why this tool?

I wanted to have a easy way of creating my own mock exams with the help of AI and having the freedom of changing it how I want to have the questions.

Contribute?

Yes, you may!

Without any crates

There is also a crate free vibe coded version found at Codeberg.


Features

  • 3 question types: Multiple Choice, True/False, and Open-Ended (self-asses)
  • 15 built-in questions covering Rust, CS, Networking, OS, and Math (not checked on rightness!)
  • Shuffleable question order
  • Choose how many questions to answer
  • Instant feedback after each answer (with explanations where available)
  • Detailed results with score, grade (not really doing a great job in version 1.0!), and per-question breakdown
  • Save results as plain .txt, structured .json, or both

Setup

# 1. Clone the project
# 2. Build with command: cargo build --release
# 3. To run: cargo run --release
# or, after building:
./target/release/mock_exam

Saved File Formats

Plain text (exam_title_YYYYMMDD_HHMMSS.txt)

MOCK EXAM RESULTS
============================================================
Exam   : Rust Quiz
Date   : 2024-12-01 14:30:00
Score  : 4/5 (80.0%)
Grade  : B — Good
...

JSON (exam_title_YYYYMMDD_HHMMSS.json)

{
  "exam_title": "Rust Quiz",
  "date": "2024-12-01 14:30:00",
  "score_percent": 80.0,
  "question_results": [ ... ]
}

Adding Your Own Exam Files

No code changes needed! Create a file with the .exam.json extension and drop it next to the binary. The program will detect it automatically and offer it as a source at startup.

Auto-discovery

Place any *.exam.json files inside the exams/ folder in the same directory where you placed the binairy. The following example exams are added, created by AI:

mock_exam            ← the binary
exams/
  geography.exam.json
  python_basics.exam.json
  linux_cli.exam.json
  sql_fundamentals.exam.json
  http_web.exam.json
  my_custom.exam.json   ← add your own here

When you run mock_exam you will see a numbered menu:

  ── QUESTION SOURCE
  Found 5 exam file(s) in this directory:

    │  [0] Built-in questions (15 questions)
    │  [1] geography.exam.json
    │  [2] http_web.exam.json
    │  [3] linux_cli.exam.json
    │  [4] python_basics.exam.json
    │  [5] sql_fundamentals.exam.json

  Choose source (0–5):

If the exams/ folder does not exist, the program falls back to scanning the current directory.

Direct load via CLI argument

mock_exam path/to/my_quiz.exam.json

Exam File Format

{
  "title": "My Quiz Title",
  "questions": [
    ...
  ]
}

The title field sets the exam name automatically — no prompting needed.

Multiple Choice

{
  "type": "multiple_choice",
  "text": "Which planet is closest to the Sun?",
  "options": ["Venus", "Earth", "Mercury", "Mars"],
  "correct_option": 3,
  "explanation": "Mercury is the closest planet to the Sun."
}
  • options: 2–5 answer strings (shown as A, B, C…)
  • correct_option: 1-based index of the correct option (3 = third option = C)
  • explanation: optional, shown after answering

True / False

{
  "type": "true_false",
  "text": "The Great Wall of China is visible from space.",
  "correct": false,
  "explanation": "This is a common myth; it is far too narrow to see from orbit."
}

Open Ended

{
  "type": "open_ended",
  "text": "Explain what a DNS server does.",
  "sample_answer": "A DNS server translates human-readable domain names into IP addresses.",
  "explanation": null
}
  • sample_answer is shown after the user answers so they can self-assess
  • explanation is optional (use null to omit)

Grade Scale

Score Grade
90–100% A — Excellent!
80–89% B — Good
70–79% C — Satisfactory
60–69% D — Needs Improvement
< 60% F — Please review the material

About

CLI tool that quizzes you on questions and gives detailed results

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages