Skip to content

Repository files navigation

Quiz Project

This project contains multiple quiz modes:

  • Console quiz (Python) from .txt files
  • Web quiz from .txt files
  • DB web quiz with images (db_questions.json + db_images/)
  • OOP web quiz with images (oop_questions.json + oop_images/)

Features

  • Random question order
  • Random answer order
  • Configurable number of questions per session
  • Detailed report of wrong answers
  • Russian-language interface
  • Support for escaped separators in .txt format (\| for literal |)

File Structure

quiz_project/
├── kaz-questions.txt         # Plain-text quiz set
├── web-questions.txt         # Plain-text quiz set
├── quiz_script.py            # Console quiz app
├── quiz.html                 # Web quiz for .txt files
├── quiz_loader.js            # .txt loader for quiz.html
├── db-questions.docx         # Source DOCX for DB questions
├── docx_quiz_parser.py       # DOCX -> JSON/images parser
├── db_questions.json         # DB quiz questions
├── db_images/                # DB quiz images
├── db_quiz.html              # DB web quiz page
├── oop_questions.json        # OOP quiz questions
├── oop_images/               # OOP quiz images
├── oop_quiz.html             # OOP web quiz page
├── import_docx_questions.py  # Helper importer for merging DOCX questions
└── split_oop_volume.py       # One-time splitter (DB volume -> OOP volume)

Usage

1) Console quiz (.txt)

Run:

python quiz_script.py

Then select a .txt file and number of questions.

2) Web quiz (.txt)

Start local server:

python -m http.server 8000

Open:

3) DB web quiz (JSON + images)

Open:

4) OOP web quiz (JSON + images)

Open:

Question Formats

Plain text format

One line per question:

Question text|variant1;variant2;variant3;variant4;variant5|correct_index
  • correct_index is zero-based (0 means first answer is correct)
  • Use \| for literal | inside text

DOCX format

Use tags in the Word file:

  • <question> before each question
  • <variant> before each answer
  • Put related images immediately after question/answer blocks

DOCX Workflow (image quizzes)

  1. Put content in db-questions.docx (or another DOCX in same tag format).
  2. Parse with:
    python docx_quiz_parser.py
    
  3. Use generated JSON/images in the web quiz pages.

Troubleshooting

  • Use a local server (not file://) for web pages.
  • If images are missing, verify JSON image names match files in the corresponding image folder.
  • If quiz doesn’t load, check browser console and confirm JSON path is correct.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages