0% found this document useful (0 votes)
5 views

cs project

Uploaded by

devbhadani0007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

cs project

Uploaded by

devbhadani0007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

NSC STREET, VENKATAPURAM,

ACADEMIC YEAR : 2024-25

PROJECT REPORT ON

“__________________”

ROLL NO :

NAME :

CLASS :

SUBJECT : COMPUTER SCIENCE

SUB CODE : 083

PROJECT GUIDE : Mrs .BHUVANALAKSHMI, PGT (CS)

1
TABLE OF CONTENTS

Serial No. Description Page No.

1 Certificate

2 Acknowledgement

3 Introduction

4 Objective of the project

5 Proposed system

6 System Development Life Cycle (SDLC)

7 Modules used and their purposes

8 Flowchart

9 Source Code

10 Output Screens

11 Limitations & Future Scope

12 Requirements

13 Bibliography

2
Certificate
This is to certify that ___________________________________ student of class XII
(Science) has successfully prepared the report on the Project entitled
“__________________________________________”under the guidance of Mrs.
Bhuvanalakshmi (PGT Computer Science). The report is the result of his efforts &
endeavours. The report is found worthy of acceptance as final Project report for the
subject Computer Science of class XII (Science).

Signature of Internal Examiner Signature of External Examiner

Signature of Principal

3
Acknowledgement

Apart from the efforts of me, the success of any project depends largely on the encouragement and
guidelines of many others. I take this opportunity to express my gratitude to the people who have been
instrumental in the successful completion of this project.

I express deep sense of gratitude to almighty God for giving me strength for the successful completion
of the project.

I express my deep sense of gratitude to the luminary The Principal, Nathella Vidhyodaya,
Ambattur has been continuously motivating and extending their helping hand to us.

I express my sincere thanks to the academician The Co ordinators, Nathella Vidhyodaya, Ambattur,
for constant encouragement and the guidance provided during this project.

My sincere thanks to M.Bhuvanalakshmi, A guide, Mentor all the above a friend, who critically reviewed
my project and helped in solving each and every problem, occurred during implementation of the project

I am overwhelmed to express my thanks to The Administrative Officer, Nathella Vidhyodaya,


Ambattur for providing me an infrastructure and moral support while carrying out this project in the
school.

4
Introduction

❖ About Quiz Game:-

The Quiz Game is an interactive program designed to test and improve a player’s general
knowledge. In this game, the player is asked a series of multiple-choice questions
covering a variety of topics. Each question has four possible answers, and the player must
select the correct one to score points. This game encourages learning in a fun and
engaging way, challenging players to expand their knowledge base while competing for
high scores.

Players receive instant feedback on each answer, which helps reinforce learning and
enables them to track their progress. At the end of the game, players can view their scores
and compare them with previous high scores to see how well they performed.

The program saves high scores to track the top-performing players, motivating players to
improve and challenge themselves further.

Example:

1. Question: What is the capital of France?


a) Berlin
b) Madrid
c) Paris
d) Rome
Correct Answer: Paris

2. Question: Which planet is known as the Red Planet?


a) Earth
b) Mars
c) Venus
d) Jupiter
Correct Answer: Mars

The Quiz Game can be played multiple times, with questions randomly shuffled each
time for a unique experience. After each quiz session, the player's score is saved, and the
top scores are displayed. This feature encourages replayability and fosters a competitive
spirit among players.

5
❖ Python Overview:-

Python is a general-purpose high-level programming language. It is an open-source


language, released under a GPL-Compatible license. Python Software Foundation (PSF),
a non-profit organization, holds the copyright of Python. Guido Van Rossum conceived
Python in the late 1980s. It was released in 1991 at Centrum Wiskunde & Informatica
(CWI) in the Netherlands as a successor to the ABC language. He named this language
after a popular comedy show called “Monty Python’s Flying Circus” (and not after
Python - the snake). In the last few years, its popularity has increased immensely.
According to stackoverflow.com’s recent survey, python is in the top ten most popular
technologies in 2018. It is also dynamically typed because it carries out type-checking
at run time. It does so to make sure that the type of construct matches what we expect it
to be. The distinctive feature of Python is that it is an interpreted language. The Python
IDLE (Integrated Development & Learning Environment) executes instructions one line
at a time. The Python programming language is one of the richest languages.

❖ Features of Python:-

1. Easy:-
Python is very easy to learn and understand; using this Python tutorial, any beginner
can understand the basics of Python.

2. Interpreted:-
It is interpreted (executed) line by line. This makes it easy to test and debug.

3. Object Oriented:-
The Python programming language supports classes and objects.

4. Free and Open-Source:-


The language and its source code are available to the public for free; there is no need
to buy a costly license.

5. Portable:-
Since it is open source, we can run Python on Windows, Mac, Linux, or any other
platforms. Our programs will work without needing to the changed for every machine.

6. GUI (Graphical User Interface) programming:-


6
We can use it to develop a GUI (Graphical User Interface). One way to do this is
through “Tkinter”.

7. Large Library:-
Python provides us with a large standard library. We can use it to implement a
variety of functions without reinventing the wheel every time. We just pick the code we
need and continue, allowing us to focus on other important tasks.

❖ Advantages of Python:-

1. Extensible:-
2. Portable
3. Free & Open-Source
4. Readable
5. Embeddable
6. Improved Productivity
7. Simple and Easy
8. Object Oriented
9. Interpreted
10. Extensive Libraries

❖ How to install Python:-

1. Point your web browser to the download page on the Python website
(www.python.org).
2. Select the latest Windows x86 MSI Installer and click the link todownload the
.msi installer.
3. Run the installer.
4. Select „Install for all users‟ and click the Next > button.
5. Keep the default option (C:\Python32\) as the destination directory andclick Next
> again.
6. Don't make any changes in the „Customize Python 3.2.3‟ dialog, justclick Next
> again.
7. Click Yes if asked if this program should be allowed to install softwareon your
system.
8. Click the Finish button when installation completes.

7
❖ About MySql:-

MySQL is a fast, easy-to-use RDBMS (Relational Database Management System)


used by many small and big businesses. MySQL AB, a Swedish company, developed,
marketed, and supported MySQL.

MySql is becoming so popular because of many good reasons:-


1. MySql is released under an open-source language. So we have nothingto pay
to use it.
2. MySql is a very powerful program in it‟s own right. It handles a large subset
of the functionality of the most expensive and powerful database packages.
3. MySql uses a standard form of the well-known SQL data language.
4. MySql works on many operating systems and with many languages including
PHP, PERL, C, C++, JAVA, etc.
5. MySql works very quickly and works well even with large data sets.
6. MySql is very friendly to PHP, the most appreciated language for web
development.
7. MySql supports large databases, up to 50 million rows or more in a table. The
default file size limit for a table is 4 GB, but we can increase this (if our
the operating system can handle) to a theoretical limit of 8 million Tera-Bytes
(TB).
8. MySQL is customizable. The open-source GPL license allows programmers to
modify the MySql software to fit their specific environments.

❖ For installing MySql:-

1. For Python 2.7 or lower, install using pip as:-


pip install MySQL.connector

2. For Python 3 or higher version, install using pip3 as:-


pip3 install mysql.connector

8
Objective of the project
The objective of this project is to let the students apply the programming
knowledge of a real-world situation/problem and exposed the students to how
programming skills help in developing good software.

Some key points are as follows:-

1. Utilising modern software tools for programming games.


2. Apply object-oriented programming principles effectively when
developing small to medium-sized projects.
3. Write effective procedural code to solve small to medium-sized
problems.
4. Demonstrate a breadth of knowledge in computer science, as exemplified
in the area of game development.
5. Demonstrate ability to conduct research or applied computer science
projects, requiring writing and presentation skills that exemplify
scholarly style in computer science.

9
Proposed System
Our project aims to create a Quiz Game in Python. This project showcases Python's
simplicity and versatility, with its easy-to-understand syntax, user-friendly interface, and
rapid development process.

Python’s interpreter and comprehensive standard library are open-source resources,


making it an ideal choice for building interactive games on various platforms. The
language's portability and extensive support community make it popular among
programmers, especially for educational and recreational projects like this one.

This project also demonstrates the use of data management techniques to store and retrieve
quiz questions and high scores. In earlier days, managing data involved extensive
paperwork, but modern software solutions like Python and MySQL have made this process
simpler and faster. With MySQL, we can efficiently store a database of quiz questions and
track high scores for each player, enabling players to save their achievements and view top
scores.

Using MySQL allows for reliable data handling and prevents the loss of information,
saving time and effort. The combination of Python and MySQL provides an efficient and
seamless experience in managing the game’s data.

This system design highlights the ease and flexibility of using Python and MySQL
together to create an engaging, data-driven Quiz Game.

Ask questions Get questions.

GAME
USER INTERFACE DATABASE

Reply correct Set questions


answer

10
System Development Life Cycle(SDLC)
The System Development Life Cycle is used in the construction of the
serverappliance.

PLANNING ANALYSIS

SUPPORT DESIGN

IMPLEMENTATION

The system development life cycle is a project management technique that


divides complex projects into smaller, more easily managed segments or phases.
Segmenting projects allows managers to verify the successful completion of project
phases before allocating resources to subsequent phases.

Software development projects typically include planning, creating, developing,


testing, and maintenance. However, the phases may be divided differently depending on
the organization.

11
The module used and their purposes.
1. The Random Module

This module implements pseudo-random number generators for various


distributions.

The random module has a set of methods used in that game.

a. random() :-
For integers, there is a uniform selection from a range.
For a sequence, there is a uniform selection of a random
element. The syntax for using this function
is, random. random()‟.
.
2. MySql.connector module:-

This module 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.

MySql.connector module has a set of methods in which one is used in that


game.

a. cursor ( ):-
A database cursor is a useful control structure for a database
connectivity. Normally when we connect to a database from within a
script/program, then the query gets sent to the server, where it gets
executed, and the set of records retrieved as per the query is sent over
to the connection.

The syntax for using this function is „conn. cursor ( )‟.

b. connect ( ):-
After we have installed the Python MySql connector, we can write
Python scripts using MySql.connector library that can connect to
MySql databases from within Python.
Next, we need to establish a connection to a MySql database using
the connect() function of mysql.connector package.

The connect() function of mysql.connector establishes a connection to


a MySql database and requires four parameters, which are :

12
<connection-object>=mysql.connector.connect(
host=<host- name>,
user=<username>,
passwd=<password>
[,database=<database>])

- user is the username on MySql


- password is the password of the user
- host-name is the database server hostname or IP address
- database is optional which provides the database name of a MySql
database

The syntax for using this function is:- „mysql.connector.connect()‟.

c. execute ( ):-
This method is used to execute an SQL statement. Once we have
created a cursor, we can execute the SQL query using the execute()
function with the cursor object.

The syntax for using this method is „cursor. execute()‟.

For example,
If we want to view all the records of table data which is a table in the
database test to which we established a connection, we can execute SQL
query “select * from data” by writing:

‘cursor.execute(“select * from data”)’

13
Flow-chart
START

Retrieve questions
from database

Display questions
with multiple-
choice options

True Is ‘guessed False


answer’
==
‘Correct’ ?

Show the correct


Point=+5 answer

14
SourceCode
import os

def start_quiz():
questions = [
{
"question": "What is the capital of France?",
"options": ["a) Paris", "b) London", "c) Rome", "d) Madrid"],
"answer": "a"
},
{
"question": "Which planet is known as the Red Planet?",
"options": ["a) Earth", "b) Mars", "c) Jupiter", "d) Saturn"],
"answer": "b"
},
{
"question": "Who discovered America in 1492?",
"options": ["a) Ferdinand Magellan", "b) Marco Polo", "c) Christopher
Columbus", "d) Vasco da Gama"],
"answer": "c"
},
{
"question": " In which year did World War II end?",
"options": ["a) 1942", "b) 1945", "c) 1948", "d) 1950"],
"answer": "b"
}

score = 0

For i, q in enumerate(questions):
print(f"\nQuestion {i + 1}: {q['question']}")
for option in q["options"]:
print(option)

answer = input("Your answer (a, b, c, or d): ").strip().lower()


if answer == q["answer"]:
print("Correct!")
score += 1
else:
print(f"Wrong! The correct answer was {q['answer']}.")

15
print(f"\nQuiz complete! Your score is: {score}/{len(questions)}")

# Save the score to the high scores file


save_high_score(score)

def save_high_score(score):
name = input("Enter your name for the high score board: ").strip()
with open("high_scores.txt", "w") as file:
file.write(f"{name}: {score}\n")
print("Your score has been saved!")

def view_high_scores():
if os.path.exists("high_scores.txt"):
print("\nHigh Scores:")
with open("high_scores.txt", "a") as file:
scores = file.readlines()
for line in scores:
print(line.strip())
else:
print("No high scores yet! Play the game to set a high score.")

def main_menu():
while True:
print("\nWelcome to the Quiz Game!")
print("1. Start Quiz")
print("2. View High Scores")
print("3. Exit")
choice = input("Enter your choice: ")

if choice == '1':
start_quiz()
elif choice == '2':
view_high_scores()
elif choice == '3':
print("Thanks for playing!")
break
else:
print("Invalid choice! Please select again.")

# Run the main menu to start the program


main_menu

16
Output Screens

17
If someone enters the wrong option it will show the correct answer.

I can also see the high scores after finishing the game.

It will show an interface after exiting the game

18
Limitations and Future Scope
❖ Limitations:-
• Only one player can play at a time.
• It does not provide a timing system.
• The number of questions are limited.

❖ Future Scope:-
• The number of player can be more than one at a time.
• Timing system can be provided.
• Many more interesting questions can be generated through AI

19
Requirements
❖ Hardware required:-

➢ Modern Operating System:


• Windows 7 or 10
• Mac OS X 10.11 or higher, 64-bit
• Linux: RHEL 6/7, 64-bit (almost all libraries alsowork in Ubuntu)
➢ X86 64-bit CPU (Intel / AMD architecture)
➢ 4 GB RAM
➢ 5 GB free space
➢ Printer for a printing project

❖ Software required:-

➢ Operating System – Windows 10


➢ Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8, 2019, 19:29:22) [MSC v.1916
32 bit(Intel)] on win 32 for the execution of the program.
➢ MS Word, for preparing documentation

20
Bibliography
1. www.wikipedia.com
2. www.slideshare.net
3. www.geeksforgeeks.org
4. www.google.com
5. Computer Science with Python by Peerthi Arora Class XIIth(Book)

21
Thank You.

22

You might also like