0% found this document useful (0 votes)
6 views5 pages

Set 1 - Bin Search

The document outlines the practical examination for Computer Science (083) for the All India Senior School Certificate Examination 2023-24, detailing tasks such as writing a menu-driven program to manage a binary file and SQL queries based on provided tables. It includes specific programming tasks, including adding, displaying, and searching records in a binary file named 'shoes.dat', as well as SQL queries for student data. The examination consists of multiple components, including a practical report, a project, and a viva voce.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Set 1 - Bin Search

The document outlines the practical examination for Computer Science (083) for the All India Senior School Certificate Examination 2023-24, detailing tasks such as writing a menu-driven program to manage a binary file and SQL queries based on provided tables. It includes specific programming tasks, including adding, displaying, and searching records in a binary file named 'shoes.dat', as well as SQL queries for student data. The examination consists of multiple components, including a practical report, a project, and a viva voce.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

All India Senior School Certificate Examination 2023-24

Practical Examination - Computer Science (083)


SET 1
Time: 3:00 Hours Max. Marks: 30
Q 1. a) Write a menu drive program to perform following operations into a binary file named as
shoes.dat 8
1. Add record
2. Display records
3. Search record
4. Exit
The structure of file content is: [s_id, name, brand, type, price]
b)Consider the tables below and write the sql queries based on the data given 4
Table Name : Students

Table name : Sports

i. Display the rollno,age,gname from students and sports with gname contains ‘R’
ii. Display the gender wise average of total from the students table.
iii. Display the age,dob and gender of students who’s DOB is given and age more than 15.
iv. Display the sname and gender of students who’s age is neither 12 nor 22.
Q2. Practical Report File 7
Q3. Project 8
Q4. Viva Voce 3
Solution:

import pickle
def addrec():
f=open("shoes.dat","ab")
s_id=int(input("Enter Shoes ID:"))
name=input("Enter shoes name:")
brand=input("Enter Brand:")
typ=input("Enter Type:")
price=float(input("Enter Price:"))
l=[s_id,name,brand,typ,price]
pickle.dump(l,f)
print("Record Added Successfully.")
f.close()

def disprec():
f=open("shoes.dat","rb")
while True:
try:
dt=pickle.load(f)
print(dt)
except EOFError:
break
f.close()

def searchrec():
si=int(input("Enter shoes ID:"))
f=open("shoes.dat","rb")
fl=False
while True:
try:
dt=pickle.load(f)
for i in dt:
if i==si:
fl=True
print("Record Found...")
print("ID:",dt[0])
print("Name:",dt[1])
print("Brand:",dt[2])
print("Type:",dt[3])
print("Price:",dt[4])
except EOFError:
break
if fl==False:
print("Record not found...")
f.close()

while True:
print('''
1. Add Record
2. Display Record
3. Search Record
4. Exit
''')
ch=int(input("Enter your choice:"))
l=[]
if ch==1:
addrec()
elif ch==2:
disprec()
elif ch==3:
searchrec()
elif ch==4:
break
else:
print("Invalid Choice")
b. SQL
Table Creation:

i. Display the rollno,age,gname from students and sports with gname contains ‘R’

ii. Display the gender wise average of total from the students table.
iii. Display the age,dob and gender of students who’s DOB is given and age more than 15.

iv. Display the sname and gender of students who’s age is neither 12 nor 22.

You might also like