ACKNOWLEDGEMENT
I would like to extend my sincere and heartfelt
thanks towards all those who have helped me
in making this practical file. Without their
active guidance help, cooperation and
encouragement, I would not have been able to
present the practical file on time.
I extend my sincere gratitude to my principal
Ms. Ajeeta Singh and my CS teacher Ms.
Paranjyothi for their moral support and
guidance during the tenure of my practicle file.
Shubham Raghav
12th A
CERTIFICATE
This is to certify that Shubham Raghav,
Roll no: ________, of class XII ‘A’, session:
2025-26 has prepared the practical file
as per prescribed syllabus of
COMPUTER SCIENCE (SUB. CODE-083)
under my supervision, I am completely
satisfied by the performance. I wish him
all the success in his life.
_______________ __________________
Principal’s signature Subject teacher sign.
___________________
External’s signature
INDEX
SECTION A
1. Create a menu driven program to perform arithmetic
operations.
2. Create a python program to input a character and to print
whether a given character is an alphabet, digit or any other
character.
3. Create a python program to display Fibonacci series.
4. Create a menu driven program to find factorial and sum of
list of number using function.
5. Create a python program to implement returning value(s)
from function.
6. Create a python program to implement
Mathematical functions.
7. Write a function to swap the values of two variables
through a function.
8. Create a python program to generate a random number
between 1 to 6.
9. Create a dictionary containing names of competition
winner students as keys and no. of wins as values.
10. Create a python program to read a text file line by line and
display each word separated by ‘#’.
11. Create a python program to read a text file and display the
number of vowels/ consonants/ lower case/ upper case
characters.
12. Remove all the lines that contain the character ‘a’ in a fil
and write it to another file.
13. Create a binary file with name and roll number . Search
for a given roll number and display the name, if not found
display appropriate message.
14. Write a random number generator using functions that
generates random numbers between 1 and 6 (simulates a
dice).
15. Create a binary file with roll number, name and marks.
Input a roll number and update the marks.
16. Write a Python program to implement a stack using list.
17. Create a CSV file by entering user-id and password, read
and search the password for given user-id.
18. Write a menu based program to perform the operation on
stack in python.
SECTION B
SECTION C
1. Creating a python program to integrate
mysql with python (creating database and
table).
2. Creating a python program to integrate
mysql with python (inserting records and
displaying records).
3. Creating a python program to integrate
mysql with python (searching and
displaying records).
4. Creating a python program to integrate
mysql with python (updating records).
BIBLIOGRAPHY
SECTION A
Q 1. Create a menu driven program to perform
arithmetic operations.
OUTPUT :
Q 2. Create a python program to input a
character and to print whether a given
character is an alphabet, digit or any other
character.
OUTPUT :
Q 3. Create a python program to display
Fibonacci series
OUTPUT :
Q 4. Create a menu driven program to find
factorial and sum of list of number using
function.
OUTPUT :
Q 5. Create a python program to implement
returning value(s) from function.
OUTPUT :
Q 6. Create a python program to implement
Mathematical functions.
OUTPUT :
Q 7. Write a function to swap the values of two
variables through a function.
OUTPUT :
Q 8. Create a python program to generate a
random number between 1 to 6.
OUTPUT :
Q 9. Create a dictionary containing names of
competition winner students as keys and no. of
wins as values.
OUTPUT :
Q 10. Create a python program to read a text
file line by line and display each word
separated by ‘#’.
OUTPUT :
Q 11. Create a python program to read a text file
and display the number of vowels/ consonants/
lower case/ upper case characters.
OUTPUT :
Q 12. Remove all the lines that contain the
character ‘a’ in a file and write it to another file.
OUTPUT :
Q 13. Create a binary file with name and roll
number . Search for a given roll number and
display the name, if not found display
appropriate message.
OUTPUT :
Q 14. Write a random number generator using
functions that generates random numbers
between 1 and 6 (simulates a dice).
OUTPUT :
Q 15. Create a binary file with roll number,
name and marks. Input a roll number and
update the marks.
OUTPUT :
Q 16. Write a Python program to implement a
stack using list.
OUTPUT :
Q 17. Create a CSV file by entering user-id and
password, read and search the password for
given user-id.
OUTPUT :
Q 18. Write a menu based program to perform
the operation on stack in python.
OUTPUT :
SECTION B
Q 1. Write queries for the following Questions
based on the given table.
1. Write a Query to Create a new database in the name of
"STUDENTS".
Ans. CREATE DATABASE STUDENTS;
2. Write a Query to Open the database "STUDENTS"
Ans. USE STUDENTS;
3. Write a Query to create the above table called: Info.
Ans.
4. Write a query to list all the existing databases names.
Ans. SHOW DATABASES;
OUTPUT :
5. Write a query to list all the tables that exist in the
current database.
Ans. SHOW TABLES;
OUTPUT :
Q2. Write Queries for the following questions
based on the given table.
1. Write a Query to insert all the rows of above table into Info
table.
Ans. INSERT INTO Info
SELECT * FROM STU;
2. Write a Query to display all the details of the employees from
the above table ‘STU’.
Ans. SELECT * FROM STU;
OUTPUT :
3. Write a Query to Roll no. , Name and department of the
students from the above table ‘STU’.
Ans. SELECT Rollno, Name, Dept from STU;
OUTPUT :
4. Write a Query to select distinct department from STU table.
Ans. SELECT DISTINCT(DEPT) FROM STU;
OUTPUT :
5. To show all information about history department.
Ans. SELECT * FROM STU
WHERE Dept = 'HISTORY';
OUTPUT :
Q3. Write queries for the following Questions
based on the given table.
1. Write a Query to list name of female students in Hindi
department.
Ans. SELECT Name FROM STU
WHERE Gender = 'F' AND Dept = 'HINDI';
OUTPUT :
2. Write a Query to list of name of the students whose
ages are between 18 to 20.
Ans. SELECT Name FROM STU
WHERE Age BETWEEN 18 AND 20;
OUTPUT :
3. Write a Query to display the name of the students
whose name is starting with ‘A’.
Ans. SELECT Name FROM STU
WHERE Name LIKE 'A%';
OUTPUT :
4. Write a Query to list the names of those students
whose name have second alphabet ‘n’ in their.
Ans. SELECT Name FROM STU
WHERE Name LIKE '_n%';
OUTPUT :
Q4. Write queries for the following Questions
based on the given table.
1. Write a Query to delete the details of roll no. 8.
Ans. DELETE FROM STU
WHERE Rollno = 8;
OUTPUT :
2. Write a Query to change the fess of Student to 170 whose
Roll number is 1, if the existing fess is less than 130.
Ans. UPDATE STU
SET Fees = 170
WHERE Rollno = 1 AND Fees < 130;
OUTPUT :
3. Write a Query to add a new column Area of type
varchar in table STU.
Ans. ALTER TABLE STU
ADD Area VARCHAR(50);
OUTPUT :
4. Write a Query to display the names of all students
whose Area contains NULL.
Ans. SELECT Name FROM STU
WHERE Area IS NULL;
5. Write a Query to delete Area column from the table STU.
Ans. ALTER TABLE STU
DROP COLUMN Area;
OUTPUT :
6. Write a Query to delete table from database.
Ans. DROP TABLE STU;
OUTPUT :
Q5. Write queries for the following Questions
based on the given table.
1. To display the total Unit Price of all the products whose
Dcode as 102.
Ans. SELECT SUM(UnitPrice)
FROM Product
WHERE Dcode = 102;
OUTPUT :
2. To display details of all products in the stock table in
descending order of Stock date.
Ans. SELECT * FROM STOCK
ORDER BY StockDate DESC;
OUTPUT :
3. To display maximum unit price of products for each
dealer individually as per dcode from the table Stock.
Ans. SELECT Dcode, MAX(UnitPrice) AS MaxUnitPrice
FROM STOCK
GROUP BY Dcode;
OUTPUT :
4. To display the Pname and Dname from table stock and
dealers.
Ans. SELECT [Link], [Link]
FROM STOCK S
JOIN DEALERS D
ON [Link] = [Link];
OUTPUT :
SECTION C
Q1. Creating a python program to integrate
mysql with python (creating database and
table).
OUTPUT :
Q2. Creating a python program to integrate
mysql with python (inserting records and
displaying records).
OUTPUT :
Q3. Creating a python program to integrate
mysql with python (searching and
displaying records)
records).
OUTPUT :
Q4. Creating a python program to integrate
mysql with python (updating records).
OUTPUT :
BIBLIOGRAPHY
[Link]
Google
Chatgpt
Textbooks