Model PRACTICAL EXAM-2025
Paper-1
Section-A
1.
import csv
def add():
f = open ([Link]”, “w”, newline = “”)
mywriter = csv. writer (f, delimiter=’,’)
mywriter. writerow ([‘Playername,‘Runs scored’, ‘Matches played ‘])
while True:
name = input(“Enter the player name”)
runs = int (input (“enter the runs scored”))
match = int (input( “enter the no. of matches”))
l= [name, runs, match]
mywriter. writerow (l)
ch= input (“Do you want to continue ? Y/N”)
if ch. upper() != ‘Y”:
break
f. close()
def averageruns():
f = open(‘cricket .csv”, “r”, newline = ‘’)
myreader = csv. reader (f, delimiter = “;”)
next (myreader)
for r in myreader:
avg = int(r[1])/ int (r[2])
print (“Name:’r[0], “Total Runs:”,r [1],“Matches:”,r [2],
“Average:”,avg)
f. close()
# Main
print(‘’’ Menu
[Link] details.
[Link] average’’’)
n=int (input (“enter your choice”))
if n==1:
add()
if n==2:
averageruns()
else:
pass
2.
[Link] table Issues (Book_ ID char(3) primary Key, Qty_Issued int );
Insert into issues
Values (‘L02’,13),
(‘L04’ ,5);
Similarly, other records are inserted
Create table Books (Book_ID char (3) references Issues (Book_ID),
BookName varchar(20) NOT NULL, AuthorName varchar (30),
Publisher char (3),Price int, Qty int);
Insert into Books
Values (‘L01’, ‘Maths”, “Raman”, “ABC” 70,20);
Similarly, other records are inserted
(ii) Select Bookname, Authorname, Price from Books where publisher =
“ABC”;
(iii) Select * from Books natural join Issues;
(iv)delete from Books where price > 85;
Paper-2
Section-A
1.
import pickle as p
def addbooks():
with open (“books. Dat”, “ab” ) as f:
B_name = input(“enter the book name?”)
Author = input(“enter the author “)
Price = float Cinput Center the price
l=[B_name, Author, Price]
[Link] (l,f)
def displayprice():
f = open(“[Link]”, “rb”)
while True:
try:
e=[Link](f)
if e[2]> 300:
print(e)
except EOFError:
break
[Link]()
#main
print ( ‘’’Menu
1. Add books
2. Display
3. Exit ‘’’)
ch=int (input(“enter your choice”))
if ch == 1:
n=int (input(“enter the no. of records “))
for i in range(n):
addbooks()
elif ch = = 2:
displayprice()
else:
pass
2.
(i)create table Employee (No int primary Key,Name varchar(30),Salary
int,Zone varchar(10),
Age char(2),Grade char (2),Dept char (2));
Insert into Employee
Values (1, ‘Mukul’, 30000, ‘West “$ 28, ‘A’, 10),
(2, ‘Krithika, 35000, ‘Centre”, 30, ‘A’, 10);
Similarly other records are inserted
(ii) Select * from employee order by salary:
(iii)Select zone, count (zone) from employee group by zone;
(iv)Select grade, max (salary) from employee group by grade;
Paper-3
Section-A
1.
Stk = []
def push_cities (city):
for i in city:
if city [i]>35:
Stk. Append (i)
def pop():
while Stk:
print (Stk. Pop())
else:
print (“Stack underflow”)
#main
While True:
print(‘’’Menu
[Link] cities
[Link] and display
[Link]’’’)
ch=int (input (“enter your choice”))
if ch ==1:
city = {“Chennai”: 40, “Bengaluru”: 34,” Trichy” : 41,
“Madurai”: 44, “Ooty”: 2}
push_cities (city)
elif ch ==2
pop()
else:
break
Section-B
2.
i. Create table Items (ID char (4) primary Key, PName varchar (20),Price
float,MDATE date, Qty int );
Insert into Items
Values (‘T001’, ‘Soap’, 12.00, ‘2007-03-11’,200);
Similarly, other records are inserted
(ii)Select Pname, Price*Qty from Items where Mdate between 2007-01-01’
and ‘2007-12-31; or
Select Pname, Price*Qty from Items where year(Mdate)=2007
(ⅲ)Update items set Qty = Qty + 20 where pname in (‘soap’, ‘paste ‘);
(iv)delete from items where price between 10 and 30;
Paper-4
Section-A
1.
def countlines ():
f = open (“[Link]””, “r”)
c=0
for i in f:
If i[0]. Upper()= = ‘S’:
c+=1
print (“no. of lines starting with s”, c)
f. close()
def Displayfour():
f = open(“[Link]”,”r”)
s= f. read()
l= s. split()
for i in l:
if len (i) = = 4:
print (i)
f. close
#main
While True:
print (‘’’Menu
1. Count the lines.
[Link] letter words
[Link]’’’)
ch=int(input(“enter ur choice”))
if ch==1:
countlines()
if ch==2:
Displaylines()
else:
break
Section-B
2.
[Link] table Items (ID char (4) primary Key, PName varchar (20),Price
float,MDATE date, Qty int );
Insert into Items
Values (‘T001’, ‘Soap’, 12.00, ‘2007-03-11’,200);
Similarly, other records are inserted
Create table Company( ID char(4) references Items(ID), Comp varchar(20),
City varchar(20));
Insert into Company
Values(‘T001’,’HLL’, ‘Mumbai’);
Similarly, other reacords are inserted
(ii) delete from items where year(Mdate)<2007;
(iii) select Pname, Comp from Items I , Company C where [Link]=[Link] where
name like ‘A%’;
(iv) select city, count(city) from Company group by city;
Paper-5
Section-A
1.
Expensive= []
def push(product):
for i in product:
if product [i]>10000:
Expensive. Append (i)
def pop():
if Expensive:
print (Expensive. Pop())
else:
print (“Stack underflow”)
def display():
if Expensive:
for i in Expensive[::-1]:
print(i)
else:
print(“Stack underflow”)
#Main
While True:
Print(‘’’Menu
[Link]
[Link]
[Link]
4. Exit’’’)
ch=int (input (“enter your choice”))
if ch ==1:
product={“Speaker”:1000,”Laptop”:30000,”Ac”:35000,”Monitor”:9000}
push(product)
elif ch ==2
display()
elif ch==3:
pop()
else:
break
2.
a)
Create table Hospital( ID int primary key, Name varchar(20), Age char(2),
Department varchar(30), Charges int , Gender char(1));
Insert into hosital
Values(1, ‘Arprit’,62,’Surgery’, 300, ‘M’);
Similary other records are inserted
b) select * from hosital where department=”Gynecology”;
c) select Name from hospital where gender=’F’ and department=’ENT’;
d) select name , gender from hospital where age between 40 and 70 order
by name;
Paper-6
Section-A
1.
def countwords ():
f= open (“[Link]””, “r”)
cshe=che=0
s=[Link]()
l=[Link]()
for i in l:
if [Link]()==’HE’:
che+=1
elif [Link]()==’SHE’:
cshe+=1
print (“no. of she’s:’ cshe)
print(“no. of he’s:”che)
f. close()
def Displaylines():
f = open(“[Link]”,”r”
l= [Link]()
for i in l:
if i[0].lower() in “aeiou”:
print (i)
f. close
#main
while True:
Print (‘’’Menu
1. Count the words he and she
[Link] lines
[Link]’’’)
ch=int(input(“enter ur choice”))
if ch==1:
Countwords()
if ch==2:
Displaylines()
else:
Break
2.
i.
Create table Items (ID char (4) primary Key, PName varchar (20),Price
float,MDATE date, Qty int );
Insert into Items
Values (‘T001’, ‘Soap’, 12.00, ‘2007-03-11’,200);
Similarly, other records are inserted
(ii)Select Pname, Price*Qty from Items where Mdate between 2007-01-01’
and ‘2007-12-31; or
Select Pname, Price*Qty from Items where year(Mdate)=2007
(ⅲ)Update items set Qty = Qty + 20 where pname in (‘soap’, ‘paste ‘);
(iv)delete from items where price between 10 and 30;