You are on page 1of 15

ONLINE QUIZ PLATFORM

BY GROUP 5
outline
define the structures for User and Quiz, which store
information about users and quizzes, respectively.
Create empty vectors users and quizzes to store user
and quiz objects.
• Implement the registerUser() function
• Implement the authenticateUser
• Implement the createQuiz()
• .Implement the takeQuiz()
• Implement the showLeaderboard()
• the main function,
problem statement
The problem statement for this project revolves around the need for a quiz platform that
provides users with the ability to register, create quizzes, and take quizzes.
1User Registration:
- Users need a platform where they can create an account and register their details
securely. This allows them to access personalized features, save their progress, and
track their performance over time.

2. Quiz Creation:
- Educators, trainers, and content creators require a user-friendly platform to create
quizzes tailored to their specific needs. They need the ability to add questions, define
correct answers, and customize the quiz format. This empowers them to design
engaging and interactive assessments for their audience.

3. Quiz Taking:
- Users, such as students or learners, need a platform where they can access a wide
range of quizzes and assessments. They should be able to select quizzes based on
their interests or educational requirements. Taking quizzes provides an opportunity to
test their knowledge, reinforce learning, and receive immediate feedback on their
performance.
Goals

• The goal of this project is to develop a quiz


platform that caters to these requirements,
enabling users to register, create quizzes, and take
quizzes in a seamless and user-friendly manner.
• the objective of this project is to develop a quiz
platform with user registration, quiz creation, and
quiz taking functionalities. By doing so, the project
aims to facilitate knowledge assessment, foster
engagement, and support personalized learning
experiences.
Design
level design for the system:

1. User Class:
- Properties: username, password, score
- Methods: getters and setters for properties

2. Quiz Class:
- Properties: quizName, questions (stored as a map with question as key and correct answer as value)
- Methods: getters and setters for properties

3. QuizPlatform Class:
- Properties: users (stored as a vector of User objects), quizzes (stored as a vector of Quiz objects)
- Methods:
- User Registration: Allows a user to register by entering a username and password. The User object is created and added to the
users vector.
- User Authentication: Checks if the entered username and password match any of the registered users in the users vector.
- Quiz Creation: Allows an authenticated user to create a quiz by entering a quiz name, number of questions, and the questions
with their correct answers. The Quiz object is created and added to the quizzes vector.
- Quiz Taking: Allows an authenticated user to select a quiz from the available quizzes and answer the questions. The user's
score is calculated based on the number of correct answers and displayed at the end.
- Leaderboard Display: Displays the users and their scores in descending order based on their scores.
implementation
 The implementation includes functions for user
registration, authentication, quiz creation, quiz taking,
and leaderboard display.
 The implementation consists of the following functions:
• registerUser(): Handles the user registration process.
• loginUser(): Handles the user login process.
• createQuiz(): Manages the creation of a new quiz.
• takeQuiz(): Guides the user through taking a quiz.
• calculateScore(): Calculates the user's score.
Algorithm
1. User Authentication Algorithm:
```
function authenticateUser(username, password):
for user in users:
if user.username == username and user.password == password:
return true
return false
```

2. Quiz Creation Algorithm:


```
function createQuiz(quizName, numQuestions):
quiz = new Quiz()
quiz.quizName = quizName

for i in range(numQuestions):
question = promptUserForQuestion()
correctAnswer = promptUserForCorrectAnswer()
quiz.questions[question] = correctAnswer

quizzes.push_back(quiz)
```
3. Quiz Taking Algorithm:
function takeQuiz(selectedQuiz):
score = 0

for question in selectedQuiz.questions:


userAnswer = promptUserForAnswer(question)
correctAnswer = selectedQuiz.questions[question]

if userAnswer == correctAnswer:
score += 1

displayScore(score)

4. Leaderboard Display Algorithm:

function displayLeaderboard():
sort(users by score in descending order)

for user in users:


displayUser(user.username, user.score)
performance analysis
• Time Complexity
1. registerUser(): This function has a time complexity of O(1) because it performs a
constant number of operations regardless of the number of existing users.
2. authenticateUser(): This function has a time complexity of O(n), where n is the
number of users. It iterates over the `users` vector to find a match for the provided
username and password.

3. createQuiz(): This function has a time complexity of O(m), where m is the number of
questions in the quiz. It prompts the user to enter each question and its answer,
resulting in a linear time complexity.

4. takeQuiz(): This function has a time complexity of O(k), where k is the number of
questions in the selected quiz. It iterates over each question in the quiz and prompts
the user for an answer, resulting in a linear time complexity.

5. showLeaderboard(): This function has a time complexity of O(n log n), where n is
the number of users. It sorts the `users` vector based on the score using `std::sort`,
which has an average time complexity of O(n log n).
performance analysis
space complexity
1. space complexity of the `users` vector is O(n), where n is
the number of registered users. It stores user objects.

2. The space complexity of the `quizzes` vector is O(q),


where q is the number of created quizzes. It stores quiz
objects.

3. The space complexity for each quiz object is O(m),


where m is the number of questions in the quiz. It stores
questions and their answers in a map.

4. Additional space is used for variables and inputs, which


how to use
 Prerequisites
• Before using the application, ensure that you have the
following prerequisites:
• C++ Compiler: Install a C++ compiler on your system
(e.g., GCC, Clang) to compile and run the application.
 Installation
To install the application, follow these steps:
1.Download the source code file (quiz.cpp) to your local
machine.
2.Open a terminal or command prompt and navigate to the
directory where the source code file is located.
3.Compile the code using a C++ compiler. For example, with
GCC, run the following command
 User Registration and Login
 To register as a new user, follow these steps:
1.From the main menu, select option 1. Register.
2.Enter a desired username and password when
prompted.
3.The application will display a success message if the
registration is successful. You can now log in with your
registered credentials.
 To log in as an existing user, follow these steps:
1.From the main menu, select option 2. Login.
2.Enter your registered username and password when
prompted.
 Creating a Quiz
To create a quiz, follow these steps:
1.From the main menu, select option 3. Create a
Quiz.
2.Enter a name for the quiz when prompted.
3.Specify the number of questions you want to
include in the quiz.
4.For each question, enter the question text and its
correct answer.
5.Once you have provided all the questions and
answers, the quiz will be created and saved.
 Taking a Quiz
• To take a quiz, follow these steps:
1.From the main menu, select option
2.Choose a quiz from the available options by
entering its corresponding number.
3.The application will present each question one by
one. Enter your answer for each question when
prompted.
4.After answering all the questions, the application
will display your score and the time taken to
complete the quiz.
 Viewing the Leaderboard
• To view the leaderboard, follow these steps:
1.From the main menu, select option 5. Show
Leaderboard.
2.The application will display the usernames and scores
of all users in descending order based on their scores.
 Quitting the Application
• To quit the application, follow these steps:
1.From the main menu, select option 6. Quit.
2.The application will terminate, and you will exit the
program.

You might also like