0% found this document useful (0 votes)
13 views26 pages

Computer Science Investigatory Project by Aditya Sharma

Class 12th - Computer Science, CBSE Investigatory Project on JEE Question Paper Management System using Python and MySQL.

Uploaded by

Aditya Sharma
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)
13 views26 pages

Computer Science Investigatory Project by Aditya Sharma

Class 12th - Computer Science, CBSE Investigatory Project on JEE Question Paper Management System using Python and MySQL.

Uploaded by

Aditya Sharma
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/ 26

COMPUTER SCIENCE PROJECT

ON
JEE QUESTION PAPER
MANAGEMENT SYSTEM

ACADEMIC YEAR – 2024-25


NAME – ADITYA SHARMA
CLASS – XII
SECTION – B
ROLL NO. – 4
SUBJECT CODE – 083

PROJECT GUIDE: MR. SUNNY TRIBEDI


TEACHER (C.S.), AMRITA VIDYALAYAM
KOLKATA

1
CERTIFICATE

This is to certify that the project entitled “Jee Question Paper Management System”
submitted by “Aditya Sharma” (Registration No.: ___________________________
Year: _______) to Amrita Vidyalayam, Kolkata, is Computer Science Project work
carried out by him/her under our supervision and guidance. The project work has been
successfully completed, partially fulfilling the requirements of the regulations related
to the nature of the Computer Science Practical Examination conducted by CBSE
during the academic year 2024-25.

Teacher’s Signature Principal’s Signature

External Examiner’s Signature

2
GROUP MEMBERS
• ADITYA SHARMA
• ARASHI SINGH
• RITAM DAS

3
CONTENTS
S. NO. TOPICS PAGE NO.
1 ACKNOWLEDGMENT 5

2 INTRODUCTION 6

3 OBJECTIVES OF THE PROGRAM 7

4 DESCRIPTION OF THE PROGRAM 8–9

5 ALGORITHM 10 – 11

6 SYSTEM REQUIREMENTS 12

7 SOURCE CODE 13 – 19

8 OUTPUT 20 – 22

9 USES OF THE SOFTWARE 23

10 LIMITATIONS OF THE SOURCE CODE 24

11 CONCLUSION 25

12 BIBLIOGRAPHY 26

4
ACKNOWLEDGMENT
I would like to express my sincere gratitude to all those who
contributed to the successful completion of my project, "JEE Question
Paper Management".

First and foremost, I would like to thank my computer science


teacher, Mr. Sunny Tribedi, for their invaluable guidance,
encouragement, and continuous support throughout this project. Their
expertise and insights have been instrumental in shaping this project
into its final form.

I am also deeply grateful to my school principal, Ms. Priya Nair, for


providing the necessary resources and infrastructure to carry out this
project.

I would like to acknowledge my classmates and friends for their


constructive feedback and constant motivation, which kept me
focused during the development process.

Finally, I would like to thank my parents and family members for


their unwavering support and belief in my abilities, which gave me
the confidence to complete this project successfully.

Thank you all for your invaluable contributions.

5
INTRODUCTION
The software developed for this project is a "JEE Question Paper
Management System" which allows users to manage, add, update,
fetch, and delete questions related to JEE examination preparation.
The system is implemented using Python and MySQL as the database
management system, ensuring ease of use, secure login, and an
intuitive interface for interacting with the database.

This system also incorporates user authentication, allowing students


to register and log in before accessing the JEE question management
features. The software offers functionalities for handling questions
based on different subjects such as Mathematics, Physics, Chemistry,
and English, with support for categorizing questions by difficulty
level. Moreover, it includes a test paper generation feature that
enables automatic generation of a customized question paper with
user-specified difficulty settings.

6
OBJECTIVES OF THE PROGRAM
• To implement a user authentication system with the ability to
register, login, and store credentials securely.

• To allow users to add new questions to the database, along with


their answers and difficulty levels.

• To fetch existing questions from the database and display them


in an organized manner.

• To provide functionality for updating and deleting questions,


ensuring proper maintenance of the question bank.

• To offer the ability to generate a customized JEE question paper


with a specific number of questions from each difficulty level.

• To maintain a structured and accessible database with relevant


features for JEE preparation.

7
DESCRIPTION OF THE PROGRAM
• User Management: The user management system allows for user
registration and login. After successful login, users can access the
question management features.

• Users can register by providing a unique username and


password.

• After registration, users can log in to the system by entering


their credentials. If the credentials match those stored in the
database, the user is granted access to the system.

• JEE Question Management: Once logged in, users can interact


with the database of JEE questions. The following functionalities
are provided:

• Add Question: Users can add questions to the system along


with the correct answer and difficulty level (Easy, Medium,
Hard).

• Fetch Question: Users can view all questions stored in the


database, along with their subject, question text, answer, and
difficulty level.

• Update Question: Users can update the content of any existing


question by specifying the question ID.

8
• Delete Question: Users can delete any question from the
database. Once deleted, the remaining questions are displayed to
ensure that the system remains organized.

• Generate Test Paper: Users can specify the number of


questions to be included from each difficulty level to generate a
custom test paper.

• Exit The System: User can end the program and exit from it.

9
ALGORITHM
1. Login and Registration:

• Ask the user to choose between login and registration.

• If the user selects registration, input the username and password,


check for uniqueness, and save to the database.

• If the user selects login, verify the credentials against the


database.

2. Add Question:

• Display the list of subjects available.

• Prompt the user to select a subject.

• Input the question, answer, and difficulty level.

• Store the question in the database.

3. Fetch Question:

• Retrieve all questions from the database along with their details.

• Display the list of questions in a tabular format.

4. Update Question:

• Display all available questions.

• Prompt the user to select a question ID.

• Allow the user to modify the question, answer, and difficulty


level.
10
• Update the question in the database.

5. Delete Question:

• Display all available questions.

• Prompt the user to select a question ID.

• Delete the selected question from the database.

6. Generate Test Paper:

• Retrieve questions based on the subject and difficulty.

• Prompt the user to specify the number of questions for each


difficulty level.

• Randomly select the specified number of questions and display


them.

7. Exit:
• Disconnects from the Main Server and closes the database.
• Exits from the Program.

11
SYSTEM REQUIREMENTS
• Hardware:

• Processor: Intel i3 or higher.

• RAM: 4GB minimum.

• Hard Disk Space: 1GB free space.

• Software:

• Python 3.x

• MySQL Server

• Python libraries:

o mysql.connector

o tabulate

o textwrap

o random

• Operating System:

• Windows, macOS, or Linux.

12
SOURCE CODE
import mysql.connector
from tabulate import tabulate
import textwrap
import random

def wrap_text(text, width=50):


"""Wrap text to a fixed width."""
return "\n".join(textwrap.wrap(text, width))

def create_user_database_and_table(cursor):
"""Creates a database and a users table if not already present."""
cursor.execute("CREATE DATABASE IF NOT EXISTS user_management")
cursor.execute("USE user_management")
cursor.execute("""
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL
)
""")

def user_login_system(cursor, conn):


"""Handles user login and registration functionality."""
create_user_database_and_table(cursor)

print("\n=== User Login System ===")

while True:
print("1. Login")
print("2. Register")
print("3. Exit")
choice = input("Enter your choice: ")

if choice == '1':
username = input("Enter username: ")
password = input("Enter password: ")
cursor.execute("SELECT * FROM users WHERE username = %s AND password =
%s", (username, password))
user = cursor.fetchone()
if user:
print(f"Welcome, {username}! Login successful.")
return True
else:
print("Invalid username or password. Please try again.")

elif choice == '2':

13
username = input("Enter a new username: ")
password = input("Enter a new password: ")

try:
cursor.execute("INSERT INTO users (username, password) VALUES (%s, %s)",
(username, password))
conn.commit()
print("Registration successful. You can now log in.")
except mysql.connector.Error as err:
print(f"Error: {err}. Username may already exist.")

elif choice == '3':


print("Exiting user login system.")
return False

else:
print("Invalid choice. Please try again.")

def create_database_and_tables(cursor):
"""Creates a database and tables for storing subjects and questions."""
cursor.execute("CREATE DATABASE IF NOT EXISTS jee_management")
cursor.execute("USE jee_management")
cursor.execute("""
CREATE TABLE IF NOT EXISTS subjects (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL UNIQUE
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS questions (
id INT AUTO_INCREMENT PRIMARY KEY,
subject_id INT,
question TEXT,
answer TEXT,
difficulty VARCHAR(10),
FOREIGN KEY (subject_id) REFERENCES subjects(id)
)
""")
subjects = ["Mathematics", "Physics", "Chemistry", "English"]
for subject in subjects:
cursor.execute("INSERT IGNORE INTO subjects (name) VALUES (%s)", (subject,))

def add_question(cursor, conn):


"""Adds a new question to the database."""
cursor.execute("SELECT * FROM subjects")
subjects = cursor.fetchall()

print("\nSelect a subject:")
for idx, subject in enumerate(subjects, 1):
print(f"{idx}. {subject[1]}")

14
subject_choice = input("\nEnter subject choice number: ")
if not subject_choice.isdigit() or int(subject_choice) not in range(1, len(subjects) + 1):
print("Invalid choice. Please try again.")
return
subject_choice = int(subject_choice)
subject_id = subjects[subject_choice - 1][0]

question = input("Enter the question: ")


answer = input("Enter the answer: ")

print("Select the difficulty:")


print("1. Easy")
print("2. Medium")
print("3. Hard")
difficulty_choice = input("Enter difficulty choice number: ")
difficulties = ["Easy", "Medium", "Hard"]
if not difficulty_choice.isdigit() or int(difficulty_choice) not in range(1, 4):
print("Invalid choice. Please try again.")
return
difficulty = difficulties[int(difficulty_choice) - 1]

cursor.execute("""
INSERT INTO questions (subject_id, question, answer, difficulty)
VALUES (%s, %s, %s, %s)
""", (subject_id, question, answer, difficulty))
conn.commit()
print("Question added successfully.")

def fetch_question(cursor):
"""Fetches and displays all available questions in a formatted table."""
cursor.execute("""
SELECT q.id, s.name AS subject, q.question, q.answer, q.difficulty
FROM questions q
JOIN subjects s ON q.subject_id = s.id
""")
questions = cursor.fetchall()
if not questions:
print("No questions available.")
return

formatted_questions = [
(qid, wrap_text(subject), wrap_text(question), wrap_text(answer), difficulty)
for qid, subject, question, answer, difficulty in questions
]

headers = ["ID", "Subject", "Question", "Answer", "Difficulty"]


print(tabulate(formatted_questions, headers, tablefmt="grid"))

def update_question(cursor, conn):

15
"""Updates an existing question in the database."""
cursor.execute("""
SELECT q.id, q.question, q.answer, q.difficulty
FROM questions q
""")
questions = cursor.fetchall()
if not questions:
print("No questions available to update.")
return

formatted_questions = [
(qid, wrap_text(question), wrap_text(answer), difficulty)
for qid, question, answer, difficulty in questions
]

print("\n=== Available questions to update ===")


print(tabulate(formatted_questions, headers=["ID", "Question", "Answer", "Difficulty"],
tablefmt="grid"))
question_id = input("\nEnter the ID of the question to update: ")
if not question_id.isdigit():
print("Invalid ID. Please try again.")
return
question_id = int(question_id)

cursor.execute("SELECT question, answer, difficulty FROM questions WHERE id = %s",


(question_id,))
question_data = cursor.fetchone()

if not question_data:
print("Invalid ID. Question not found.")
return

print("\nCurrent Question:", question_data[0])


print("Current Answer:", question_data[1])
print("Current Difficulty:", question_data[2])

new_question = input("Enter new question (leave empty to keep current): ") or


question_data[0]
new_answer = input("Enter new answer (leave empty to keep current): ") or
question_data[1]

print("\nSelect new difficulty:")


print("1. Easy")
print("2. Medium")
print("3. Hard")
difficulty_choice = input("Enter difficulty choice number: ")
difficulties = ["Easy", "Medium", "Hard"]
while difficulty_choice not in ['1', '2', '3']:
print("Invalid choice. Please try again.")
difficulty_choice = input("Enter difficulty choice number: ")

16
new_difficulty = difficulties[int(difficulty_choice) - 1]

cursor.execute("""
UPDATE questions
SET question = %s, answer = %s, difficulty = %s
WHERE id = %s
""", (new_question, new_answer, new_difficulty, question_id))
conn.commit()
print("Question updated successfully.")

def delete_question(cursor, conn):


"""Deletes a question from the database."""
cursor.execute("""
SELECT q.id, q.question
FROM questions q
""")
questions = cursor.fetchall()
if not questions:
print("No questions available to delete.")
return

formatted_questions = [
(qid, wrap_text(question)) for qid, question in questions
]

print("\n=== Available questions to delete ===")


print(tabulate(formatted_questions, headers=["ID", "Question"], tablefmt="grid"))
question_id = input("\nEnter the ID of the question to delete: ")
if not question_id.isdigit():
print("Invalid ID. Please try again.")
return
question_id = int(question_id)

cursor.execute("DELETE FROM questions WHERE id = %s", (question_id,))


conn.commit()
print("Question deleted successfully.")

def generate_test_paper(cursor):
"""Generates a test paper by selecting questions based on difficulty."""
cursor.execute("SELECT * FROM subjects")
subjects = cursor.fetchall()

print("\nSelect a subject:")
for idx, subject in enumerate(subjects, 1):
print(f"{idx}. {subject[1]}")

subject_choice = input("\nEnter subject choice number: ")


if not subject_choice.isdigit() or int(subject_choice) not in range(1, len(subjects) + 1):
print("Invalid choice. Please try again.")
return

17
subject_choice = int(subject_choice)
subject_id = subjects[subject_choice - 1][0]

cursor.execute("""
SELECT q.id, q.question, q.difficulty
FROM questions q
WHERE q.subject_id = %s
""", (subject_id,))
questions = cursor.fetchall()

if not questions:
print("No questions available in this subject.")
return

formatted_questions = [
(qid, wrap_text(question), difficulty) for qid, question, difficulty in questions
]

print("\nQuestions available for test paper generation:")


print(tabulate(formatted_questions, headers=["ID", "Question", "Difficulty"],
tablefmt="grid"))

try:
easy_count = int(input("\nEnter number of easy questions: "))
medium_count = int(input("Enter number of medium questions: "))
hard_count = int(input("Enter number of hard questions: "))
except ValueError:
print("Invalid input. Please enter valid numbers.")
return

easy_questions = [q for q in questions if q[2] == "Easy"]


medium_questions = [q for q in questions if q[2] == "Medium"]
hard_questions = [q for q in questions if q[2] == "Hard"]

if len(easy_questions) < easy_count or len(medium_questions) < medium_count or


len(hard_questions) < hard_count:
print("Not enough questions available to generate the test paper.")
return

test_paper = (
random.sample(easy_questions, easy_count) +
random.sample(medium_questions, medium_count) +
random.sample(hard_questions, hard_count)
)

formatted_test_paper = [
(qid, wrap_text(question), difficulty) for qid, question, difficulty in test_paper
]

print("\nGenerated Test Paper:")

18
print(tabulate(formatted_test_paper, headers=["ID", "Question", "Difficulty"],
tablefmt="grid"))

def main():
"""Main function to run the JEE Question Paper Management System."""
conn = mysql.connector.connect(host="localhost", user="root", password="3804")
cursor = conn.cursor()

if not user_login_system(cursor, conn):


print("Exiting program.")
return

create_database_and_tables(cursor)

print("\n=== JEE Question Paper Management System ===")


while True:
print("1. Add Question")
print("2. Fetch Question")
print("3. Update Question")
print("4. Delete Question")
print("5. Generate Test Paper")
print("6. Exit")
choice = input("Enter your choice: ")
if not choice.isdigit() or int(choice) not in range(1, 7):
print("Invalid choice. Please try again.")
continue
choice = int(choice)

if choice == 1:
add_question(cursor, conn)
elif choice == 2:
fetch_question(cursor)
elif choice == 3:
update_question(cursor, conn)
elif choice == 4:
delete_question(cursor, conn)
elif choice == 5:
generate_test_paper(cursor)
elif choice == 6:
print("Exiting the system. Goodbye!")
break

cursor.close()
conn.close()

if __name__ == "__main__":
main()

19
OUTPUT
• Registration and Login

• Adding a Question

20
• Fetching Questions

• Updating a Question

• Exiting the Program

21
• Deleting a Question

• Generating a Test Paper

22
USES OF THE SOFTWARE
• For Students: It helps students prepare for the JEE examination by
providing a structured question bank with various difficulty levels.
They can use the system to practice questions and generate test
papers.

• For Teachers: Teachers can manage the question bank, add new
questions, update existing ones, and delete outdated questions.

• For Institutes: Educational institutions can use this software to


provide customized test papers to students based on their
requirements.

23
LIMITATIONS OF THE SOURCE
CODE
• Automatic ID Update: When a question is deleted from the
database, the IDs of the remaining questions do not automatically
update. This means the IDs may not be in a sequential order,
potentially leading to inconsistencies when referencing question
IDs.

• Security: The system stores passwords in plain text, which could


pose a security risk. It is advisable to implement password hashing
to ensure better security.

• User Interface: The software relies on the command line interface


(CLI), which may not be user-friendly for non-technical users. A
graphical user interface (GUI) could make it more accessible.

• Privacy Issues: Any user can log in and use the same database.
This leads to privacy concerns as users have access to the same set
of data. Ideally, a new database should be created for each user to
maintain individual privacy and ensure data segregation.

24
CONCLUSION
The JEE Question Paper Management System is a practical and
effective tool designed to streamline the process of managing and
generating question papers for various subjects relevant to
competitive exams like JEE. Using a MySQL database and Python
programming, the system provides functionalities that enable users to
manage questions efficiently, including adding, updating, deleting,
and fetching questions, as well as generating test papers based on
different difficulty levels.
By organizing questions into a well-structured database, the system
ensures easy access to a wide range of questions. The ability to select
questions based on subject and difficulty level allows students to
tailor their preparation to meet their needs.
The user login system, though simple, provides a basic level of
security by requiring authentication before accessing the database.
This functionality makes it suitable for multiple users, although it
could be improved in future versions by creating separate databases
for each user to enhance privacy and ensure that the data remains
segregated.
Despite its capabilities, the system does have limitations. One major
limitation is that when questions are deleted, their IDs are not
automatically updated, leading to potential issues with the sequential
order of IDs. Additionally, the system uses plain text for storing
passwords, which can be a security concern. Furthermore, since all
users share the same database, privacy issues arise, and a better
approach would be to create a new database for each user to ensure
data confidentiality.
In conclusion, the JEE Question Paper Management System provides
a reliable platform for managing and generating question papers for
students preparing for competitive exams. While the system meets the
objectives of the project, future enhancements such as password
encryption, improved privacy measures, and automatic ID updates
would improve the overall performance and security of the system.

25
BIBLIOGRAPHY
The data used in this project has been sourced from the following
reliable references:

1. NCERT Computer Science – The foundational textbook provided


by the National Council of Educational Research and Training,
which offers comprehensive knowledge on computer science
concepts and programming techniques.

2. Sumita Arora's Class 12 Computer Science with Python – This


book serves as a valuable resource for understanding Python
programming and its application in computer science, specifically
designed for class 12 students.

3. Google – A widely used search engine that was instrumental in


gathering additional information, references, and online tutorials to
support the development of the project.

4. ChatGPT – An AI-powered large language model that assisted in


providing code solutions, explanations, and troubleshooting during
the project development process.

5. Gemini – A cutting-edge AI model that contributed to enhancing


the understanding of concepts and code optimization throughout
the project.

26

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