0% found this document useful (0 votes)
3 views33 pages

Computer Science Practical File

The document is a practical file for a Computer Science project submitted by Prakshi Sharma from St. John's School for the academic year 2025-26. It includes a certificate of completion, a table of contents listing various Python and SQL programs, and detailed aims and results for each program. The project covers a range of topics including arithmetic operations, file handling, and database integration using Python and SQL.

Uploaded by

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

Computer Science Practical File

The document is a practical file for a Computer Science project submitted by Prakshi Sharma from St. John's School for the academic year 2025-26. It includes a certificate of completion, a table of contents listing various Python and SQL programs, and detailed aims and results for each program. The project covers a range of topics including arithmetic operations, file handling, and database integration using Python and SQL.

Uploaded by

dhruv7rana
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ST.

JOHN’S SCHOOL
Sector-01, Greater Noida West

ACADEMIC YEAR: 2025-26

COMPUTER SCIENCE PRACTICAL


FILE
ROLL NO. :
NAME : Prakshi Sharma
CLASS : XIIth-A
SUB CODE 083
SUBMITTED TO : MS. PRIYANKA CHAUHAN
PGT (COMPUTER SCIENCE)
CERTIFICATE

This is to certify that Prakshi Sharma, a student of Class 12,


Section - A of St. John’s School has successfully completed and
submitted the project file of English core(301) on the topic
“Echoes within-understanding silence and introspection” as per
the guidelines provided by CBSE in the prescribed curriculum
for academic year 2025-26 for accomplishment of Senior
School Certificate Examination - 2026.
The project file has been evaluated and found to be correct in
accordance with the guidelines provided by the board for the
Academic year 2025-26. The work has been completed and
presented in a satisfactory manner.

EXAMINER’S SIGNATURE PRINCIPAL’S SIGNATURE


TABLE OF CONTENTS

S. No. Name of the Practical Page No. Sign


Python Programs
1. Creating a menu driven program to perform arithmetic operations. 1
2. Creating a python program to display Fibonacci series 2
3. Creating a menu driven program to find factorial and sum of list of 3
numbers using function.
4. Creating a python program to implement returning value(s) from 4
function.
5. Creating a python program to implement mathematical functions. 5
6. Creating a python program to generate random number between 1 to 6. 6
7. Creating a python program to read a text file line by line and display 7
each word separated by '#'.
8. Creating a python program to read a text file and display the 8
number of vowels/consonants/lower case/ upper case characters.
9. Creating python program to display short words from a text file 9
10. Creating a python program to copy particular lines of a text file into 10
another text file.
11. Creating a python program to create and search records in binary file. 11
12. Creating a python program to create and update/modify records in 12
binary file.
13. Creating a python program to create and search employee’s record in 13
csv file.
14. Creating a python program to implement stack operations (list). 14-15
15. Creating a python program to implement stack operations (dictionary). 16-17
Python – SQL connectivity programs
16. Creating a python program to integrate MySQL with python (creating 18
database and table)
17. Creating a python program to integrate MySQL with python (inserting 19
records and displaying records)
18. Creating a python program to integrate MySQL with python 20
(searching and displaying records)
19. Creating a python program to integrate MySQL with python (updating 21
records)
SQL Queries
20. SQL PRACTICAL – 1 22
21. SQL PRACTICAL – 2 23-24
22. SQL PRACTICAL – 3 25-26
23. SQL PRACTICAL – 4 27-28
24. SQL PRACTICAL - 5 29
DATE-14-05-2025
AIM(1):

To write a python program to perform the basic arithmetic operations in a


menu-driven program with different functions. The output should be like this:
Select an operator to perform the task: ‘+‘ for Addition ‘-‘ for Subtraction ‘*‘ for
Multiplication ‘/‘ for Division

RESULT-

1
DATE-14-05-2025
AIM(2):

To write a python program using a function to print Fibonacci series up to n


numbers.

RESULT-

2
DATE-14-05-2025
AIM(3):

To write a menu driven Python Program to find Factorial and sum of list
of numbers using function.

RESULT-

3
DATE-07-07-2025
AIM(4):
To write a Python program to define the function Check(no1,no2) that
take two numbers and returns the number that has minimum ones
digit.

RESULT-

4
DATE-07-07-2025
AIM(5):

To write a Python program to implement python mathematical


functions to find.

 To find Square of a Number.


 To find Log of a Number(i.e. Log10)
 To find Quad of a Number

RESULT-

5
DATE-07-07-2025
AIM(6):

To write a Python program to generate random number between 1 to 6


to simulate the dice.

RESULT-

6
DATE-21-07-2025
AIM(7):

To write a Python Program to Read a text file "[Link]" line by line an.d
display each word separated by '#'

RESULT-

7
DATE-21-07-2025
AIM(8):

To write a Python Program to read a text file "[Link]" and


displays the number of Vowels/ Consonants/ Lowercase /
Uppercase/characters in the file.

RESULT-

8
DATE-21-07-2025
AIM(9):

To write a method Disp() in Python, to read the lines from [Link]


and display those words which are less than 5 characters.

RESULT-

9
DATE-21-07-2025
AIM(10):

To write a python program to read lines from a text file "[Link]"


and copy those lines into another file which are starting with an
alphabet 'a' or 'A'.

RESULT-

10
DATE-25-07-2025
AIM(11):
To write a Python Program to Create a binary file with roll number
and name. Search for a given roll number and display the name, if not
found display appropriate message.

RESULT-

11
DATE-25-07-2025
AIM(12):

To write a Python Program to Create a binary file with roll number,


name, mark and update/modify the mark for a given roll number.

RESULT-

12
DATE-25-07-2025
AIM(13):

To write a Python program Create a CSV file to store Empno, Name,


Salary and search any Empno and display Name, Salary and if not
found display appropriate message.

RESULT-

13
DATE-28-07-2025
AIM(14):

To write a Python program to implement Stack using a list data-


structure, to perform the following operations:
(i) To Push an object containing Doc_ID and Doc_name of doctors who
specialize in "ENT" to the stack
(ii) To Pop the objects from the stack and display them.

(iii) To display the elements of the stack (after performing PUSH or


POP)

14
RESULT-

15
DATE-28-07-2025
AIM(15):

To write a Python program to implement Stack using a list data


structure, to perform the following operations:
(i) To Push an object containing Doc_ID and Doc_name of doctors who
specialize in "ENT" to the stack
(ii) To Pop the objects from the stack and display them.

(iii) To display the elements of the stack (after performing PUSH or


POP)

RESULT-

16
17
DATE-18-08-2025
AIM(16):

Write a Python Program to integrate MYSQL with Python to create


Database and Table to store the details of employees.

RESULT-

18
DATE-18-08-2025
AIM(17):
To write a Python Program to integrate MYSQL with Python by inserting
records to Emp table and display the records.

RESULT-

19
DATE-18-08-2025
AIM(18):

To write a Python Program to integrate MYSQL with Python to search


an Employee using EMPID and display the record if present in already
existing table EMP, if not display the appropriate message.

RESULT-

20
DATE-18-08-2025
AIM(19):

To write a Python Program to integrate MYSQL with Python to search


an Employee using EMPID and update the Salary of an employee if
present in already existing table EMP, if not display the appropriate
message.

RESULT-

21
DATE-22-08-2025
SQL PRACTICAL - 1

AIM(20): To write Queries for the following Questions based on the given table:

Rollno Name Gender Age Dept DOA Fees


1 Arun M 24 COMPUTER 1997-01-10 120
2 Ankit M 21 HISTORY 1998-03-24 200
3 Anu F 20 HINDI 1996-12-12 300
4 Bala M 19 NULL 1999-07-01 400
5 Charan M 18 HINDI 1997-09-05 250
6 Deepa F 19 HISTORY 1997-06-27 300
7 Dinesh M 22 COMPUTER 1997-02-25 210
8 Usha F 23 NULL 1997-07-31 200

a) Write a Query to Create a new database in the name of "STUDENTS".

Sol: mysql> CREATE DATABASE STUDENTS;


b) Write a Query to Open the database "STUDENTS"

Sol:

mysql> USE STUDENTS;

c) Write a Query to create the above table called: Info


Sol:
mysql> CREATE TABLE STU(Rollno int Primary key,Name varchar(10),Gender
varchar(3), Age int,Dept varchar(15),DOA date,Fees int);

d) Write a Query to list all the existing database names.


Sol:
mysql> SHOW DATABASES;

e) Write a Query to List all the tables that exists in the current database
Sol:
mysql> SHOW TABLES;

22
DATE-22-08-2025
SQL PRACTICAL - 2

AIM(21): To write Queries for the following Questions based on the given table

Rollno Name Gender Age Dept DOA Fees


1 Arun M 24 COMPUTER 1997-01-10 120
2 Ankit M 21 HISTORY 1998-03-24 200
3 Anu F 20 HINDI 1996-12-12 300
4 Bala M 19 NULL 1999-07-01 400
5 Charan M 18 HINDI 1997-09-05 250
6 Deepa F 19 HISTORY 1997-06-27 300
7 Dinesh M 22 COMPUTER 1997-02-25 210
8 Usha F 23 NULL 1997-07-31 200

(a) Write a Query to insert all the rows of above table into Info table.
Sol:
INSERT INTO STU VALUES (1,'Arun','M', 24,'COMPUTER','1997-01-10', 120);
INSERT INTO STU VALUES (2,'Ankit','M', 21,'HISTORY','1998-03-24', 200);
INSERT INTO STU VALUES (3,'Anu','F', 20,'HINDI','1996-12-12', 300);
INSERT INTO STU VALUES (4,'Bala','M', 19, NULL,'1999-07-01', 400);
INSERT INTO STU VALUES (5,'Charan','M', 18,'HINDI','1997-06-27', 250);
INSERT INTO STU VALUES (6,'Deepa','F', 19,'HISTORY','1997-06-27', 300);
INSERT INTO STU VALUES (7,'Dinesh','M', 22,'COMPUTER','1997-02-25', 210);
INSERT INTO STU VALUES (8,'Usha','F', 23, NULL,'1997-07-31', 200);

(b) Write a Query to display all the details of the Employees from the above table
'STU'.
Sol: mysql> SELECT * FROM STU;

(c) Write a query to Rollno, Name and Department of the students from STU
table.
Sol: mysql> SELECT ROLLNO,NAME,DEPT FROM STU;

23
(d) Write a Query to select distinct Department from STU table.
Sol:
mysql> SELECT DISTICT(DEPT) FROM STU;

(e) To show all information about students of History department


Sol:
mysql>SELECT * FROM STU WHERE DEPT='HISTORY';

24
DATE-22-08-2025
SQL PRACTICAL – 3

AIM(22): To write Queries for the following Questions based on the given table:

Rollno Name Gender Age Dept DOA Fees


1 Arun M 24 COMPUTER 1997-01-10 120
2 Ankit M 21 HISTORY 1998-03-24 200
3 Anu F 20 HINDI 1996-12-12 300
4 Bala M 19 NULL 1999-07-01 400
5 Charan M 18 HINDI 1997-09-05 250
6 Deepa F 19 HISTORY 1997-06-27 300
7 Dinesh M 22 COMPUTER 1997-02-25 210
8 Usha F 23 NULL 1997-07-31 200

(a) Write a Query to list name of female students in Hindi Department.


Sol:
mysql> SELECT NAME FROM STU WHERE DEPT='HINDI' AND GENDER='F';

(b) Write a Query to list name of the students whose ages are between 18 to 20.
Sol:
mysql> SELECT NAME FROM STU WHERE AGE BETWEEN 18 AND 20;

(c) Write a Query to display the name of the students whose name is starting with
'A'
Sol:
mysql> SELECT NAME FROM STU WHERE NAME LIKE 'A%';

25
(d) Write a query to list the names of those students whose name have
second alphabet 'n' in their names.
Sol:
mysql> SELECT NAME FROM STU WHERE NAME LIKE '_N%';

26
DATE-26-08-2025
SQL PRACTICAL – 4

AIM(23): To write Queries for the following Questions based on the given table:
Rollno Name Gender Age Dept DOA Fees
1 Arun M 24 COMPUTER 1997-01-10 120
2 Ankit M 21 HISTORY 1998-03-24 200
3 Anu F 20 HINDI 1996-12-12 300
4 Bala M 19 NULL 1999-07-01 400
5 Charan M 18 HINDI 1997-09-05 250
6 Deepa F 19 HISTORY 1997-06-27 300
7 Dinesh M 22 COMPUTER 1997-02-25 210
8 Usha F 23 NULL 1997-07-31 200

a) Write a Query to delete the details of Roll number is 8.


Sol:
mysql> DELETE FROM STU WHERE ROLLNO=8;
Output (After Deletion):

b) Write a Query to change the fess of Student to 170 whose Roll number is 1, if
the existing fess is less than 130.
Sol:
mysql> UPDATE STU SET FEES=170 WHERE ROLLNO=1 AND FEES<130;
Output(After Update):

c) Write a Query to add a new column Area of type varchar in table STU.
Sol:
mysql> ALTER TABLE STU ADD AREA VARCHAR(20);

27
Output:

d) Write a Query to Display Name of all students whose Area Contains NULL.
Sol:
mysql> SELECT NAME FROM STU WHERE AREA IS NULL;
Output:

e) Write a Query to delete Area Column from the table STU.


Sol:
mysql> ALTER TABLE STU DROP AREA;
Output:

f) Write a Query to delete table from Database.


Sol:
mysql> DROP TABLE STU;
Output:

28
DATE-26-08-2025
SQL PRACTICAL – 5

AIM(24): To write Queries for the following Questions based on the given table:

TABLE: STOCK
Pno Pname Dcode Qty UnitPrice StockDate
5005 Ball point pen 102 100 10 2021-03-31
5003 Gel pen premium 102 150 15 2021-01-01
5002 Pencil 101 125 4 2021-02-18
5006 Scale 101 200 6 2020-01-01
5001 Eraser 102 210 3 2020-03-19
5004 Sharpner 102 60 5 2020-12-09
5009 Gel pen classic 103 160 8 2022-01-19

TABLE: DEALERS
Dcode Dname
101 Sakthi Stationaries
103 Classic Stationaries
102 Indian Book House

(a) To display the total Unit price of all the products whose Dcode as 102.
Sol:
mysql> SELECT SUM(UNITPRICE) FROM STOCK WHERE DCODE=102;

(b) To display details of all products in the stock table in descending order of Stock
date.
Sol:
mysql> SELECT * FROM STOCK ORDER BY STOCKDATE DESC;

(c) To display maximum unit price of products for each dealer


individually as per dcode from the table Stock.
Sol:
mysql> SELECT DCODE,MAX(UNITPRICE) FROM STOCK GROUP BY
DCODE;

(d) To display the Pname and Dname from table stock and dealers.
Sol:
mysql> SELECT PNAME,DNAME FROM STOCK S,DEALERS D WHERE
[Link]=[Link];

29

You might also like