This is a Java Console-Based Quiz Application that allows users to create quizzes, add questions, and take quizzes interactively via a terminal interface.
Compile and run the main application file:
javac QuizApp.java
java QuizAppUpon running, you'll see:
Welcome to Quiz Generator!
Available commands:
Press 1 for create-quiz
Press 2 for add-question
Press 3 for take-quiz
Press 4 for exit
Purpose: Create a new quiz by topic name.
Steps:
- Enter a topic name (e.g.,
Java Basics). - If the topic already exists, the quiz won't be recreated.
Example:
Enter quiz topic name: Java Basics
→ Quiz created successfully.
Purpose: Add one or more questions to an existing quiz.
Steps:
- Enter the quiz topic name.
- Input:
- The question text
- Number of options (minimum 2)
- Each option string
- Correct option number (1-based index)
- Type
doneto finish adding questions.
Example Flow:
Enter quiz topic name to add questions: Java Basics
Enter question (or type 'done' to stop adding questions): What is JVM?
How many options you want to add = 3
Enter option 1: Java Virtual Machine
Enter option 2: Java Voice Manager
Enter option 3: Java Version Mode
Enter correct option number (1-3): 1
→ Question added to quiz.
Purpose: Attempt a quiz interactively.
Steps:
- Enter quiz topic name.
- Answer each question (1-based index).
- At the end, rate your experience from 1-5.
Example Flow:
Enter quiz topic name: Java Basics
Starting Quiz on: Java Basics
1. What is JVM?
1) Java Virtual Machine
2) Java Voice Manager
3) Java Version Mode
Your answer: 1
→ Correct!
Rate your Experience between 1-5 = 5
→ Quiz Completed! Score: 5/5
→ Thank you for your feedback! 5⭐️
Purpose: Exit the application.
Example:
Goodbye!
- Input is validated to ensure:
- Number of options ≥ 2
- Correct answer index is in range
- Menu commands are valid integers
---
## 📂 Directory Structure
src/ ├── QuizApp.java ├── Quiz/ │ └── Quiz.java └── Question/ └── Question.java
---
## ✅ Summary Table
| Command | Description | Input Required | Output |
|---------|-------------------------|--------------------------------------|-------------------------------------|
| 1 | Create a new quiz | Topic name | "Quiz created successfully" |
| 2 | Add questions to a quiz | Topic, question, options, correct | "Question added to quiz" |
| 3 | Take a quiz | Topic name, answers, feedback | Score & feedback |
| 4 | Exit the app | None | "Goodbye!" |