[go: up one dir, main page]

0% found this document useful (0 votes)
60 views69 pages

CS Project Final

This document describes a quiz management system project created by K. Bharadwaj, a class 12 student, under the guidance of their teacher Mr. Jitendra Sharma. The project aims to manage student and exam details like marks, courses, and papers through an automated online quiz system that evaluates students and saves time by grading multiple choice questions electronically. The system allows teachers to administer quizzes and view results while maintaining administrative control over the question bank and exam scheduling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views69 pages

CS Project Final

This document describes a quiz management system project created by K. Bharadwaj, a class 12 student, under the guidance of their teacher Mr. Jitendra Sharma. The project aims to manage student and exam details like marks, courses, and papers through an automated online quiz system that evaluates students and saves time by grading multiple choice questions electronically. The system allows teachers to administer quizzes and view results while maintaining administrative control over the question bank and exam scheduling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 69

Name:- K.

Bharadwaj
Roll No:-
Class:- XII ‘A’
Project name:- QUIZ Management System
Teacher name:- MR. Jitendra Sharma
School Name:- KV CRPF YELAHANKA

1
COMPUTER
SCIENCE
QUIZ
PROJECT

2
CONTENTS
S.NO. TOPIC PAGE NO.
1 CERTIFICATE 4
2 ACKNOWLEDGEMENT 5
3 INTRODUCTION 6
4 OBJECTIVES 10
5 MAINTAINANCE 11
6 SALIENT FEATURES 12
7 SYSTEM 12
REQUIREMENTS
8 SCOPE OF 13
IMPROVEMENT
9 ADVANTAGES 14
10 DATA FLOW 15
DIAGRAM (DFD)
11 FLOW CHART 16
12 PYTHON MODULES 17
13 DEBUGGING 27
14 INPUT SCREEN 28
15 SOURCE CODE 29
14 OUTPUT SCREEN 35
15 BIBLIOGRAPHY 42

3
CERTIFICATE
This is to certify that “K. Bharadwaj ” student of class XII ‘A’ has
successfully completed the research of project “QUIZ” under my
guidelines and supervision
He has submitted a file as an evidence for the same has taken proper
care and sincerely completing the project.
I certify that the file and project is upto my expectation and as per
guidelines issue by CBSE.

CS Teacher:- Mr. Jitendra Sharma

Examiner:-

4
ACKNOWLEDGEMENT
I undertook this Project work, as the part of my XII-Informatics
Practices course. I had tried to apply my best of knowledge and
experience, gained during the study and class work experience.
However, developing software system is generally a quite complex
and time-consuming process. It requires a systematic study, insight
vision and professional approach during the design and development.
Moreover, the developer always feels the need, the help and good
wishes of the people near you, who have considerable experience and
idea.

I would like to express my gratitude and appreciation to all who gave


me possibility to complete this project.
It takes this opportunity to express my deep sense of gratitude my
English teacher Mr. Jitendra Sharma ( PGT [Comp.sci]) under
whose valuable guidance, this project work has been carried out.
My sincere thanks to my school management for providing us the best
infrastructure including the Library, I express my gratitude towards
our Principal Mam DR RUBINA
Words can’t truly express my thankfulness to my parents and my
friends for their timely help and coordination.

5
INTRODUCTION
 The following project is related to “Quiz”
it consists of 2 rounds

 First round will be of “Direct answers” , Means the


contestant of the person who so ever is playing has to give the
particular Answer to the question

 If you gave the correct answer it will show “CORRECT”


and if you gave the wrong answer then it will show “WRONG”

 Online Quiz System (OQS) is a web-based


examination system where

 quiz is taken online i.e. through the internet or intranet


using computer

 system. The purpose of OQS is to take Semester Quizzes


in an efficient

 manner and no time wasting for checking the paper. The


main objective

6
 of OQS is to efficiently evaluate the candidate through a
fully automated

 system that not only saves lot of time but also gives
fast results.

 Teachers can administer quizzes using the OQS .The


system will show

 result after the examination is finished. A teacher has


control in the

 question bank and is supposed to make schedule for


the quiz. The

 system carries out the examination and auto-grading for


multiple choice

 questions which is fed into the system. Administrative


control of the

 whole system is provided.

 The main objective of the project on MCQ Quiz


Applications is to

7
 manage the details of Students, Examinations, Marks,
Courses, Papers.

 It manages all the information about Students, Results,


Papers,Sudents.

 The project is totally built at administrative end and


thus only the

 administrator is guaranteed the access. The purpose of the


project is to

 build an application program to reduce the manual


work for Marks,

 Couses, Papers.

 Online Quiz System (OQS) is a web-based


examination system where

 quiz is taken online i.e. through the internet or intranet


using computer

 system. The purpose of OQS is to take Semester Quizzes


in an efficient

8
 manner and no time wasting for checking the paper. The
main objective

 of OQS is to efficiently evaluate the candidate through a


fully automated

 system that not only saves lot of time but also gives
fast results.

 Teachers can administer quizzes using the OQS .The


system will show

 result after the examination is finished. A teacher has


control in the

 question bank and is supposed to make schedule for


the quiz. The

 system carries out the examination and auto-grading for


multiple choice

 questions which is fed into the system. Administrative


control of the

 whole system is provided.

9
 The main objective of the project on MCQ Quiz
Applications is to

 manage the details of Students, Examinations, Marks,


Courses, Papers.

 It manages all the information about Students, Results,


Papers,Sudents.

 The project is totally built at administrative end and


thus only the

 administrator is guaranteed the access. The purpose of the


project is to

 build an application program to reduce the manual


work for Marks,

 Couses, Papers.

 Online Quiz System (OQS) is a web-based


examination system where

 quiz is taken online i.e. through the internet or intranet


using computer

10
 system. The purpose of OQS is to take Semester Quizzes
in an efficient

 manner and no time wasting for checking the paper. The


main objective

 of OQS is to efficiently evaluate the candidate through a


fully automated

 system that not only saves lot of time but also gives
fast results.

 Teachers can administer quizzes using the OQS .The


system will show

 result after the examination is finished. A teacher has


control in the

 question bank and is supposed to make schedule for


the quiz. The

 system carries out the examination and auto-grading for


multiple choice

 questions which is fed into the system. Administrative


control of the
11
 whole system is provided.

 The main objective of the project on MCQ Quiz


Applications is to

 manage the details of Students, Examinations, Marks,


Courses, Papers.

 It manages all the information about Students, Results,


Papers,Sudents.

 The project is totally built at administrative end and


thus only the

 administrator is guaranteed the access. The purpose of the


project is to

 build an application program to reduce the manual


work for Marks,

 Couses, Papers.

 Quiz System (QS) is a web-based examination system where


quiz is taken .The purpose of QS is to take Semester Quizzes in an
efficient manner and no time wasting for checking the paper.

12
 The main objective of QS is to efficiently evaluate the
candidate through a fully automated system that not only
saves lot of time but also gives fast results.

 Teachers can administer quizzes using the QS .The system


will show result after the examination is finished. A teacher
has control in the question bank and is supposed to make
schedule for the quiz.

 The system carries out the examination and auto-grading for


multiple choice questions which is fed into the system.
Administrative control of the whole system is provided.

 The main objective of the project on MCQ Quiz


Applications is to manage the details of Students,
Examinations, Marks, Courses, Papers. It manages all the
information about Students , Results, Papers, Students. The
project is totally built at administrative end and thus only
the administrator is guaranteed the access. The purpose of the
project is to build an application program to reduce the
manual work for Marks, Courses , Papers.

 Quiz is a wonderful way to test one’s knowledge. But when it


comes to storing the data is a structured and schematic way it is a Ectic
(difficult) task so in order to tackle this problem we must have a data
management system for this, so this work of software management will
not only help you to store the data but will also help you to maintain a
detailed record of your quiz programme. ENJOY!!!!!!

13
 The main
objective of the
project on MCQ
Quiz Applications
is to
 manage the details
of Students,
Examinations,
Marks, Courses,
Papers.
 It manages all the
information about
14
Students, Results,
Papers,Sudents.
 The project is
totally built at
administrative end
and thus only the
 administrator is
guaranteed the
access. The purpose
of the project is to
 build an
application program
15
to reduce the
manual work for
Marks,
 Couses, Papers.
 The main
objective of the
project on MCQ
Quiz Applications
is to
 manage the details
of Students,
Examinations,
16
Marks, Courses,
Papers.
 It manages all the
information about
Students, Results,
Papers,Sudents.
 The project is
totally built at
administrative end
and thus only the
 administrator is
guaranteed the
17
access. The purpose
of the project is to
 build an
application program
to reduce the
manual work for
Marks,
 Couses, Papers.
 The main
objective of the
project on MCQ

18
Quiz Applications
is to
 manage the details
of Students,
Examinations,
Marks, Courses,
Papers.
 It manages all the
information about
Students, Results,
Papers,Sudents.

19
 The project is
totally built at
administrative end
and thus only the
 administrator is
guaranteed the
access. The purpose
of the project is to
 build an
application program
to reduce the

20
manual work for
Marks,
 Couses, Papers.
 The main
objective of the
project on MCQ
Quiz Applications
is to
 manage the details
of Students,
Examinations,

21
Marks, Courses,
Papers.
 It manages all the
information about
Students, Results,
Papers,Sudents.
 The project is
totally built at
administrative end
and thus only the
 administrator is
guaranteed the
22
access. The purpose
of the project is to
 build an
application program
to reduce the
manual work for
Marks,
 Couses, Papers.
 The main
objective of the
project on MCQ

23
Quiz Applications
is to
 manage the details
of Students,
Examinations,
Marks, Courses,
Papers.
 It manages all the
information about
Students, Results,
Papers,Sudents.

24
 The project is
totally built at
administrative end
and thus only the
 administrator is
guaranteed the
access. The purpose
of the project is to
 build an
application program
to reduce the

25
manual work for
Marks,
 Couses, Papers.
 The main
objective of the
project on MCQ
Quiz Applications
is to
 manage the details
of Students,
Examinations,

26
Marks, Courses,
Papers.
 It manages all the
information about
Students, Results,
Papers,Sudents.
 The project is
totally built at
administrative end
and thus only the
 administrator is
guaranteed the
27
access. The purpose
of the project is to
 build an
application program
to reduce the
manual work for
Marks,
 Couses, Papers.
 The main
objective of the
project on MCQ

28
Quiz Applications
is to
 manage the details
of Students,
Examinations,
Marks, Courses,
Papers.
 It manages all the
information about
Students, Results,
Papers,Sudents.

29
 The project is
totally built at
administrative end
and thus only the
 administrator is
guaranteed the
access. The purpose
of the project is to
 build an
application program
to reduce the

30
manual work for
Marks,
 Couses, Papers.

31
What is My SQL ?

The management of data in a database system is done by means of


a general-
purpose software package called a Database Management System
(DBMS). Some commercially available RDBMS are MS SQL
Server, MS ACCESS, INGRES, ORACLE, and Sybase.
MySQL, the most popular Open Source SQL database
management system, is developed, distributed, and supported by
Oracle Corporation. MySQL is named after co-founder Monty
Widenius's daughter, My. The name of the MySQL Dolphin (our
logo) is “Sakila,”. MySQL is a database management system.
A database is a structured collection of data. It may be anything
from a simple shopping list to a picture gallery or the vast amounts
of information in a corporate network. To add, access, and process
data stored in a computer
database, you need a database management system such as MySQL
Server.
Since computers are very good at handling large amounts of data,
database
management systems play a central role in computing, as
standalone utilities,
or as parts of other applications. MySQL is based on SQL.
A relational database stores data in separate tables rather than
putting all the
data in one big storeroom. This adds speed and flexibility. The
SQL part of
“MySQL” stands for “Structured Query Language.” SQL is the
most common standardized language used to access databases and
is defined by the ANSI/ISO SQL Standard. The SQL standard has
been evolving since 1986 and several versions exist. In this
manual, “SQL-92” refers to the standard released in 1992,
“SQL:1999” refers to the standard released in 1999, and
“SQL:2003” refers to the current version of the standard. 
MySQL software is Open Source.
Open Source means that it is possible for anyone to use and modify
the
32
software. Anybody can download the MySQL software from the
Internet and
use it without paying anything. If you wish, you may study the
source code
and change it to suit your needs. The MySQL software uses the
GPL (GNU
General Public License), The MySQL Database Server is very fast,
reliable, and easy to use.
If that is what you are looking for, you should give it a try. MySQL
Server also has a practical set of features developed in close
cooperation with our users. You can find a performance
comparison of MySQL Server with other database managers on
our benchmark page. MySQL Server was originally developed to
handle large databases much faster than existing solutions and has
been successfully used in highly demanding production
environments for several years. Although under constant
development, MySQL Server today offers a rich and useful set of
functions. Its connectivity, speed, and security make MySQL
Server highly suited for accessing databases on the Internet. 
MySQL Server works in client/server or embedded systems.
The MySQL Database Software is a client/server system that
consists of a
multi-threaded SQL server that supports different backends,
several different
client programs and libraries, administrative tools, and a wide
range of
application programming interfaces (APIs).
The Main Features of MySQL
Written in C and C++. Works on many different platforms. Uses
multi-layered server design with independent modules. Provides
transactional and nontransactional storage engines. Designed to
make it relatively easy to add other storage engines. This is useful
if you want to provide an SQL interface for an in-house database.
Uses a very fast thread-based memory allocation system. Executes
very fast joins using an optimized nested-loop join.  Implements
SQL functions using a highly optimized class library that should

33
be as fast as possible. Usually there is no memory allocation at all
after query initialization. Password security by encryption of all
password traffic when you connect to a
server. Support for large databases. We use MySQL Server with
databases that contain 50 million records. We also know of users
who use MySQL Server with 200,000 tables and about
5,000,000,000 rows. MySQL client programs can be written in
many languages. A client library
written in C is available for clients written in C or C++, or for any
language
that provides C bindings. APIs for C, C++, Eiffel, Java, Perl, PHP,
Python,Ruby, and Tcl are available, enabling MySQL clients to be
written in many languages. The Connector/ODBC (MyODBC)
interface provides MySQL support for client programs that use
ODBC (Open Database Connectivity) connections. The
Connector/J interface provides MySQL support for Java client
programs that use JDBC connections. Clients can be run on
Windows or Unix. Connector/J source is available.

What is Python IDLE ?


DLE is an integrated development environment for Python, which
has been bundled with the default implementation of the language
since 1.5.2b1. It is packaged as an optional part of the Python
packaging with many Linux distributions. It is completely written
in Python and the Tkinter GUI toolkit.
Written in: Python
Original author: Guido van Rossum
Initial release: December 22, 1998; 20 years ago

34
OBJECTIVES
 The objective of this project is to allow the management to
maintain a clean and structured detail of their quiz programme.
 Write programs utilizing modern software tools.
 Apply simple principles effectively when developing small to
medium sized projects.
 Write effective procedural code to store small to medium sized
information .Students will demonstrate a breadth of knowledge
in computer science, as exemplified in the areas of systems,
theory and software development.
 Students will demonstrate ability to conduct a research or
applied Computer Science project, requiring writing and
presentation skills which exemplify scholarly style in computer
science.
 Quiz makes students memorise quickly.
 Quiz are the one of the most underrated thing in our ES it gives
us more knowledge in small amount of questions.
 It increases our thinking capacity
 More fun while giving answers
 The proposed system should maintain all the records and should
 generate the required reports and information when required.
 To provide graphical and user-friendly interface to interact with
a
 centralized database based on client-server architecture.
 To identify the critical operation procedure and possibilities of
 simplification using modern IT tools and practices.

35
MAINTAINANCE
 The system operation is ongoing. The system monitored for the
continued performance is accordance with user requirements
and needed system modifications are incorporated. Operation
continues as long as the system can be effectively adopted to
respond to the organisation needs. When modification or
changes are identified, the system may re enter the planning
phase . The purpose of this phase is to enhance
,operate, maintain the system.

36
SALIENT FEATURES
 The program is compact in other words we can say that the
program is small and easy to carry.
 The program is edited for errors.
 The program can be run on many platforms.
 The program is structural or we can say that a programming
paradigm that facilitates the creation of programs with readable
code and reusable components.
 The program is user friendly.

SYSTEM REQUIREMENTS
 Main processor :- Pentium III and above
 Hard disk :- 1 GB
 RAM :- 4GB RAM (4GB preferable)

 Operating system:- Windows 7 to 10


 Language : python

37
SCOPE OF
IMPROVEMENT
 The program can be made simpler.
 Comments can be used in the program.
 The statements in the program can be indented.
 Blank lines and blank spaces can be used in the program
 Connecting with MYSL database can be done more properly
 So that the CSV module would be more easy and clear to uner
stand for the user
 Prizes should be included so the participants will get attracted to
the project system i.e, QUIZ MANAGEMENT SYSTEM.
 Competition should be there for the participants which will
make it more difficult because in nervous they can mark the
wrong answer or make mistakes.
 More number of question should also be added so that they
participants or the users will fell fun while attempting the
questions.
 Rounds should be made and after each round the the difficult
questions will appear.

38
Advantages of the
project
This project contains lots of question related to person .
 If some person try this quiz he will remember this for a long time
because this quiz contains some fun related questions.
 Thus, this quiz will help them to remember the answers with fun,
it will also increase the IQ of the particular person.
 In this quiz i will ask many questions related to recent times
which is also known as Current affairs , General knowledge test
will be tested , Sports related questions , Space related question
and most of the questions will be asked from the TEXT BOOKS
of class XII which can help them to prepare for their MCQ and
CBQ which comes in their BOARD EXAMS .
 These were the advantages which the user can get from this
management i.e, quiz management.
 No need of pencil pen to play this quiz game.
 We can quiz large number of employees all at once.
 It can be given without an Instructor.
 Improved overview of the workforce.
 Prizes should be included so the participants will get attracted to
the project system i.e, QUIZ MANAGEMENT SYSTEM.
 Competition should be there for the participants which will
make it more difficult because in nervous they can mark the
wrong answer or make mistakes.

39
DATA FLOW DIAGRAM
(DFD)

40
FLOW CHART

41
PYTHON MODULES
1. CLRPRINT MODULE
This clrprint is developed to print a colourful output on idle,
windows power shell and terminal. It has red, blue, green, yellow,
purple and black/white (default) colors. clrinput() includes a timeout
feature that returns None if no user input is received within a certain
amount of time.

#pip install clrprint


#install the above moudle

from clrprint import *

clrhelp() # print's available colors and usage

user_input = clrinput("input yoyr colour


please: ",clr='r') # just like input() [color
is red]
clrprint('your text',user_input,clr='red') #
just like print()
clrprint('your text',user_input,clr='yellow') #
just like print()
clrprint('your text',user_input,clr='green') #
just like print()
clrprint('your text',user_input,clr='blue')

This module is used in every user defined function and in the main
menu to make the texts colourful.

42
FOR EXAMPLE:- The colour will appear like this.

The code for this looks like this:-

The code for this looks like this:-


def main():
clrprint()

clrprint("\t\t*WELCOME TO QUIZ
MANAGEMENT SYSTEM*",clr="m")

clrprint()

43
clrprint("\t\t**KENDRIYA VIDYALAYA
CRPF YELAHANKA",clr="m")

clrprint()

clrprint("\t\t---------MAIN
MENU-----------",clr="m")

clrprint()

clrprint("\t\t-------QUIZ
SOFTWARE---------",clr="m")

clrprint()

clrprint("\t\t--------
1.QUESTIONS----------",clr="m")
clrprint()

clrprint("\t\t--------
2.SCORE--------------",clr="m")

clrprint()

clrprint("\t\t--------
3.RESULT-------------",clr="m")

clrprint()

44
2. MYSQL.CONNECTOR MODULE
MySQL is a Relational Database Management System (RDBMS)
whereas the structured Query Language (SQL) is the language used
for handling the RDBMS using commands ex- Creating, Inserting,
Updating and Deleting the data from the databases. SQL commands
are case insensitive ex- CREATE and create signify the same
command.

MySQL Connector/Python enables Python programs to access


MySQL databases, using an API that is compliant with the Python
Database API Specification v2.0 (PEP 249). It is written in pure
Python and does not have any dependencies except for the Python
Standard Library. This module does not come built-in with Python.
To install it type the below command in the terminal.
pip install mysql-connector-python

Verifying MySQL Connector/Python installation


After installing the MySQL Python connector, we need to test it to
make sure that it is working correctly and we are able to connect to
the MySQL database server without any issues.
To verify the installation, we can use the following steps:
 Open Python command line
 Type the following code
import mysql.connector
con=mysql.connector.connect(host='localho
st',user='root',
password='',database='stud')
cursor=cnx.cursor()
print(“connection established
successfully”)

45
OUTPUT
Connection establishes successfully
If you see the following output, it means that you have been
successfully installing the MySQL Connector/Python on your system.
This module is used in the user defined function def create() to create
student record and write it into a csv file and then display it to the
user.
This user defined functions with the help of mysql.connector and csv
module creates the student records and writes them into a csv files.
After these records are written into the csv file it is read from the file
and displayed.
The code looks like this:-
#Connection Code

from clrprint import*

import mysql.connector as a

con=a.connect(host="localhost",user="root
",password="")
if con.is_connected():

clrprint("succesfully connected idle


python with mysql",clr="y")

else:
clrprint("not connected")

46
3. SYS MODULE
Sys=System-specific parameters and functions

This module provides access to some variables used or maintained by


the interpreter and to functions that interact strongly with the
interpreter. It is always available.
Example-
import sys
print(sys.version)
3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929
64 bit (AMD64)]
In above example ‘sys.version’ is used which returns a string
containing the version of python interpreter with some additional
information.
The sys modules provide variables for better control over input or
output. We can even redirect the input and output to other devices.
This can be done using three variables –

 stdin
 stdout
 stderr
stdin: It can be used to get input from the command line directly. It is
used for standard input. It internally calls the ‘input()’ method. It,
also, automatically adds ‘\n’ after each sentence.

47
3. CSV MODULE
CSV (Comma Separated Values) is a simple file format used to store
tabular data, such as a spreadsheet or database. A CSV file stores
tabular data (numbers and text) in plain text. Each line of the file is a
data record. Each record consists of one or more fields, separated by
commas. The use of the comma as a field separator is the source of
the name for this file format.
For working CSV files in Python, there is an inbuilt module called
csv.

CSV READER
Here, we first open the CSV file in READ mode. The file object is
named as csvfile. The file object is converted to csv.reader object. We
save the csv.reader object as csvreader.

csvreader is an iterable object. Hence, .next() method returns the


current row and advances the iterator to the next row. Since the first
row of our csv file contains the headers (or field names), we save
them in a list called fields.

CSV WRITER
Here, we first open the CSV file in WRITE mode. The file object is
named as csvfile. The file object is converted to csv.writer object. We
save the csv.writer object as csvwriter.

In the project both csv writer and csv reader are used to write the data
into a file and the read it, further applying a loop to display the
student records to the user.

The csv module is imported and the a user defined function create()
is defined to create the student record.
This user defined functions with the help of mysql.connector and csv
module creates the student records and writes them into a csv files.

48
After these records are written into the csv file it is read from the file
and displayed.
The code for this looks like:-
def create():
cnx=mysql.connector.connect(host='loc
alhost',user='root',
password='',database='stud')
cursor=cnx.cursor()

sq='CREATE TABLE IF NOT EXISTS


Record(RollNo INT(5),Name
VARCHAR(20),CLASS INT(3))'
cursor.execute(sq)
cnx.commit()
def table():
l=[]
RollNo=int(input("Enter Roll
Number of the Student:- "))
l.append(RollNo)
Name=input("Enter Name of the
Student:- ")
l.append(Name)
CLASS=int(input("Enter the CLASS
of the Student:- "))
l.append(CLASS)
lr=(l)

49
sql="INSERT INTO
Record(ROLLNO,Name,CLASS) VALUES (%s,%s,
%s)"
cursor.execute(sql,lr)
cnx.commit()
clrprint("\nStudent record
created successfully",clr='green')

n=int(input("enter the number of


records you want to enter:- "))
for i in range(n):
table()

a='SELECT * FROM Record'


cursor.execute(a)
record=cursor.fetchall()

with
open("student.csv","w",newline='') as x:
writer = csv.writer(x)
writer.writerows(record)

f=open("student.csv","r")
for i in f:
clrprint("PRINTING RECORD
",clr='purple')
print(i)
menu()

50
PROCEDURE
1. Open the Python IDLE Compiler.
2. Type the source code.
3. Save the program.
4. Compile the code.
5. Run the code.
6. Debug the program if any error occurs.
7.Save the program after debugging.

51
DEBUGGING

52
INPUT SCREEN
The input screen for the main menu will be as follows:

53
SOURCE CODE
#Connection Code
from clrprint import*
import os
import sys
import csv
import mysql.connector as a
con=a.connect(host="localhost",user="root",pass
word="",database="answers")
if con.is_connected():
clrprint("succesfully connected idle python
with mysql",clr="y")
else:
clrprint("not connected")
cursor=con.cursor()
sq='CREATE TABLE IF NOT EXISTS Answers(Question
VARCHAR(255),Correct_options CHAR(5))'
cursor.execute(sq)
con.commit()
#----------------------------------------------
------------------------------------------
def main():
clrprint()
clrprint("\t\t*WELCOME TO QUIZ MANAGEMENT
SYSTEM*",clr="m")
clrprint()
clrprint("\t\t**KENDRIYA VIDYALAYA CRPF
YELAHANKA",clr="m")
clrprint()
clrprint("\t\t---------MAIN
MENU-----------",clr="m")
clrprint()
clrprint("\t\t-------QUIZ
SOFTWARE---------",clr="m")
clrprint()

54
clrprint("\t\t--------
1.QUESTIONS----------",clr="m")
clrprint()
clrprint("\t\t--------
2.SCORE--------------",clr="m")
clrprint()
clrprint("\t\t--------
3.RESULT-------------",clr="m")
clrprint()
main()
#----------------------------------------------
--------------------------------------------
def password():
p=input("Enter password:--")
if (p=="quiz management system"):
main()
else:
print("----wrong password please enter
the right password next time----")
password()
password()
#----------------------------------------------
--------------------------------------------
def table():
l=[]
Question=input("Enter QUESTION TO BE ASKED
TO STUDENT:- ")
l.append(Question)
Correct_options=input("Enter CORRECT ANS
OF THE QUESTION:- ")
l.append(Correct_options)
lr=(l)
sql="INSERT INTO
answers(Question,Correct_options) VALUES (%s,
%s)"
cursor.execute(sql,lr)
con.commit()

55
clrprint("\nStudent record created
successfully",clr='green')

n=int(input("Enter the Number of RECORDS You


Want to Enter:- "))
for i in range(n):
table()

a='SELECT * FROM answers'


cursor.execute(a)
answers=cursor.fetchall()

with open("student.csv","w",newline='') as
x:
writer = csv.writer(x)
writer.writerows(answers)

f=open("student.csv","r")
for i in f:
clrprint("PRINTING RECORD
",clr='purple')
print(i)
main()
#----------------------------------------------
-------------------------------------------
with open('studata.csv','w') as f:
wrt=csv.writer(f)
for i in range(6):
q=input("enter the questions:")
a=input("enter answers:")
wrt.writerow([q,a])
with open('studata.csv','r') as g:
reader=csv.reader(g)
for i in reader:
print(i)
#----------------------------------------------
-------------------------------------------
def new_game():

56
guesses = []
correct_guesses = 0
question_num = 1

for key in questions:


clrprint("-------------------------",clr="s")
print(key)
for i in options[question_num-1]:
print(i)
guess = input("Enter (A, B, C, or D):
")
guess = guess.upper()
guesses.append(guess)

correct_guesses +=
check_answer(questions.get(key), guess)
question_num += 1

display_score(correct_guesses, guesses)

# -------------------------
def check_answer(answer, guess):

if answer == guess:
clrprint("CORRECT!",clr="o")
return 1
else:
clrprint("WRONG!",clr="r")
return 0

# -------------------------
def display_score(correct_guesses, guesses):
clrprint("-------------------------",clr="s")
clrprint("RESULTS",clr="s")
clrprint("-------------------------",clr="s")

57
print("Answers: ", end="")
for i in questions:
print(questions.get(i), end=" ")
print()

print("Guesses: ", end="")


for i in guesses:
print(i, end=" ")
print()

score =
int((correct_guesses/len(questions))*100)
print("Your score is: "+str(score)+"%")

# -------------------------
def play_again():

response = input("Do you want to play


again? (yes or no): ")
response = response.upper()

if response == "YES":
return True
else:
return False
#----------------------------------------------
-----------------------------------------------
--
#the questions which will be asked:
questions={
"IDLE stands for?:":"A",
"What does the word UNGUIDED means?:":"A",
"Who is the PM of India?:":"C",
"Which is the shortest type of network?:":"D",
"NIC stands for?:":"A",
"A file which is separated by comma is ?:":"C"
}

58
#----------------------------------------------
----
#the options which will be provided are:
options=[["A.Integrated Development and
Learning Environment",
"B.Integration developed and learning
environment",
"C.Integrated developed and learning
environment",
"D.International domestic and
learning education"],
["A.Wireless connection", "B.Wired
connection","C.without any guidance", "D.None
of the above"],
["A.rahul gandhi","B.arvind
kejriwal","C.Narendra Modi","D.Amit Shah"],
["A.LAN","B.MAN","C.WAN","D.PAN"],
["A.Network Interface card",
"B.National interface card",
"C.Network International Card",
"D.Network Internal card"],
["A.Binary files",
"B.TSV files",
"C.CSV files",
"D. all of the above"]]

new_game()

while play_again():
new_game()

clrprint("Byeeeeee!",clr="m")

59
OUTPUT SCREEN

60
61
62
63
64
65
66
CSV

SQL

67
BIBLIOGRAPHY
Books
Computer Science – Textbook for Class XII
- NCERT
Computer Science with Python – Class XII
- Sumita Arora

Websites
https://www.w3schools.com/python/python_mysql_getstarted.as
https://www.geeksforgeeks.org/python-mysql/

68
THANK YOU

69

You might also like