Practical program list(cs)2024-25
Practical program list(cs)2024-25
G
AISSCE PRACTICAL EXAMINATION-2024-‘25
CLASS:12 SUBJECT: COMPUTER SCIENCE
Table: INTERIORS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double bed 23/02/02 32000 15
2 Soft touch Baby cot 20/01/02 9000 10
3 Jerry’s home Baby cot 19/02/02 8500 10
4 Rough wood Office Table 01/01/02 20000 20
5 Comfort zone Double bed 12/01/02 15000 20
6 Jerry look Baby cot 24/02/02 7000 19
7 Lion king Office Table 20/02/02 16000 20
8 Royal tiger Sofa 22/02/02 30000 25
9 Park sitting Sofa 13/12/01 9000 15
10 Dine Paradise Dining Table 19/02/02 11000 15
Table: NEWONES
NO ITEMNAME TYPE DATEOFSTOCKS PRICE DISCOUNT
11 White wood Double bed 23/03/03 20000 20
12 James 007 Sofa 20/02/03 15000 15
13 Tom look Baby cot 21/02/13 7000 10
a)To show all information about the sofas from the INTERIORS table.
b)To list the ITEMNAME which are priced at more than 10,000 from the INTERIORS table.
c)To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before
22/01/02 from the INTERIERS table in the descending order of ITEMNAME.
d)To display ITEMNAME and DATEOFSTOCK of those items, in which the discountPercentage is more than 15
from INTERIORS table.
Q4) a) Write a Python program to generate and print a list of the first and last 5 elements where the values
are square numbers between 1 and 30 (both included)
b) Write SQL command for (a) to (d) on the bases of tables FURNITURE AND ARRIVALS.
Table: FURNITURE
(c )To list names of all teachers with their date of joining in ascending order.
(d)To display teacher’s Name, Salary, Age for male teacher only
Q6) a) Write a program using function named count_Dwords() in Python to count the words ending with a
digit in a text file “Details.txt”
b)
TABLE :SHOP
ID Sname Area
S0001 ABC Computeronics CP
S0002 All Infotech Media GK II
S0003 Tech Shoppe CP
S0004 Greeks Techno Soft Nehru Place
S0005 Hitech Tech Store Nehru Place
TABLE ACCESSORIES
No Name Price ID
A01 Mother Board 12000 S01
A02 Hard Disk 5000 S01
A03 Keyboard 500 S02
A04 Mouse 300 S01
A05 Mother Board 13000 S02
A06 Keyboard 400 S03
A07 LCD 6000 S04
T08 LCD 5500 S05
T09 Mouse 350 S05
T10 Hard Disk 4500 S03
i)To display Name and Price of all the accessories in ascending order of their Price.
ii)To display Id and SName of all Shop in Nehru Place.
iii)To display Minimum and Maximum Price of each Name of accessories.
iv)To display all Sname in descending order.
Q7) a) Write a program to read a text file ‘english.txt’ and display the number of vowels / consonants
/uppercase/ lowercase characters available in the file
b) Consider the following table GARMENT and FABRIC, Write SQL commands for the statements (i)to (iv)
TABLE GARMENT
GCODE DESCRIPTION PRICE FCODE READYDATE
10023 PENCIL SKIRT 1150 F 03 19-DEC-08
10001 FORMAL SHIRT 1250 F 01 12-JAN-08
10012 INFORMAL SHIRT 1550 F 02 06-JUN-08
10024 BABY TOP 750 F 03 07-APR-07
10090 TULIP SKIRT 850 F 02 31-MAR-07
10019 EVENING GOWN 850 F 03 06-JUN-08
10009 INFORMAL PANT 1500 F 02 20-OCT-08
10007 FORMAL PANT 1350 F 01 09-MAR-08
FCODE TYPE
F 04 POLYSTER
F 02 COTTON
F 03 SILK
F01 TERELENE
(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
(ii) To display the details of all the GARMENT, which have READYDATE in between 08-DEC-07 and16-
JUN-08 (inclusive if both the dates).
(iii) To display the average PRICE of all the GARMENT, which are made up of fabric with
FCODE asF03.
(iv) To display fabric wise highest and lowest price of GARMENT from GARMENT
table. (DisplayFCODE of each GARMENT along with highest and lowest Price.
Q8) a) Write a method COUNTLINES() in Python to read lines from text file ‘TESTFILE.TXT’ and display the
lines which are not starting with any vowel.
b) Consider the table TEACHER given below. Write commands in SQK for (i) to (iv)
ID NAME DEPARTMENT HIREDATE CATEGORY GENDER SALARY
1 TANIYA SOCIALSTUDIES 1994-03-17 TGT F 25000
2 ABHISHEK ART 1990-12-02 PRT M 20000
3 SANJANA ENGLISH 1980-05-16 PGT F 30000
4 VISHWAJEET ENGLISH 1989-10-16 TGT M 25000
5 AMAN HINDI 1990-01-08 PRT F 22000
6 PRITAM MATH 1980-03-17 PRT F 21000
7 RAJKUMAR SCIENCE 1994-02-09 TGT M 27000
8 SITAL MATH 1980-11-17 TGT F 24500
Attempt the following –
Q10) a) Count the total number of upper case, lower case, and digits used in the text file “merge.txt”.
b) Consider the following table GARMENT. Write SQL commands for the following statements.
GCODE DESCRIPTION PRICE FCODE READYDATE
10023 SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TOP 850 F02 31-MAR-07
10019 EVENING DRESS 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10017 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 31-OCT-08
To Display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and16-JUN-08(inclusive
of both the dates)
To display FCODE wise highest and lowest price of GARMENTs from GARMENT table.
To find the average price of the garments.
Q11) a) Find the total occurrences of a specific word from a text file:
b) Write queries (a) to (d) based on the tables EMPLOYEE and DEPARTMENT given below:
Table: EMPLOYEE
EMPID NAME DOB DEPTID DESIGN SALARY
120 ALISHA 23-JAN-1978 D001 MANAGER 75000
123 NITIN 10-OCT-1977 D002 AO 59000
129 NAVJOT 12-JUL-1971 D003 SUPERVISOR 40000
130 JIMMI 30-DEC-1980 D004 SALES REP
131 FAIZ 06-APR-1984 D001 DEP MANAGER 65000
Table: DEPARTMENT
DEPTID DEPTNAME FLOORNO
D001 PERSONAL 4
D002 ADMIN 10
D003 PRODUCTION 1
D004 SALES 3
(a) To display the average salary of all employees, department wise.
(b) To display name and respective department name of eachemployee whose salary is more than 50000.
(c) To display the names of employees whose salary is not known, inalphabetical order.
(d)To display DEPTID from the table EMPLOYEEwithout repeat
Consumer
C_ID SupplierID CName CAddress Ccity
C101 JR01 Varun Mishra 5, Central Avenue Delhi
C342 PH02 Sonia Singh 116, Block A Delhi
C112 JR01 Prabhu S 2A, Andheri East Mumbai
C008 PS15 Abhishek Das B5, CS Terminals Panjim
C035 JT50 Rahul Jain 13,B Mayur Vihar Mumbai
(a) To display the C_ID, Supplier name, Supplier Address, Consumer Name and Consumer Address
for every Consumer
Q14)a) Write a program that copies a text file “source.txt” onto “target.txt” barring the lines starting with
a ‘@’ sign.
b) Write SQL commands for (a) to (d) on the basis of table CLUB.
Table: CLUB
COACH ID COACH NAME AGE SPORTS DATEOFAPP PAY SEX
b) Write queries (a) to (d) based on the tables EMPLOYEE and DEPARTMENT given below:
Table: EMPLOYEE
EMPID NAME DOB DEPTID DESIGN SALARY
120 ALISHA 23-JAN-1978 D001 MANAGER 75000
123 NITIN 10-OCT-1977 D002 AO 59000
129 NAVJOT 12-JUL-1971 D003 SUPERVISOR 40000
130 JIMMI 30-DEC-1980 D004 SALES REP
131 FAIZ 06-APR-1984 D001 DEP MANAGER 65000
Table: DEPARTMENT
DEPTID DEPTNAME FLOORNO
D001 PERSONAL 4
D002 ADMIN 10
D003 PRODUCTION 1
D004 SALES 3
(a) To display the average salary of all employees, department wise.
(b)To display name and respective department name of each employee whose salary is more than 50000.
(c)To display the names of employees whose salary is not known, inalphabetical order.
(d)To display DEPTID from the table EMPLOYEEwithout repeat
Table: INTERIORS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double bed 23/02/02 32000 15
2 Soft touch Baby cot 20/01/02 9000 10
3 Jerry’s home Baby cot 19/02/02 8500 10
4 Rough wood Office Table 01/01/02 20000 20
5 Comfort zone Double bed 12/01/02 15000 20
6 Jerry look Baby cot 24/02/02 7000 19
7 Lion king Office Table 20/02/02 16000 20
8 Royal tiger Sofa 22/02/02 30000 25
9 Park sitting Sofa 13/12/01 9000 15
10 Dine Paradise Dining Table 19/02/02 11000 15
Table: NEWONES
NO ITEMNAME TYPE DATEOFSTOCKS PRICE DISCOUNT
11 White wood Double bed 23/03/03 20000 20
12 James 007 Sofa 20/02/03 15000 15
13 Tom look Baby cot 21/02/13 7000 10
a)To show all information about the sofas from the INTERIORS table.
b)To list the ITEMNAME which are priced at more than 10,000 from the INTERIORS table.
c)To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before
22/01/02 from the INTERIERS table in the descending order of ITEMNAME.
d)To display ITEMNAME and DATEOFSTOCK of those items, in which the discountPercentage is more than 15
from INTERIORS table.
Q18) a) Write a program to write into file “one.csv” Rollno, Name and Marks separated by comma. It
should have header row and then take in input from the user for all following rows. The format of the file
should be as shown if user enters 2 records.
Roll.No,Name,Marks
20,ronit,67
56,nihir,69
b) Write SQL command for (a) to (d) on the bases of tables FURNITURE AND ARRIVALS.
Table: FURNITURE
NO. ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 White lotus Double Bed 23/02/02 30000 25
2 Pink feather Baby cot 20//01/02 7000 20
3 Dolphin Baby cot 19/02/02 9500 20
4 Decent Office Table 01/01/02 25000 30
5 Comfort zone Double Bed 12/01/02 25000 25
6 Donald Baby cot 24/02/02 6500 15
7 Royal Finish Office Table 20/02/02 18000 30
8 Royal tiger Sofa 22/02/02 31000 30
9 Econo sitting Sofa 13/12/01 9500 25
10 Eating paradise Dining Table 19/02/02 11500 25
a)To show all information about the baby cots from the FURNITURE table.
b)To list the ITEMNAME which are priced at more than 15000 from the FURNITURE table.
c)To list ITEMNAME AND TYPE of those items, in which DATEOFSTOCK is before 22/01/02from the FURNITURE table in
descending order of ITEMNAME.
d)To display ITEMNAME and DATEOFSTOCK of those items, in which the DISCOUNT percentage is more than 25 from
Q19) a) Write a program to read all content of “student.csv” and display records of only those students who
scored more than 80 marks. Records stored in students is in format : Rollno, Name, Marks
b) Write SQL commands for (a) to (d) on the basis of Teacher relation given below:
Relation: Teacher
No Name Age Department Date ofjoin Salary Sex
(c )To list names of all teachers with their date of joining in ascending order.
(d)To display teacher’s Name, Salary, Age for male teacher only
No Name Price ID
A01 Mother Board 12000 S01
A02 Hard Disk 5000 S01
A03 Keyboard 500 S02
A04 Mouse 300 S01
A05 Mother Board 13000 S02
A06 Keyboard 400 S03
A07 LCD 6000 S04
T08 LCD 5500 S05
T09 Mouse 350 S05
T10 Hard Disk 4500 S03
i)To display Name and Price of all the accessories in ascending order of their Price.
ii)To display Id and SName of all Shop in Nehru Place.
iii)To display Minimum and Maximum Price of each Name of accessories.
iv)To display all Sname in descending order.
Q21)a) Write a program to produce the output of the following program if the student.csv file contains
following data?
Student.csv
Ronit, 200
Akshaj, 400
b) Consider the following table GARMENT and FABRIC, Write SQL commands for the statements (i)to (iv)
TABLE GARMENT
GCODE DESCRIPTION PRICE FCODE READYDATE
10023 PENCIL SKIRT 1150 F 03 19-DEC-08
10001 FORMAL SHIRT 1250 F 01 12-JAN-08
10012 INFORMAL SHIRT 1550 F 02 06-JUN-08
10024 BABY TOP 750 F 03 07-APR-07
10090 TULIP SKIRT 850 F 02 31-MAR-07
10019 EVENING GOWN 850 F 03 06-JUN-08
10009 INFORMAL PANT 1500 F 02 20-OCT-08
10007 FORMAL PANT 1350 F 01 09-MAR-08
FCODE TYPE
F 04 POLYSTER
F 02 COTTON
F 03 SILK
F01 TERELENE
(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
(ii) To display the details of all the GARMENT, which have READYDATE in between 08-DEC-07 and16-
JUN-08 (inclusive if both the dates).
(iii) To display the average PRICE of all the GARMENT, which are made up of fabric with
FCODE asF03.
(iv) To display fabric wise highest and lowest price of GARMENT from GARMENT
table. (DisplayFCODE of each GARMENT along with highest and lowest Price.
b) Consider the tables Watches and Sale given below and answer the following questions.Watches
Watchid Watch_Name Price Type Qty_Store
W001 High Time 10000 Unisex 100
W002 Life Time 15000 Ladies 150
W003 Wave 20000 Gents 200
W004 High Fashion 7000 Unisex 250
W005 Golden Time 25000 Gents 100
sales
Watchid Qtysold Quarter
W001 10 1
W003 5 1
W002 20 2
W003 10 2
W001 15 3
W002 20 3
W005 10 4
W003 15 4
To display total quantity in store of unisex type watches.
To display watch name and their quantity sold in first quarter.
Give the output for the following SQL queries:
SELECT WATCH_NAME, PRICE , TYPE FROM WATCHES W, SALE S WHERE
W.WATCHID=S.WATCHID;
SELECT WATCH_NAME, QTY_STORE , SUM(QTY_SOLD), FROM WATCHES
W, SALE SWHERE W.WATCHID = S.WATCHID GROUP BY S.WATCHID
Q24)a) Write a function in Python, Push(Vehicle) where, Vehicle is a dictionary containing details of
vehicles-{ Car_Name: Maker}.
The function should push the name of car manufactured by “TATA” ( including all possible cases) to the
stack.
Consider the following table GARMENT. Write SQL commands for the following statements.
GCODE DESCRIPTION PRICE FCODE READYDATE
10023 SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TOP 850 F02 31-MAR-07
10019 EVENING DRESS 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10017 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 31-OCT-08
To Display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and16-JUN-08(inclusive
of both the dates)
To display FCODE wise highest and lowest price of GARMENTs from GARMENT table.
To find the average price of the garments.
Q25 a) Each node of a Stack contains the following information: PINCODE and NAME of city.
Write a PUSHCITY() function to implement push on stack like
b) Table: EMPLOYEE
EMPID NAME DOB DEPTID DESIGN SALARY
120 ALISHA 23-JAN-1978 D001 MANAGER 75000
123 NITIN 10-OCT-1977 D002 AO 59000
129 NAVJOT 12-JUL-1971 D003 SUPERVISOR 40000
130 JIMMI 30-DEC-1980 D004 SALES REP
131 FAIZ 06-APR-1984 D001 DEP MANAGER 65000
Table: DEPARTMENT
DEPTID DEPTNAME FLOORNO
D001 PERSONAL 4
D002 ADMIN 10
D003 PRODUCTION 1
D004 SALES 3
(b) To display the average salary of all employees, department wise.
(b)To display name and respective department name of each employee whose salary is more than 50000.
(e) To display the names of employees whose salary is not known, inalphabetical order.
(d)To display DEPTID from the table EMPLOYEEwithout repeat
Q26 a) Write a function in Python PushBook(Book) to add a new book entry as book_no and
book_title in the list of Books , considering it to act as push operations of the Stack
datastructure.
Write a function in Python PopBook(Book), where Book is a stack implemented by a list of books.
The function returns the value deleted from the stack.
b) Consider the following tables Supplier and Consumer. Write SQL commands for the statement a to d
Supplier
SupplierID SupplierName SupplierAddress Suppliercity
JR01 Rohit Bhalla 14, Floret Appt Jaipur
PH02 Harish Nagar A3, Gandhi Lane Panjim
PS15 Subrat Ray 14/B, Surya Vihar Panjim
JT50 Tina Chandran 12-H, Bank Colony Jaipur
Consumer
C_ID SupplierID CName CAddress Ccity
C101 JR01 Varun Mishra 5, Central Avenue Delhi
C342 PH02 Sonia Singh 116, Block A Delhi
C112 JR01 Prabhu S 2A, Andheri East Mumbai
C008 PS15 Abhishek Das B5, CS Terminals Panjim
C035 JT50 Rahul Jain 13,B Mayur Vihar Mumbai
(a) To display the C_ID, Supplier name, Supplier Address, Consumer Name and Consumer Address
for every Consumer
Q28 a) Julie has created a dictionary containing names and marks as keyvalue pairs of 6 students.
Write aprogram, with separate user defined functions to perform the following operations:
● Push the keys (name of the student) of the dictionary into a stack, where the
corresponding value(marks) is greater than75.
● Pop and display the content of the stack.For example:
If the sample content of the dictionary is as follows:
R={"OM":76, "JAI":45, "BOB":89, "ALI":65, "ANU":90,"TOM":82}
The output from the program should be:
TOM ANU BOB OM
b) Write SQL commands for (a) to (d) on the basis of table CLUB.
Table: CLUB
COACH ID COACH NAME AGE SPORTS DATEOFAPP PAY SEX