# CBSE CS Class 12 Board Practical Paper 1 Solution 2024

In this article, I will discuss CS Class 12 Board Practical Paper 1 Solution 2024. The board has released the guidelines for conducting practical exams in January 2024. Let us begin!

Topics Covered

## CS Class 12 Board Practical Paper 1 Solution 2024

The first question is the Python program. I have taken this from file handling. In this Let us begin with question 1:

### Question 1 – Python Program

Q – 1 a) Write a menu drive program to perform the following operations into a binary file shoes.dat 8

2. Display records
3. Search record
4. Exit

The structure of file content is: [s_id, name, brand, type, price]

### Solution Question 1

``````import pickle
l=[]
found=0
f=open("shoes.dat","ab")
s_id=int(input("Enter Shoes ID:"))
nm=input("Enter Name:")
br=input("Enter Brand:")
ty=input("Enter Type:")
pr=int(input("Enter Price:"))
l=[s_id,nm,br,ty,pr]
pickle.dump(l,f)
f.close()

def dis_rec():
f=open("shoes.dat","rb")
while True:
try:
print(l)
except EOFError:
f.close()
break
def search_record():
f=open("shoes.dat","rb")
s_id=int(input("Enter Shoe ID:"))
while True:
try:
if l[0]==s_id:
found=1
print("Record Found...",l)
else:
found=0
except EOFError:
f.close()
break
if found==0:

while True:
print('''
2. Display Record
3. Search Record
4. Exit
''')
if ch==1:
elif ch==2:
dis_rec()
elif ch==3:
search_record()
elif ch==4:
break
else:
print("Invalid Choice")
``````

b) Observe the following tables of customer and order and write queries given below

Table – Customer

Table – Order

(i) Display CustomerID, CustomerName and bill amount for customers belonging to Ahmedabad.

Ans.: select customerid, customername, orderamt from customer, order where customer.customerid = order.customerid and city=’ahmedabad’;

(ii) Display the order details in descending order of amount

Ans.: select * from order order by orderamt desc;

(iii) Display OrderId, Orderdate , customername and mobileno of customers whose name ends with ‘k’ and name contains letter ‘h’

Ans.: select orderid, orderdate, customername, mobileno from customer, order where customer.customerid = order.customerid and (customername like ‘%k’ or customername like ‘%h%’;

(iv) Display the sum of order amount for each city

Ans.: select city,sum(orderamt) from customer,order where customer.customerid = order.customerid group city;

Watch this video for more understanding: