Skip to content

A C# quiz app that asks multiple-choice questions, tracks scores, and provides feedback based on performance

Notifications You must be signed in to change notification settings

ABurkas/QuizzApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quiz Application 📝

Project Description

This project is a text-based quiz application written in C#. It allows users to take a quiz by presenting a series of multiple-choice questions. For each question, users must choose the correct answer by inputting the number corresponding to the answer. After the quiz is completed, the program will display the score, along with feedback based on the performance. The program ensures that all inputs (answers) are valid and provides a user-friendly experience.

quiz

Key Features

  • Question Handling: Allows the creation of multiple questions with several possible answers, each with one correct answer.

  • Input Validation: Ensures that the user inputs a valid answer choice (a number between 1 and the number of possible answers).

  • Score Calculation: Calculates the number of correct answers and displays the result at the end of the quiz.

  • Feedback Based on Performance: Provides feedback messages such as "Excellent work!", "Good effort", or "Keep practicing" depending on the user’s score percentage.

  • Supports Various Question Types: Each question has a text prompt and multiple answer choices, and the correct answer is identified by its index.

    Skills Used

1. C# Programming

  • Object-Oriented Programming (OOP): Utilized fundamental OOP principles, such as classes, objects, and methods, to structure the quiz application effectively.
  • Data Types & Collections: Worked with arrays and strings to store and manage quiz questions and answers.
  • Control Flow: Applied conditional statements (if, else) and loops (foreach, for) to handle user input and quiz logic.
  • Input Validation: Ensured that user inputs were valid using methods like int.TryParse() and loop control to enforce correct data types and ranges.

2. Algorithms

  • Index Management: Handled the indexing of quiz questions and answers, ensuring each question was presented sequentially.
  • Score Calculation: Designed and implemented a simple algorithm for calculating the user’s score based on correct answers, and used arithmetic for determining percentages.

3. User Interface Design (Console Application)

  • Text-Based UI: Designed a simple console-based user interface with clear instructions, questions, answers, and feedback messages.
  • Text Formatting: Applied console text formatting (using Console.ForegroundColor) for improving readability and user experience (e.g., color-coding feedback).

4. Error Handling & Exception Management

  • Input Error Handling: Developed checks for invalid user inputs (such as non-numeric answers or out-of-range choices), ensuring that the program doesn’t crash on invalid input.
  • Exception Handling: Though minimal in this project, used logical checks to prevent unexpected behavior or crashes during quiz execution.

5. Problem-Solving & Logic

  • Logic Implementation: Created an efficient solution to match user inputs with the correct answers, calculate scores, and display feedback.
  • Debugging: Addressed logical errors such as ensuring only valid answers were accepted and improving question flow to provide better user experience.

6. Project Structuring

  • Modular Design: Broke down the application into manageable components (Question, Quizz, and Program classes) for better readability, maintainability, and extensibility.
  • Separation of Concerns: Ensured that the logic for handling the quiz and displaying results was separated from the core program flow and input handling.

7. User Experience (UX)

  • Feedback System: Incorporated feedback messages for users based on their performance to provide an engaging and informative experience.
  • Input Prompting: Developed user-friendly input prompts to guide the user through the quiz and ensure they understand how to make selections.

8. Testing & Debugging

  • Manual Testing: Performed manual testing of the program by entering various valid and invalid inputs to ensure it handled all edge cases.
  • Refinement: Refined the logic based on user feedback and testing to ensure the quiz functioned as intended and improved the flow of interaction.

Problems Solved During Development

Input Validation:

  • Problem: The program initially did not check if the user entered a valid number corresponding to one of the answer choices. Incorrect inputs (non-numeric values or out-of-range numbers) caused the program to fail.
  • Solution: Added a validation check to ensure the user enters a number between 1 and the number of possible answers. If an invalid input is detected, the program prompts the user to re-enter their answer.

Handling Incorrect Answer Choices:

  • Problem: Users could enter values that do not correspond to a valid answer, such as entering an answer outside the range of available options.
  • Solution: Introduced a check to ensure the user’s input falls within the correct range of answer options (e.g., 1–4 for four possible answers). If the input is invalid, the program requests a valid response.

Score Calculation and Feedback:

  • Problem: There was no clear system for providing feedback or calculating a percentage score for the quiz.
  • Solution: Implemented a feedback system based on the percentage of correct answers. Depending on the score, users get different messages like "Excellent work!", "Good effort", or "Keep practicing". This provides valuable feedback for the user.

Question Display:

  • Problem: Initially, the questions and answers were displayed without any structured format, making it difficult for the user to follow along.
  • Solution: Improved the display of the questions and answers by adding clear formatting. Each question is shown with its answer options numbered, and the text is colored for better readability.

Handling Non-Alphabetic Characters in Answer Options:

  • Problem: In some early versions of the program, special characters or numbers in the answers caused issues when formatting the question display.
  • Solution: The program now handles non-alphabetic characters correctly, ensuring the answer options are always displayed properly, and it prevents formatting issues.

Conclusion

This quiz application is a simple yet effective tool for engaging users with multiple-choice questions. It supports basic input validation, score calculation, and provides personalized feedback based on the user’s performance. The program is easy to extend with more questions or features, and serves as a useful starting point for learning about user interaction in console applications. It can be enhanced further by adding a graphical user interface (GUI), saving scores, or supporting different types of questions.

About

A C# quiz app that asks multiple-choice questions, tracks scores, and provides feedback based on performance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages