Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

A Simple Quiz System (C++ Project)

Table of content
Table of content 1
Overview 2
Problem Statement 2
Flow Diagram 4
User Interface 5
Suggested text file format 10
Object Oriented approach with C++ 11
Overview
This is second assignment you would work on as part of your training. Overall, this assignment is
designed in a way to test the concepts you learnt in module 1, module 2 and module 3.

I guess you have already gathered lot of experience on C language by now by executing the project
that you completed. This is going to be your C++ project and will build further over where we left
while doing our C project. I hope this project is also going equally or more interesting as the last one.

In this project we will build an outer layer over the Simple Quiz System that we made during the last
project. Here we will add a module to create the question bank and also have a system of
authentication for the administrators who will do it.

Please note : You may approach this problem using either procedural or object oriented
approach. However we recommend that you should do it using the new features you have learnt
in C++.

Problem Statement
The modified system will now behave following way ..

1. The opening screen will show a menu that is shown in SC-1.0


2. If the user wants to administer quiz, he chooses 1 and lands into SC-1.1
3. If the user wants to play the quiz the he chooses 2 and is taken to 1.2

Authentication
Administrators account is a protected account and it requires user name and password to be checked
from available list of administrators. Initially in the screen SC-1.1 the user is prompted to type in his
user name and password and once compared successfully, user is then taken to Question
management menu screen SC 1.1.0. In this menu 4 options are displayed where the user chooses
one of the tasks which he will like to do.

Administering Quiz System


Administering quiz involves creating/modifying/ deleting or printing questions.

1. Once the user decides what to do he chooses the right option in the menu and based on
what he chooses, he is taken to the appropriate screen.
2. Adding of question will refer screen SC 1.1.0.1
3. Modifying questions will require the screen SC 1.1.0.2
4. For deleting any question system will use SC 1.1.0.3
5. For printing any questions list the system will produce another text file in the format SC
1.0.0.4
6. Choosing exit will take the user back to previous menu.

The testing process


The testing process will be no different from what you developed in C. Here you may reuse the
previous code. In fact the entire C module may be used as it is in C++ environment as it is except you
will need to change the extension of the files to .cpp to be recognized and C++ file.

As discussed earlier in this module the user will appear in a test where 10 questions , one at a time.
These questions will picked up from a file containing 30 questions. Each question will have 4 answers.
User has to choose the correct one. When he submits his answer, the program will evaluate it
against stored answer for the specific questions. All the 10 questions will be evaluated in the similar
manner and marks will be assigned to the correctly chosen answers. At the end it will display the
marks that the user has secured.

The testing rules


Rules that will apply

1. No question can repeat in a session.


2. Every time the question sequence will be random.

Question bank
The question bank will be available in from of a predefined text file. The format of the text file will
be given. The questions in the text file should include questions on various subject like general
knowledge, sports, music, etc. For this project in a run we ask 10 questions but it is up to the
student to decide how many questions he will like to ask. Whatever numbers of questions are asked
the number questions in question banks are to be at least three times to avoid displaying same
questions over and over again.

Displaying the results


The result screen will be displayed in three parts ..

1) The first part will show the questions and the corresponding answers with the correct
answer.
2) The second part will show category wise performance.
3) The part will show the total marks obtained by the quiz player.
Flow Diagram

Start
Yes
User Interface
Main Menu Opt =1 Add Questions

No
Opening Screen – SC-1.0 Yes
==================== Opt = 2 Modify Questions
YesQuiz Game ..
Welcome to Simple
Ch = 1 Admin Menu
No
Your Options Yes

No ==========
Delete Questions
Opt = 3
1) Administer Quiz
2) Attend the Quiz No
Yes
3) Exit
Opt = 4 Print Questions

No
Administrator Login Screen – SC-1.1
============================= Opt = 5
Administrator Login
================
User Name : XXXXXXXXXXXXXXXXX

Password : XXXXXXXXXXXXXXXXX
Yes
Ch = 2(Y/N) : X
Confirm Quiz Module

No
Manage Questions Screen – SC-1.1.0

Ch = 3Questions
Manage
===============
1) Add New Questions
Yes 2) Modify Existing Questions
3) Delete Questions
4) Print Question List
Stop
5) Exit from this menu
Add New Questions – SC-1.1.0.1

Add New Questions


================
Question Id : XXXX
Question Text : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Ist Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2nd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3rd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4th Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Correct Option (1/2/3/4/) : X
Allotted Marks : XXX
Confirm (Y/N) : X

Modify Questions– SC-1.1.0.2

Modify Questions
================
Question Id : XXXX
Field to modify
1) Question Text
2) 1st Option
3) 2nd Option
4) 3rd Option
5) 4th Option
6) Correct Option
7) Allotted Marks
Enter your choice (1/2/3/4/5/6) : X <to enter>
<to display>
<Field Name> : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Enter new text (skip if not to modify) :
Confirm (Y/N) : X <to enter>
Delete Questions– SC-1.1.0.3
Delete Questions
===============
Question Id : XXXX <to enter>
<to Display>
Question Text : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Ist Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2nd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3rd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4th Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Correct Option : X
Allotted Marks : XXX
Confirm Deletion (Y/N) : X <to enter>

Print Questions List – SC-1.1.0.4

Question List
============================================================================
Question Id : XXXX
Question Text : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Ist Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2nd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3rd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4th Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Correct Option : X
Allotted Marks : XXX

Question Id : XXXX
Question Text : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Ist Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2nd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3rd Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4th Option : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Correct Option : X
Allotted Marks : XXX
…..
…..
Quiz Welcome Screen - SC-1.2
===========================
Welcome to Simple Quiz Game

Player Name : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Ready (Y/N) : X

Quiz Run Screen - SC-1.2.1


======================
Question : Number : XX
Question Category : XXXXXXXXX
Question Text : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Available Answers :
1) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Marks allotted : XXX

Enter the correct answer : X

Lock it (Y/N) : X

This repeats for 9 more questions


Quiz End Screen - SC-1.2.2
======================
Congratulations XXXXXXXXXXXXXXXXXX. You have completed the quiz

You have scored XX out of 10

Here are your answers …

Question Category : XXXXXXXX


Question <Number> : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Correct Answer : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Your Answer : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Marks Awarded : X

<repeats for 9 more questions>

Category Wise Marks …

<Category > : <Marks>


<Category > : <Marks>
<Category > : <Marks>

Your Final Total Score : XXX out of XXX

Press any key to go to main menu ..


Suggested text file format
User Information : SQG-USRINF.txt

Characters Field Name Data type Restriction

0-9 User Name String

10-19 Password String

Question Bank : SQG-QTNBNK.txt

Characters Field Name Data type Restriction

1-9 Question Category String

10-14 Question ID Integer

15-64 Question Text String

65-114 Answer - 1 String

115-164 Answer - 2 String

165-214 Answer - 3 String

215-264 Answer – 4 String

265-265 Correct Answer Integer 1/2/3/4

266-268 Allotted Marks Integer Max marks 100


Object Oriented approach with C++
About the solution
Here in this project we are use C++ as programming language. Many of the functions used in
procedural approach may be used here with little modifications here and there. However in this case
we will first need to think the whole matter in terms of objects and classes.

The Classes we can use here

We may use the following classes here ..

1. Controller : Controls the access and navigation to the system


2. AdminUsers : Manages all operations related to admin users of system
3. Questions : Manages all operations related to question creation, modification, deletion and
printing
4. Quiz : Manages all operations related to conducting the quiz

Let us design the solution

class Controller
{
public :
void menuController() { …..} // Refer to description in the earlier section
}

public class AdminUsers


{

private :

Int userId ;
String username;
String actualUserName;
String password

Int loginSystem() { … } // Refer to description in the earlier section

}
public class Questions

{
private :

Int questionId;
String questionText;
String answerText1;
String answerText2;
String answerText3;
String answerText4;
Int correctAnswer;

// Description of all the functions are available in procedural approach section


Void addQuestions(){ …}
Void modifyQuestions(){ …}
Void deleteQuestions(){…}
Void printQuestions(){…}
}

public class Quiz


{
Private :
// Description of all the functions are available in procedural approach section
Void startQuiz(){ ..}
Void runQuiz(){..}
Void displayResult(){ …)
}

You might also like