Cs Practical File
Cs Practical File
Cs Practical File
Session 2023
2023-2024
2024
S.NO
inDeX
DESCRIPTION Page No. Remark
S.no
PYTHON PROGRAMS
1. WAP in Python to Find the Factorial of a number using function.
3. Write a program in Python to input the value of x and n and print the sum of the following series
S.no1+x+x^2+x^3+-----------x^n DESCRIPTION Page No. Remark
4. WAP in python to read a text file and print the number of vowels and consonants in the file
5. WAP in Python to read a text file and print the line or paragraph starting with the letter ‘S’
6. WAP in Python to read a text file and print the number of uppercase and lowercase letters in
The file
7. WAP in Python to create a binary file with name and roll number of the students. Search for
a given roll number and display the name of student
8. Create a binary file with roll_no, name and marks of some students and update the marks of
specific student.
9. Create a binary file with eid, ename and salary and update the salary of the employee
10. Create a text file and remove the lines from the file which contains letter ‘K’
11. Create a binary file with 10 random numbers from 1 to 40 and print those numbers.
12. Write a program in Python to create a CSV file with the details of 5 students.
14. Write a menu driven program which insert, delete and display the details of an employee such
as eid, ename and salary using Stack
15. Write a menu driven program which insert, delete and display the details of a book such as
book_id, book_name and price using Stack
16. Write a menu driven program which insert, delete and display the details of a
student such as roll_no, sname and course using Stack.
17. Write a menu driven program which insert, delete and display the details of a movie such as
movie_id, mname and rating using Stack.
18. Write a menu driven program which insert, delete and display the details of a product such as
pid, pname and price using Stack
19. Write a menu driven program which insert, delete and display the details of a club such as
club_id, cname and city using Stack.
20. Write a menu driven program to demonstrate add, display, update, delete and exit. Performed on a
table Book containing (bid, bname, bprice) through python-MySql connectivity
21. Write a menu driven program to demonstrate add, display, update, delete and exit. Performed on
a table Product containing (pid, pname, price) through python-MySql connectivity.
22. Write a menu driven program to demonstrate add, display, update, delete and exit. Performed on a
table club containing (club_id, cname, city) through python-MySql connectivity
23. Write a menu driven program to demonstrate add, display, update, delete and exit. Performed on a
table student containing (sid, sname, course) through python-MySql connectivity.
24. Write a menu driven program to demonstrate add, display, update, delete and exit. Performed on a
table movie containing (mid, mname, rating) through python-MySql connectivity
25. Write a menu driven program to demonstrate add, display, update, delete and exit. Performed on a
table Employee containing (eid, ename, salary) through python-MySql connectivity
MYSQL QUERIES
1. Create a database
2. To create a student table with the student id, class, section, gender, name, dob, and marks as
attributes where the student id is the primary key.
5. To increase the marks by 5% for those students who are scoring marks more than 30 .
7. To display student_id, name and marks of those students who are scoring marks more than 30.
10. To add a new column email in the student table with appropriate data type
11. To add the email id’s of each student in the previously created email column
12. To display the information of all the students, whose name starts with ‘S’
13. To display the student_id, name, dob of those students who are born between ‘2005-01-01’ and
‘2005-12-31’
14. To display the student_id, name, dob, marks, email of male students in ascending order of their name
15. To display the student_id, gender, name, dob, marks, email of students in descending order of their marks.
16. To display the unique section name from the student table
17. Create a student table with student id, name and marks as attribute, where the student id is the
Primary key
20. Use the Select command to get the details of the students with marks more than 30
PYTHON PROGRAMS
Practical No-1:: WAP in Python to Find the Factorial of a number using function
OUTPUT:
OUTPUT:
Practical No-3: Write a program in Python to input the value of x and n and print
the sum of the following series
1+x+x^2+x^3+-----------x^n
x^n
OUTPUT:
Practical No-4:WAP
WAP in python to read a text file and print the number of vowels
and consonants in the file
OUTPUT:
Practical No-5: WAP in Python to read a text file and print the line or
paragraph starting with the letter ‘S’
OUTPUT:
Practical No-6: WAP in Python to read a text file and print the number of
uppercase and lowercase letters in the file
OUTPUT:
Practical No-7: WAP in Python to create a binary file with name and roll number of the students.
Search for a given roll number and display the name of student.
OUTPUT:
Practical No-8: Create a binary file with roll_no, name and marks of some students and update the
marks of specific student.
OUTPUT:
Practical No-9: Create a binary file with eid, ename and salary and update the salary of the employee
OUTPUT:
Practical No-10: Create a text file and remove the lines from the file which contains letter ‘K’
OUTPUT:
Practical No-11: Create a binary file with 10 random numbers from 1 to 40 and print those numbers.
OUTPUT:
Practical No-12: Write a program in Python to create a CSV file with the details of 5 students.
OUTPUT:
OUTPUT:
Practical No-14: Write a menu driven program which insert, delete and display the details of an
employee such as eid, ename and salary using Stack.
OUTPUT:
Practical No-15: Write a menu driven program which insert, delete and display the details of a book
such as book_id, book_name and price using Stack
OUTPUT:
Practical No-16: Write a menu driven program which insert, delete and display the details of a
student such as roll_no, sname and course using Stack.
OUTPUT:
Practical No-17: Write a menu driven program which insert, delete and display the details of a
movie such as movie_id, mname and rating using Stack.
OUTPUT:
Practical No-18: Write a menu driven program which insert, delete and display the details of a
product such as pid, pname and price using Stack
OUTPUT:
Practical No-19: Write a menu driven program which insert, delete and display the details of a club
such as club_id, cname and city using Stack.
OUTPUT:
Practical No-20: Write a menu driven program to demonstrate add, display, update, delete and exit.
Performed on a table Book containing (bid, bn
bname, bprice) through python-MySql
MySql connectivity
OUTPUT:
Practical No-21: Write a menu driven program to demonstrate add, display, update, delete and exit.
Performed on a table Product containing (pid, pname, price) through python
python-MySql connectivity.
OUTPUT:
Practical No-22: Write a menu driven program to demonstrate add, display, update, delete and exit.
Performed on a table club containing (club_id, cname, city) through python
python-MySql
MySql connectivity
OUTPUT:
Practicle No 23: Write a menu driven program to demonstrate add, display, update, delete and exit.
Performed on a table student containing (sid, sname, course) through python
python-MySql
MySql connectivity.
OUTPUT:
Practicle No 24: Write a menu driven program to demonstrate add, display, update, delete and exit.
Performed on a table movie containing (mid, mname, rating) through python
python-MySql
MySql connectivity
OUTPUT:
Practicle No 25: Write a menu driven program to demonstrate add, display, update, delete and exit.
Performed on a table Employee containing (eid, ename, salary) through python
python-MySql
MySql connectivity
OUTPUT:
MYSQL QUERIES
Q – 1: Create a database
Syntax:
Q – 2: To create a student table with the student id, class, section, gender, name, dob, and marks as
attributes where the student id is the primary key
Primary key is a constraint of an attribute which cannot be NULL or duplicate. Only one primary
key is allowed in a table.
Syntax:
To delete the specific record from the table use delete command/query.
Syntax:
Note: If we don’t use where clause It delete all the records one by one ffrom
rom the table
Q – 5: To increase the marks by 5% for those students who are scoring marks more than 30.
Syntax
Q – 7: To display student_id, name and marks of those students who are scoring marks more than
30.
Aggregate Function:
5 Aggregate function in SQL:
1. SUM() : Find the sum of the values of specific column
2. MAX() : Find the maximum value from the specific column
3. MIN() : Find the minimum value from the specific column
4. AVG() : Find the average of all values from the specific column
5. COUNT() : Count the value from the specific column
Q – 10: To add a new column email in the student table with appropriate data type.
type
Q – 11: To add the email id’s of each student in the previously created email column.
Q – 12: To display the information of all the students, whose name starts with ‘S’
‘S’.
Q – 13: To display the student_id, name, dob of those students who are born between ‘2005-01-01’
‘2005
and ‘2005-12-31’.
Q – 14: To display the student_id, name, dob, marks, email of male students in ascending order of
their name.
Q – 15: To display the student_id, gender, name, dob, marks, email of students in descending order
of their marks.
Q – 16: To display the unique section name from the student table.
Q – 17: Create a student table with student id, name and marks as attribute, where the student id is
the primary key.
Q –19:
19: Delete the details of a student in the student table.
Q –20:
20: Use the Select command to get the details of the students with marks more than 30.
30