0% found this document useful (0 votes)
3 views

Set 4 - CSV

The document outlines the practical examination for Computer Science (083) for the All India Senior School Certificate Examination 2023-24, including a menu-driven program for managing telephone records and SQL queries for trainer data. It specifies tasks such as adding, displaying, and searching records in a CSV file, as well as SQL queries to filter trainer information based on various criteria. The examination consists of multiple sections, including practical report, project, and viva voce.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Set 4 - CSV

The document outlines the practical examination for Computer Science (083) for the All India Senior School Certificate Examination 2023-24, including a menu-driven program for managing telephone records and SQL queries for trainer data. It specifies tasks such as adding, displaying, and searching records in a CSV file, as well as SQL queries to filter trainer information based on various criteria. The examination consists of multiple sections, including practical report, project, and viva voce.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

All India Senior School Certificate Examination 2023-24

Practical Examination - Computer Science (083)


SET 4
Time: 3:00 Hours Max. Marks: 30
Q 1. a) Write a menu drive program to perform the following operations into telephone.csv.
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 table given below and write the sql queries based on the table data 4
Table Name : Trainer

a. Display the details of the trainer who joined before june 2001 and after dec2001
b. Display the name and salary of the trainer who belongs to Mumbai and Delhi
c. Increase the salary by 5% for the trainers who’s name ends with A and from Mumbai
d. To display total number of trainers whose salary is more than 75000.

Q2. Practical Report File 7


Q3. Project 8
Q4. Viva Voce 3
Solution:
import csv
def add_record():
f1=open("telephone.csv",'r')
ro=csv.reader(f1)
l=list(ro)
f=open("telephone.csv",'a',newline='')
wo=csv.writer(f)
if len(l)==0:
wo.writerow(['Subscriber ID','name','brand','customer type','Price'])
else:
s_id=int(input("Enter Subscriber ID:"))
name=input("Enter name of subscriber:")
brand=input("Enter brand of telephone:")
typ=input("Enter customer type:")
price=float(input("Enter Price:"))
wo.writerow([s_id,name,brand,typ,price])
print("Record addedd Successfully.")
f.close()

def display_record():
f=open("telephone.csv",'r')
ro=csv.reader(f)
l=list(ro)
for i in range(1,len(l)):
print(l[i])
f.close()

def search_record():
f=open("telephone.csv","r")
ro=csv.reader(f)
sid=input("Enter id to search:")
found=0
for i in ro:
if sid==i[0]:
found=1
print("Record Found:")
print(i)
if found==0:
print("Record not found...")
f.close()

def menu():
while True:
print('''
1. Add record
2. Display record
3. Search record
4. Exit
''')
ch=int(input("Enter your choice:"))
if ch==1:
add_record()
elif ch==2:
display_record()
elif ch==3:
search_record()
elif ch==4:
print("Over and exit!!")
break
else:
print("Invalid Choice")
menu()
SQL

a. Display the details of the trainer who joined before june 2001 and after dec2001

b. Display the name and salary of the trainer who belongs to Mumbai and Delhi

c. Increase the salary by 5% for the trainers who’s name ends with A and from Mumbai

d. To display total number of trainers whose salary is more than 75000.

You might also like