Professional Documents
Culture Documents
Kalyanpur
Session 2022-2023
Computer Science Project File
Submitted To: Submitted By:
PROJECT BASE ON
nline
iz ame
Index
S No. Content Page No.
1) Certificate 4
2) Acknowledgement 5
3) Introduction 6
4) Source Code 7
5) Output Window 11
6) Bibliography 15
CERTIFICATE
This is to certify that <Your name here> of class XII
(STREAM) of <SchooI name> has done his/her project on
<Project name > under my supervision. He / She has
taken interest and has shown at most sincerity in
completion of this project. I certify this Project up to my
expectation & as per guidelines issued by CBSE, NEW
DELHI.
Internal Examiner
External Examiner
Acknowled
It is with pleasure that I acknowledge my sincere
gratitude to our teacher, < Teacher name > who taught
and undertook the responsibility of teaching the subject
computer science. I have been greatly benefited from
his/her classes.
My sincere thanks goes to our Principal <PrincipaI
name> who has always been a source of encouragement
and support and without whose inspiration, this project
would not have been a successful.
Finally, I would like to express my sincere appreciation
for all the other students for my batch their friendship &
the fine times that we all shared together.
Last but not least, I would like to thank all those who had
helped directly or indirectly towards the completion of
this project.
Name of student
Class
Introduction
Online Quiz game in python is a simple console
application built without the use of graphics. This project
helps in creating a online quiz game concept. In this
project we tried make sign up system for user, than after
doing proper login user can play MCQ game.
Some of the features of the program are:
1) User can Create new account to play game.
2) User can login again and again to play game.
3) After completion of game user score is automatically
stores in database.
4) We can check scores of all the users.
5) User can navigate in game with main menu.
Source Code
import mysql.connector
mydb=mysql.connecto ost="localhost",us
er="root",
de
mycursor=mydb.cursor()
nm=input(”En user name:")
Pass
em=inp
er(user
lues('{}
"Id Created")
lse:
Password does not match")
def
mycursor=myd
nm=input("Enter user name:")
pas=input("Enter Password:")
mycursor.execute("select * from user where
username='{}' and password='{}'".format(nm,pas))
myrecords=mycursor.fetchone()
global user
user=myrecords[1]
print(“Welcome to game: ",myrecords[1])
start=input("Press 'Y' to start game and any
other key to log out:”)
if start==“Y“:
print("Let's Start")
game()
else:
print(“Thanks for visiting us, You are
log out")
def score():
mycursor=mydb.cursor()
def game():
mycursor=mydb.cursor()
mycursor.execute(“Select * from mcq")
score=0
i=1
while i<=5:
myrecords=mycursor.fetchone()
print("Question“,myrecords[0],":",myrecords[1])
print("Options")
print(myrecords[2])
print(myrecords[3])
print(myrecords[4])
print(myrecords[5])
ans=input(”Enter correct option:")
if ans== myrecords[6] :
print(”Correct Answer“)
score=score+10
print(”Points:",score)
else:
print("Wrong Answer“)
print(”Points:”,score)
i=i+1
mycursor.execute("update user set score={}
where username='{}'“.format(score,user))
mydb.commit()
if score==50:
print(“You win”)
else:
a=input("Press Y to play again or N to
main menu:“)
if a=="Y":
game()
else:
main()
def main():
print("\nWelcome to Online Quiz Game")
print("1.New Account \n2.Log in\n3.Check
your Score”)
ch=int(input("Enter your Choice:"))
if ch==1:
signup()
elif ch==2:
login()
elif ch==3:
score()
else:
print("Enter correct choice")
main()
main()
Output
Main menu:
Tables in database
Book Name
Preeti Arora
Website
YO