Final Practical File
Final Practical File
Submitted by :
Teacher Name : Mr. Rajendra Sonvane
Class : XII
ACKNOWLEDGEMENT
I wish to express my deep sense of
gratitude and indebtedness to our learned teacher
Mr. Rajendra Sonvane, PGT COMPUTER SCIENCE,
Shanti Asiatic School, Vastral for his invaluable help,
advice and guidance in the preparation of this
practical file.
I am also greatly indebted to our principal
Mrs. Suchitra Vijayaraghvan and school authorities
for providing me with the facilities and requisite
laboratory conditions for making this practical file.
I also extend my thanks to a number of
teachers, my classmates and friends who helped me
to complete this practical file successfully
10 Write a program to write data into binary file marks.dat and 16-07-24
display the records of students who scored more than 95
marks.
11 Read a CSV file batsman.csv and print the contents in a proper 26-07-24
format. The data for top5.csv file are as following:
12 Read a CSV file batsman.csv and print them with tab delimiter. 29-07-24
Ignore first row header to print in tabular form.
13 31-07-24
Write a program to count number of records from the CSV file.
Output:
2. Write a python Program to find the maximum of three numbers using recursion.
Output :
3. Write a python program to demonstrate the concept of variable length argument to
calculate product and power of the first 10 numbers.
Output :
Part 2 Data file handling
4. Create a text file "text.txt" in python and ask the user to write a single line text by user
input.
Output :
5. Write a program to capitalize the first letter of a sentence form data.txt file to file1.txt.
6. Write a program to replace all spaces from text with - (dash) from the file text.txt.
Output:
7. Write a program to know the cursor position and print the text according to the
below-given specifications.
Output:
9. Write a program to inserting/appending a record in a binary file-student.
Output:
10.Write a program to write data into binary file marks.dat and display the records of
students who scored more than 95 marks.
Output:
11. Read a CSV file batsman.csv and print the contents in a proper format. The data for
top5.csv file are as following:
Output:
12. Read a CSV file top5.csv and print them with tab delimiter. Ignore first row header to
print in tabular form.
Output:
13. Write a program to count number of records from the CSV file.
Output:
14. Write a menu-driven python program to implement stack operation.
Output:
15. Write a program to implement a stack for the employee details (empno, name).
Output:
Part 4 SQL queries
16. Consider the following MOVIE table and write the SQL queries based on it.
d) Display movie id, movie name and production cost for all movies with production cost
greater than 150000 and less than 1000000.
Ans. Select Movie_Id, Movie_Name, Production_Cost from Movie
Where Production_Cost >150000 and Production_Cost <1000000;
17. Consider the given table patient and Write following queries:
d) As per the preferences of the students four teams were formed as given below. Insert
these four rows in TEAM table:
a. Row 1: (1, Jal)
b. Row 2: (2, Vayu)
c. Row 3: (3, Agni)
d. Row 3: (4, Prithvi)
Ans. Insert into team
Values(1,’Jal’);
e) Show the contents of the table TEAM using a DML statement.
f) Now create another table MATCH_DETAILS and insert data as shown below. Choose
appropriate data types and constraints for each attribute.
a) Display the match id, team id, team score who scored more than 70 in first innings
along with team name.
Ans.
Select Match_Details.Match_ID,Match_Details.First_Team_ID,Team.TeamName,
b) Display maximum price of items for each dealer individually as per dcode from stock.
Ans. Select dcode,max(unitprice) from stock
Group by dcode;
c) Display all the items in descending orders of item names.
Ans. Select * from stock
Order by Item desc;
d) Display average price of items for each dealer individually as per dcode from stock
which average price is more than 5.
Ans. Select dcode,avg(unitprice) from stock
group by dcode
having avg(unitprice)>5;
Output:
Output:
Output:
22. Perform all the operations with reference to table ‘student’ through MySQL- Python
connectivity.
Output:
23. SS public school is managing student data in “student” table in “School” database. Write
a python code that connects to database school and retrieves all records and displays total
number of students.
Output:
24. Divine Hotel needs to store ,retrieve and delete the records of its clients. Devlop an
interface that provides front-end interaction through python and stores and updates
record using MySQL. The table clients can be used to perform different operations.
Answer the following questions.
a. Write a program to read and display all the records from the clients table having bill
amount more than Rs. 10000.
Output:
b. Write a program to update the records of the clients by reducing the bill amount Rs.
1000 of all those clients who are having bill > 150000.
Output :