Project File Ip

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

SAGAR PUBLIC SCHOOL, GANDHI NAGAR,

BHOPAL

SESSION- 2024-25
CLASS XII

ALL INDIA SENIOR SCHOOL CERTIFICATE


EXAMINATION

INFORMATICS PRACTICES (065)

PROJECT FILE BASED ON

QUIZ Application Using


Python

SUBMITTED TO SUBMITTED BY

Ms. Faraz Rasheed Name: Anshumaan Mishra


Class: XII- Science
Board Roll No.:

Student Database System


CERTIFICATE

This is to certify that Anshumaan Mishra, Roll no.


of class 12th ‘Science’ has successfully completed his Project file
of IP (Informatics Practices (065)) for the AISSCE (All India
Senior School Certificate Examination) as prescribed by CBSE
(Central Board of Secondary Education) in the session 2024-
2025.

________________________________ ______________________________

Signature of Internal Examiner Signature of External Examiner

___________________________ __________________________

School Stamp Signature of Principal

Student Database System


ACKNOWLEDGEMENT
I would like to express my sincere thanks of gratitude to The
Principal, Ms. Alpa Prabhu, The Management and my teacher
Ms. Faraz Rasheed who gave me the opportunity to work on this
wonderful project named “Mindscape Rumble”, which helped me
in doing research and I come to know about many new things.
I would also like to thank my parents and friends who helped me
in finalizing this project.

Content

Student Database System


S.No Topic____ Page
1. Introduction 1
2. Hardware and 4
Software requirement
3. Creating Login panel 5
4. Creating Main panel 7
4. Creating Editing panel 14
6. Creating Table 17
7. Output 20
8. Bibliography 23

INTRODUCTION
Python
Python is an interpreted, object-oriented, high-level programming
language with dynamic semantics. Its high-level built in data structures,

Student Database System


combined with dynamic typing and dynamic binding, make it very
attractive for Rapid Application Development, as well as for use as a
scripting or glue language to connect existing components together.
Python's simple, easy to learn syntax emphasizes readability and
therefore reduces the cost of program maintenance. Python supports
modules and packages, which encourages program modularity and code
reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major
platforms, and can be freely distributed.
Often, programmers fall in love with Python because of the increased
productivity it provides. Since there is no compilation step, the edit-test
debug cycle is incredibly fast. Debugging Python programs is easy: a
bug or bad input will never cause a segmentation fault. Instead, when the
interpreter discovers an error, it raises an exception. When the program
doesn't catch the exception, the interpreter prints a stack trace. A source
level debugger allows inspection of local and global variables,
evaluation of arbitrary expressions, setting breakpoints, stepping through
the code a line at a time, and so on. The debugger is written in Python
itself, testifying to Python's introspective power. On the other hand,
often the quickest way to debug a program is to add a few print
statements to the source: the fast edit-test-debug cycle makes this simple
approach very effective.

MySQL
MySQL is the world’s second most widely used Open-source Relational
Database Management System (RDBMS).It is named after its co-
founder Michael Widenius’s daughter, MySQL(Structured Query
Language) is a database computer language designed for managing data
in relational database management systems.

Student Database System


It is a fast, easy-to-use RDBMS being used for many small and big
businesses. Its development began in 1994 by a Swedish company,
MySQL AB. MySQL is a leading open-source, multi-user DataBase
Management System. It is used by Wikipedia, YouTube, Facebook.
These sites manage millions of queries each day.
MySQL runs on more than 20 platforms including Linux, Windows,
MAC OS X, Unix, Netware. Sun Microsystems acquired MySQL AB in
2008. Sun was bought by Oracle in 2010. So today, Oracle Corporation
is the owner of the MySQL database. It is developed in C/C++. The
developers release minor updates of the MySQL Server approximately
every two months.
Major features as available in MySQL 5.1.73 :

• Cross- platform support


• Online DDL when using the InnoDB Storage Engine.
• Information schema
• Performance schema
• A set of SQL mode options to control runtime behaviour, including
a strict mode to better adhere to SQL standards.
• Query caching
• Embedded database library
• Unicode support
• Multiple storage engines.

CSV :
A comma-separated values (CSV) file is a delimited text file that uses
a comma to separate values. 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

Student Database System


format. A CSV file typically stores tabular data (numbers and text) in
plain text, in which case each line will have the same number of fields.

The CSV file format is not fully standardized. Separating fields with
commas is the foundation, but commas in the data or embedded line
breaks have to be handled specially. Some implementations disallow
such content while others surround the field with quotation marks,
which yet again creates the need for escaping if quotation marks are
present in the data.

Hardware and Software Requirements


System Requirements for Python:
OS: Windows, macOS, or Linux (most modern distributions)
Processor: Any modern processor (Intel, AMD, ARM, etc.)
Memory (RAM): At least 512 MB of RAM (1 GB or more is recommended)
Disk Space: 512GB

Student Database System


Python Version: 3.6+ (latest stable release is preferred for new projects)

System Requirements for MySQL:


OS: Windows, macOS, or Linux (any modern distribution)
Processor: Any modern processor (Intel, AMD, ARM, etc.)
Memory (RAM): At least 1 GB of RAM (2 GB or more recommended for heavy workloads)
Disk Space: 512GB
MySQL Version: The latest stable version (e.g., 8.x or 5.7) is recommended.

System requirements for running MySQL + Python:


Python: Version 3.6 or newer
MySQL Server: Version 5.7 or newer
Connector/Client:

Python
import mysql.connector as sqltor
import sys
import random
import pandas as pd
import matplotlib.pyplot as plt
mydb = sqltor.connect(
host="localhost",
user="root",
password="root",
database='quiz')
mycursor=mydb.cursor()

Student Database System


#Main Program Layout
def Home():
print('''Welcome To Quiz.io
1.Enter Questions
2.Take Quiz
3.Question Bank
4.Exit
''')
f=int(input('Enter Your Choice:'))
print()
if f==1:
pass_word=input('Enter Teacher Password:')
if pass_word=='Welcome':
Format_Ques()
else:
print('You have entered an invalid password please try again....')
print()
Home()
elif f==2: #To take the Quiz
Quiz()
elif f==3: #To see the Questions
Ques_Bank()
elif f==4: #To exit
print('Exiting The Quiz...')
mydb.commit()
mycursor.close()
mydb.close()
sys.exit()
else: #Invalid input
print('Your have entered an invalid input please try again')
print()
Home()

#Function to feed Questions into the System


def Format_Ques():
ch=int(input('''What do you wish to format in the Question_bank
1)Add Questions
2)Update Questions
3)Delete Questions
4)Exit

Student Database System


Enter your Choice:'''))
print()

#Entering Questions
if ch==1:
Add_Ques()
elif ch==2:
Update_Ques()
elif ch==3:
Remove_Ques()
if ch==4:
Home()
else:
print('Please Enter a valid response')
ch=input('Shall we Start/Continue(Yes,No or Go Back):')

#Function to take the Quiz


def Quiz():
print('Welcome To Quiz Portal')
print()
mycursor.execute("select * from ques_bank")
data=mycursor.fetchall()
st_id=input('Enter your Scholar no.')
name=input('Enter your Name:')
rc=mycursor.rowcount
noq=int(input('Enter the number of questions to attempt:'))
if rc>=noq:
l=[]
while len(l)<noq:
x=random.randint(0,rc-1)
if x not in l:
l.append(x)
print('Quiz has started')
c=1
score=0
for i in l:
question=data[i]
print()
print('Q.',question[1]) # Display the question text
print('A.',question[2],'\t\tB.',question[3], '\t\tC.',question[4],'\t\
tD.',question[5])

Student Database System


print()
c+=1
ans=None
while ans==None:
choice=input('Answer(A,B,C,D):')
print()
if choice=='A' or choice=='a':
ans=question[2]
elif choice=='B' or choice=='b':
ans=question[3]
elif choice=='C' or choice=='c':
ans=question[4]
elif choice=='D' or choice=='d':
ans=question[5]
else:
print('Kindly select A,B,C,D as options only')
if ans==question[6]:
print('Correct!!')
score=score+1
continue
else:
print(f'Sorry but your answer is incorrect...the correct answer is
{question[6]}')
print()
continue
print('The Quiz has ended!!...',name,',Your final score
is=',score,'Points!!')
print()
mycursor.execute('insert into
student_score(st_id,name,ques_attempt,score) values(%s,%s,%s,%s) on
duplicate key update score=score and ques_attempt=ques_attempt',
(st_id,name,noq,score))
choice=int(input('''What do You wish to see
1.Percentage
2.Graph
3.Exit

Enter Your Choice'''))


if choice==1:
percentage=(score//noq)*100
print('You got',percentage,'%')

Student Database System


elif choice==2:
print()
Graph()
print()
elif choice==3:
print()
print('Exiting Quiz')
else:
print('Please Enter a Valid Input')
input('Press ENTER to continue')
print()
Home()
else:
print('''You have entered more than possible questions asked in the
quiz...
Please enter maximum''',rc,'number of questions to attempt')
print()
Quiz()

def Graph():
print()
mycursor.execute('select score from student_score')
mark_obt=list(mycursor.fetchall())
mycursor.execute('select ques_attempt from student_score')
ques_attempt=list(mycursor.fetchall())
plt.plot(mark_obt,ques_attempt)
plt.xlabel=('Marks obtained')
plt.ylabel=('Question attempted')
plt.title='Performance chart'
plt.show()

mycursor.execute('select ques from ques_bank')


ques=list(mycursor.fetchall())
mycursor.execute('select opt1 from ques_bank')
opt1=list(mycursor.fetchall())
mycursor.execute('select opt2 from ques_bank')
opt2=list(mycursor.fetchall())
mycursor.execute('select opt3 from ques_bank')
opt3=list(mycursor.fetchall())
mycursor.execute('select opt4 from ques_bank')
opt4=list(mycursor.fetchall())

Student Database System


mycursor.execute('select ans from ques_bank')
ans=list(mycursor.fetchall())
Dict={'Questions':ques,'Option 1':opt1,'Option 2':opt2,'Option 3':opt3,'Option
4':opt4,'Answers':ans}
Question_bank=pd.DataFrame(Dict)
rc=int(mycursor.rowcount)
Question_bank.index=range(1,rc+1)
pd.set_option('display.max_columns',None)
pd.set_option('display.max_rows',None)
Question_bank.head()

def Ques_Bank():
print('Welcome to Question Bank')
print()
f=int(input('''What do you wish to refer from the Question Bank
1.Full Table
2.Size
3.Shape
4.A Certain question
5.Exit

Enter your choice no.:'''))


print()
if f==1:
print(Question_bank)
print()
input('Press ENTER to continue')
print()
Ques_Bank()
elif f==2:
print(Question_bank.size)
print()
input('Press ENTER to continue')
print()
Ques_Bank()
elif f==3:
print(Question_bank.shape)
print()
input('Press ENTER to continue')
print()
Ques_Bank()

Student Database System


elif f==4:
num=int(input('Please enter which question do you want to view:'))
rc=mycursor.rowcount
input('Press ENTER to continue')
print()
if num<=rc:
mycursor.execute('select * from ques_bank where qid=%s',(num,))
print(mycursor.fetchall())
print()
input('Press ENTER to continue')
print()
Ques_Bank()
else:
print('please enter a valid question no.')
print()
Ques_Bank()
elif f==5:
print()
input('Press ENTER to Continue')
print()
Home()

def Add_Ques():
print('Welcome To Question Portal')
ques=str(input('Enter Question:'))
print()
opt1=str(input('Enter Option 1:'))
print()
opt2=str(input('Enter Option 2:'))
print()
opt3=str(input('Enter Option 3:'))
print()
opt4=str(input('Enter Option 4:'))
print()

#Choosing the Answer


ans=None
while(1):
op=int(input('Enter Correct Option No.='))
if op==1:
ans=opt1

Student Database System


break
elif op==2:
ans=opt2
break
elif op==3:
ans=opt3
break
elif op==4:
ans=opt4
break
else:
print('Please choose the Correct Option as Answer')

#Using Connection to feed questions into the Database


mycursor.execute("insert into ques_bank(ques,opt1,opt2,opt3,opt4,ans)
values(%s,%s,%s,%s,%s,%s)",(ques,opt1,opt2,opt3,opt4,ans))
mydb.commit()
choice=str(input('Question added successfully..Do you want to add
more(Yes/No):'))
if choice=='yes' or'YES' or 'yes':
print()
Add_Ques()
elif choice=='No' or 'NO' or 'no':
print()
Format_Ques()
else:
print('Pleae enter a valid input')
print()
Add_Ques()

def Update_Ques():
print('Welcome To Question Portal')
print()
print('Select your question which you want to update from the bank')
print(Question_bank)
print()
up_ques=int(input('Enter the question no.that you want to update in the
Question Bank:'))
mycursor.execute('select ques from ques_bank where qid=(%s)',
(up_ques,))
print('''Your Selected Question:

Student Database System


''',mycursor.fetchall())
print()
choice=int(input('''What do you wish to do:
1.Proceed
2.Re-Select Question
3.Exit

Enter Your Choice:'''))


if choice==1:
print()
if up_ques<=rc:
opt1=str(input('Enter Option 1:'))
print()
opt2=str(input('Enter Option 2:'))
print()
opt3=str(input('Enter Option 3:'))
print()
opt4=str(input('Enter Option 4:'))
print()
#Choosing the Answer
ans=None
while(1):
op=int(input('Enter Correct Option No.='))
if op==1:
ans=opt1
break
elif op==2:
ans=opt2
break
elif op==3:
ans=opt3
break
elif op==4:
ans=opt4
break
else:
print('Please choose the Correct Option as Answer')
op=int(input('Enter Correct Option No.='))

#Using Connection to feed questions into the Database

Student Database System


mycursor.execute('update ques_bank set
opt1=(%s),opt2=(%s),opt3=(%s),opt4=(%s),ans=(%s) where qid=(%s)',
(opt1,opt2,opt3,opt4,ans,up_ques))
print('Your Question has been updated Please check Question bank for
more info...')
print()
input('Press ENTER to continue')
Update_Ques()
else:
print('Your requested question does not exist')
Update_Ques()
elif choice==2:
print()
Update_Ques()
elif choice==3:
print()
Format_Ques()
else:
print('Please Enter a Valid Input')
print()
Update_Ques()

def Remove_Ques():
print('Welcome to Question Portal')
print()
print('select the Question which you want to remove from the bank')
print(Question_bank)
print()
rem_ques=int(input('Enter the question no. that you want to remove from
the Question Bank'))
mycursor.execute('select ques from ques_bank where qid=(%s)',
(rem_ques,))
print('''Your Selected Question:
''',mycursor.fetchall())
choice=int(input('''What do you wish to do:
1.Proceed
2.Re-Select Question
3.Exit

Enter Your Choice:'''))


if choice==1:

Student Database System


print()
if rem_ques<=rc:
mycursor.execute('delete from ques-bank where qid=(%s)',(rem_ques,))
print('Question has been Removed from the Question Bank')
else:
print('Your requestd question does not exist')
Remove_Ques()
elif choice==2:
Remove_Ques()
elif choice==3:
Format_Ques()
else:
print('Please Enter a Valid Input')
print()
Remove_Ques()
Home()

Student Database System


BIBLIOGRAPHY

The information in this project has been attained from the following
sources:

1. BOOKS :

✓ Informatics Practices Author-Sumita Arora


Publisher-Dhanpat Rai &Co.

2.WEBSITES :
✓ https://www.python.org/
✓ https://www.w3schools.com/
✓ https://www.pandas.org/
✓ https://www.pyplot.org/
✓ https://www.numpy.com/
✓ https://www.DataVisualisation.com/
✓ https://www.kaggle.com
✓ https://www.mysqltutorial.org/

Student Database System

You might also like