0% found this document useful (0 votes)
102 views13 pages

Computer Project Final

This document describes a student project to create a quiz game using Python and SQL connectivity. The project involves setting up questions in a database, displaying questions to players, tracking scores, and providing a user-friendly interface. It discusses the objectives, software and hardware used, code structure, inputs/outputs, limitations, and acknowledges help from textbooks and websites. The student created the quiz game to fulfill requirements for the CBSE Board Exam in Computer Science.

Uploaded by

Aviraj Roy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views13 pages

Computer Project Final

This document describes a student project to create a quiz game using Python and SQL connectivity. The project involves setting up questions in a database, displaying questions to players, tracking scores, and providing a user-friendly interface. It discusses the objectives, software and hardware used, code structure, inputs/outputs, limitations, and acknowledges help from textbooks and websites. The student created the quiz game to fulfill requirements for the CBSE Board Exam in Computer Science.

Uploaded by

Aviraj Roy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

AISSCE

DELHI PUBLIC SCHOOL


RUBY PARK

TOPIC: QUIZ GAME USING PYTHON SQL


CONNECTIVITY

NAME- SHUVRADEEP BERA


CLASS- 12 I
BOARD ROLL NO-
CERTIFICATION:

This is to certify that the project entitled:


“QUIZ GAME PROJECT USING PYTHON MYSQL
CONNECTIVITY” is a record of the bona fide work of :

AVIRAJ ROY (12 I),SHUVRADEEP BERA(12I),DWAIPAYAN GON


BANERJEE(12I) and SWASTIK KARMOKAR(12I)

In partial fulfilment of the requirements in COMPUTER


SCIENCE provided by CBSE for the CBSE BOARD EXAM
(AISSCE) 2023-24 in the school

DELHI PUBLIC SCHOOL, RUBY PARK, KOLKATA

DATE:

____________ _____________
INTERNAL EXAMINER EXTERNAL EXAMINER
ACKNOWLEDGEMENT:

I would like to express my gratitude to my Computer Science


teacher Mrs. Dhrita Adhya for her valuable assistance,
guidance and support for this project.
I wish to express my deep gratitude and my sincere thanks to
the Principal, Ms. Jayati Chaudhuri, of DELHI PUBLIC SCHOOL,
RUBY PARK, KOLKATA for the facilities provided by my
institution.

OBJECTIVE OF THE CODE:

The use of computerized quizzes is highly recommended for


any instructor teaching a course that is either large in size
(with a typical lecture format) or that requires that students
to engage in a significant amount of assigned readings.
Students appear to benefit
from the use of such computerized quizzes as they
become actively engaged in the course material and
study with greater frequency.
LANGUAGE AND SOFTWARE TOOL USED:

Front End: Python IDLE, Spyder, Operating System: Windows


XP
Back End: SQL SERVER 2022 (Version:
16.0.1000.6)

STRUCTURE OF THE PROJECT:

A) Proposed System:-

This project is based on popular reality quiz shows where a


player has to answer some questions based on various
themes. The player gets to choose the correct answer from
four different sets of options. If the player chooses the right
option he gets one point and proceeds. If the option was
wrong no points will be allotted.

B) Module Description:

i) Question setting zone:

This section of the project deals with setting up the questions


for the quiz. Here the quiz questions will be set up based upon
the topics chosen by the user.
ii) Quiz Portal:

This is the portal where the entire quiz game will be held. The
player will be shown the questions and he will have to answer
by entering the option.

iii) “question” database:

This database stores the questions, options to be displayed


and the correct option.

C) HARDWARE REQUIREMENT:

•i-5 processor based computer


•memory-RAM: 8GB(or more)
•Hard Drive:500GB

D) SOFTWARE REQUIREMENTS:

•OS Windows 8
•SQL Server (8.0.26)

E). ADVANTAGES OF THE PROJECT:


The benefits of the program are:-
• The design is simple and user friendly
• There is no limit of entering questions
• Prevents the problem of hardcopy
• Efficient for conducting quizzes at a basic level
SOURCE CODE
import sys
import mysql.connector
import random
mydb=mysql.connector.connect(host= "localhost" ,user=
"root", password="s#bera@2005",database= "quiz")
mycursor=mydb.cursor()
def Home():
f=1
while f!=3:
print("Welcome to Quiz")
print("********************")
print("1. Enter Questions")
print("2. Take Quiz")
print("3. Exit")
f=int(input("Enter your choice: "))
if f==1:
Question()
elif f==2:
Quiz()
elif f==3:
print("Exiting the Quiz")
mycursor.close()
mydb.close()
sys.exit();
else:
Home()
def Question():
ch='Y'
while ch=='Y' or ch=='y':
print("Welcome to Question Portal")
print("***********************")
q=input("Enter the question :")
op1=input("Enter the option 1 :")
op2=input("Enter the option 2 :")
op3=input("Enter the option 3 :")
op4=input("Enter the option 4 :")
ans=0
while ans==0:
op=int(input("Which option is correct answer (1,2,3,4)
:"))
if op==1:
ans=op1
elif op==2:
ans=op2
elif op==3:
ans=op3
elif op==4:
ans=op4
else:
print("Please choose the correct option as answer")
mycursor.execute("Select * from question")
data=mycursor.fetchall()
qid=(mycursor.rowcount)+1
mycursor.execute("Insert into question values
(%s,%s,%s,%s,%s,%s,%s)",(qid,q,op1,op2,op3,op4,ans))
mydb.commit()
ch=input("Question added successfully.. Do you want to
add more (Y/N)")
Home()
def Quiz():
print("Welcome to Quiz portal")
print("***********************")
mycursor.execute("Select * from question")
data=mycursor.fetchall()
name=input("Enter your name :")
rc=mycursor.rowcount
noq=int(input("Enter the number of questions to attempt
(max %s):"%rc))
l=[]
while len(l)!=noq:
x=random.randint(1,rc)
if l.count(x)>0:
l.remove(x)
else:
l.append(x)
print("Quiz has started")
c=1
score=0
for i in range(0,len(l)):
mycursor.execute("Select * from question where
qid=%s",(l[i],))
ques=mycursor.fetchone()
print("-------------------------------------------------------------------
-------------------------")
print("Q.",c,":
",ques[1],"\nA.",ques[2],"\t\tB.",ques[3],"\nC.",ques[4],"\t\t
D.",ques[5])
print("-------------------------------------------------------------------
-------------------------")
c+=1
ans=None
while ans==None:
choice=input("Answer (A,B,C,D) :")
if choice=='A' or choice=='a':
ans=ques[2]
elif choice=='B' or choice=='b':
ans=ques[3]
elif choice=='C' or choice=='c':
ans=ques[4]
elif choice=='D' or choice=='d':
ans=ques[5]
else:
print("Kindly select A,B,C,D as option only")
if ans==ques[6]:
print("Correct")
score=score+1
else:
print("Incorrect.. Correct answer is :",ques[6])
print("Quiz has ended !! Your final score is :",score)
input("Press any key to continue")
Home()

Home()

INPUT AND OUTPUT RESULTS:


LIMITATIONS
• Does not have attractive graphics
• This software can’t be accessed from any other computer
where the database is not present
BIBLIOGRAPHY

While making this project I have taken the help of the


following books and sites:
• COMPUTER SCIENCE WITH PYTHON CLASS XII – SUMITA
ARORA
• www.geeksforgeeks.com
• www.stackoverflow.com
• www.youtube.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy