🎮 Mini Quiz Game in Java

A simple console-based Quiz Game built in Java using loops, arrays, and the Scanner class.

This game asks multiple-choice questions, checks your answers, and updates your score in real-time!


🚀 Features


🛠️ Technologies & Concepts Used

Concept / Method Purpose
Scanner Read input from the user
for loop Iterate through the questions
String[] array Store quiz questions
String[][] 2D array Store multiple options per question
char[] array Store correct answers (A/B/C/D)
charAt(0) method Get the first character from user input
toUpperCase() method Standardize user input for comparison
System.out.println() Display output on console
if-else statement Compare user input with correct answer and update score

📄 Code Structure Overview

main Method

public static void main(String[] args)

- Entry point of the program

📦 Arrays Used

String[] questions;
String[][] options;
char[] answers;

🔁 Loop to Display Questions

for (int i = 0; i < questions.length; i++)

🎮 Taking User Input

Scanner scanner = new Scanner(System.in);
char userAnswer = Character.toUpperCase(scanner.next().charAt(0));

🧠 Answer Checking

if (userAnswer == answers[i]) {
    // Correct!
} else {
    // Incorrect
}

📷 Sample Output

Question 1: What is the output of 5 + 3?
A. 53
B. 8
C. Error
D. None
Your answer (A/B/C/D): B
✅ Correct!
Current Score: 1/1
...
🎉 Quiz Over! Your Final Score: 5/5
  

📦 How to Run the Program

  1. Save the code in a file named MiniQuizGame.java
  2. Open terminal/command prompt
  3. Compile the Java program:
    javac MiniQuizGame.java
  4. Run the compiled class:
    java MiniQuizGame

💡 Future Enhancements (Optional)


👨‍💻 Author

Sanskriti Singh


📁 License

This project is open for educational purposes. Feel free to fork and improve!