{"id":35165271,"url":"https://github.com/yogeshkumarsaini/quiz-application","last_synced_at":"2026-04-29T02:02:22.610Z","repository":{"id":328991305,"uuid":"1117662305","full_name":"yogeshkumarsaini/Quiz-Application","owner":"yogeshkumarsaini","description":"A lightweight console-based Java quiz app that loads MCQs from JSON, enforces a per-question timer, and calculates a final score.","archived":false,"fork":false,"pushed_at":"2025-12-16T16:36:30.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-20T07:40:09.614Z","etag":null,"topics":["beginner-project","console-app","gson","java","json","mcq","oop","quiz","timer"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yogeshkumarsaini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-16T16:23:56.000Z","updated_at":"2025-12-16T16:38:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yogeshkumarsaini/Quiz-Application","commit_stats":null,"previous_names":["yogeshkumarsaini/quiz-application"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/yogeshkumarsaini/Quiz-Application","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshkumarsaini%2FQuiz-Application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshkumarsaini%2FQuiz-Application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshkumarsaini%2FQuiz-Application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshkumarsaini%2FQuiz-Application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yogeshkumarsaini","download_url":"https://codeload.github.com/yogeshkumarsaini/Quiz-Application/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yogeshkumarsaini%2FQuiz-Application/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32407176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"online","status_checked_at":"2026-04-29T02:00:06.602Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginner-project","console-app","gson","java","json","mcq","oop","quiz","timer"],"created_at":"2025-12-28T19:28:03.430Z","updated_at":"2026-04-29T02:02:22.599Z","avatar_url":"https://github.com/yogeshkumarsaini.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quiz Application\n\nA simple console-based Quiz Application that presents multiple-choice questions (MCQs) to the user with a countdown timer for each question. Questions are loaded from a JSON file and the final score is calculated based on correct answers.\n\n---\n\n## ✨ Features\n\n- Multiple Choice Questions (MCQs)\n- Countdown timer for each question\n- Automatic score calculation\n- Questions loaded from a JSON file\n- Final result display\n\n---\n\n## 🧠 Concepts Used\n\n- Object-Oriented Programming (OOP)\n- Timer \u0026 TimerTask\n- File handling\n- JSON parsing\n- Exception handling\n- Collections (ArrayList)\n\n---\n\n## 🏗️ Project Structure\n```\nQuizApplication/\n│\n├── src/\n│   ├── QuizApp.java\n│   ├── Question.java\n│   ├── QuizService.java\n│   └── TimerService.java\n│\n├── questions.json\n└── README.md\n```\n---\n\n## 📄 questions.json (example)\n\nPlace this file at the project root (next to `src/`).\n\n```json\n[\n  {\n    \"question\": \"Which of the following is not a Java feature?\",\n    \"options\": [\"Object-Oriented\", \"Platform Independent\", \"Use of pointers\", \"Secure\"],\n    \"answer\": 3\n  },\n  {\n    \"question\": \"Which method is the entry point of a Java program?\",\n    \"options\": [\"start()\", \"main()\", \"run()\", \"init()\"],\n    \"answer\": 2\n  },\n  {\n    \"question\": \"Which keyword is used to inherit a class in Java?\",\n    \"options\": [\"this\", \"super\", \"extends\", \"implements\"],\n    \"answer\": 3\n  },\n  {\n    \"question\": \"Which of these is not a primitive data type in Java?\",\n    \"options\": [\"int\", \"float\", \"String\", \"char\"],\n    \"answer\": 3\n  },\n  {\n    \"question\": \"What is the size of int data type in Java?\",\n    \"options\": [\"8 bits\", \"16 bits\", \"32 bits\", \"64 bits\"],\n    \"answer\": 3\n  },\n  {\n    \"question\": \"Which concept allows the same method name with different parameters?\",\n    \"options\": [\"Inheritance\", \"Encapsulation\", \"Polymorphism\", \"Abstraction\"],\n    \"answer\": 3\n  },\n  {\n    \"question\": \"Which exception is thrown when dividing by zero?\",\n    \"options\": [\"NullPointerException\", \"ArithmeticException\", \"IOException\", \"NumberFormatException\"],\n    \"answer\": 2\n  },\n  {\n    \"question\": \"Which collection does not allow duplicate elements?\",\n    \"options\": [\"List\", \"ArrayList\", \"Set\", \"Map\"],\n    \"answer\": 3\n  },\n  {\n    \"question\": \"Which keyword is used to create an object in Java?\",\n    \"options\": [\"class\", \"new\", \"object\", \"create\"],\n    \"answer\": 2\n  },\n  {\n    \"question\": \"Which of the following is used for memory management in Java?\",\n    \"options\": [\"Compiler\", \"Interpreter\", \"Garbage Collector\", \"JVM\"],\n    \"answer\": 3\n  }\n]\n```\n\n---\n\n## 🧩 Key Classes (overview)\n\n- Question.java\n  - Model class representing a question, its options and the index of the correct answer.\n\n- TimerService.java\n  - Manages a per-question countdown using `java.util.Timer` and `TimerTask`.\n\n- QuizService.java\n  - Loads questions (from JSON), presents them, reads user input, uses timer service, and computes the score.\n\n- QuizApp.java\n  - Main class to start the quiz; coordinates loading from `questions.json` and invokes `QuizService`.\n\n---\n\n## 🔧 Libraries / Dependencies\n\nYou can use either:\n\n- Gson (recommended) — com.google.code.gson:gson\n- json-simple — for minimal JSON parsing\n\nIf you use Maven, add Gson to `pom.xml`:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.google.code.gson\u003c/groupId\u003e\n  \u003cartifactId\u003egson\u003c/artifactId\u003e\n  \u003cversion\u003e2.10.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n---\n\n## 🚀 Build \u0026 Run (simple, without a build tool)\n\n1. Download the Gson jar (if using Gson), e.g. `gson-2.10.1.jar`.\n2. From the project root:\n\nUnix / macOS:\n```bash\njavac -cp gson-2.10.1.jar src/*.java -d out\ncp questions.json out/\ncd out\njava -cp .:../gson-2.10.1.jar QuizApp\n```\n\nWindows (cmd):\n```cmd\njavac -cp gson-2.10.1.jar src\\*.java -d out\nxcopy questions.json out\\\ncd out\njava -cp .;..\\\\gson-2.10.1.jar QuizApp\n```\n\nNotes:\n- The code examples assume classes are in the default package. If you move them into packages, adjust the directory layout and compile/run classpaths accordingly.\n- Ensure `questions.json` is available on the classpath or accessible by the code when reading from disk.\n\n---\n\n## ✅ Expected Behavior\n\n- The app loads questions from `questions.json`.\n- For each question, the app prints the question and options, starts a countdown timer, and accepts the user's answer.\n- If time runs out for a question, it moves on.\n- After all questions, the final score is displayed.\n\n---\n\n## ✍️ Extending the App (ideas)\n\n- Add shuffled questions and options\n- Add different difficulty levels or categories\n- Persist high scores to a file or DB\n- Add a GUI (Swing / JavaFX)\n- Support timed quizzes with configurable time per question\n\n---\n\n## License\n\nThis project is provided as-is for learning and demonstration purposes. Feel free to reuse and modify.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogeshkumarsaini%2Fquiz-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyogeshkumarsaini%2Fquiz-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyogeshkumarsaini%2Fquiz-application/lists"}