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

Practical program list(cs)2024-25

The document outlines the practical examination tasks for Class 12 Computer Science at Delhi Public School, Bhilai for the academic year 2024-2025. It includes programming assignments in Python and SQL queries based on various tables like EMPLOYEE, DEPARTMENT, CLUB, INTERIORS, and others. Each question requires students to write code or SQL commands to manipulate and retrieve data from the specified tables.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Practical program list(cs)2024-25

The document outlines the practical examination tasks for Class 12 Computer Science at Delhi Public School, Bhilai for the academic year 2024-2025. It includes programming assignments in Python and SQL queries based on various tables like EMPLOYEE, DEPARTMENT, CLUB, INTERIORS, and others. Each question requires students to write code or SQL commands to manipulate and retrieve data from the specified tables.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

DELHI PUBLIC SCHOOL,BHILAI,C.

G
AISSCE PRACTICAL EXAMINATION-2024-‘25
CLASS:12 SUBJECT: COMPUTER SCIENCE

1) a) Write a Python program to remove duplicates from a list.


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

Q2)a) Write a Python program to get the frequency of elements in a list.


b) Write SQL commands for (a) to (d) on the basis of table CLUB.
Table: CLUB
COACHID COACH NAME AGE SPORTS DATEOFAPP PAY SEX

1. KUKREJA 35 KARATE 27/03/1997 1000 M


2. RAVINA 34 KARATE 20/01/1998 1200 F
3. KARAN 34 SQUASH 19/02/1998 2000 M
4. TARUN 33 BASKETBALL 01/01/1998 1500 M
5. ZUBIN 36 SWIMMING 12/01/1998 750 M
6. KETAKI 36 SWIMMING 24/02/1998 800 F
7. ANKITA 39 SQUASH 20/02/1998 2200 F
8. ZAREEN 37 KARATE 20/02/1998 1100 F
9. KUSH 41 SWIMMING 13/01/1998 900 M
10. SHAILYA 37 BASKETBALL 19/02/1998 1700 M
(a) To show all information about swimming coaches of table club
(b)To list names of all coaches with their date of appointment (DATOFAPP) in descending order.
(c)To display a report, showing coachname, pay, age and bonus (15% of pay) for all the coaches.
(d)To insert in a new row in the CLUB table with the following data: 11,
“PRAKASH”, 37, “SQUASH”, 25/02/98, 2500, “M”
Q3) a) Write a Python program to change the position of every n-th value to the (n+1)th in a list.
Sample list: [0,1,2,3,4,5] Expected Output: [1, 0, 3, 2, 5, 4]
b) Write SQL command for (a) to (d ) on the basis of tables INTERIORS and NEWONES.

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

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
Q5) a) Write a program using function named LongLines() which reads the contents of a text file named
‘LINES.TXT’ and display those lines from the file which have at least 10 words in it.
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

1. Jugal 34 Computer 10/01/97 12000 M


2. Sharmila 31 History 24/03/98 20000 F
3. Sandeep 32 Maths 12/12/96 30000 M
4. Sangeeta 35 History 01/07/99 40000 F
5. Rakesh 42 Maths 05/09/97 25000 M
6. Shyam 50 History 27/06/98 30000 M
7. Shiv Om 44 Computer 25/02/97 21000 M
8. Shalakha 33 Maths 31/07/97 20000 F

a)To show all information about the teacher of history department


b)To list the names of female teacher who are in Hindi department

(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

10020 FROCK 850 F 04 09-SEP-07


10089 SLACKS 750 F 03 20-OCT-08
TABLE FABRIC

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 –

To display all information about teachers of Female PGT Teachers.


To list names, departments and date of hiring of all the teachers in descending order of date of joining.
To count the number of teachers and sum of their salary department wise.
To find the average salary of the teacher
Q9) a) Write a function ETCount() in Python, which should read each character of a text file
“TESTFILE.TXT” and then count and display the count of occurrence of alphabets E and T individually
(including small cases e and t too).
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

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

Q12) a) Replace all spaces from text file with – (dash)


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

(b) To display Consumer details in ascending order of CName


(c) To display number of Consumers from each city
(d) To display the details of suppliers whose supplier city is ‘Panjim’
Q13) a) Replace multiple spaces with single space in 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 each employee whose salary is more than 50000.
(d) To display the names of employees whose salary is not known, inalphabetical order.
(d)To display DEPTID from the table EMPLOYEEwithout repet

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

1. KUKREJA 35 KARATE 27/03/1997 1000 M


2. RAVINA 34 KARATE 20/01/1998 1200 F
3. KARAN 34 SQUASH 19/02/1998 2000 M
4. TARUN 33 BASKETBALL 01/01/1998 1500 M
5. ZUBIN 36 SWIMMING 12/01/1998 750 M
6. KETAKI 36 SWIMMING 24/02/1998 800 F
7. ANKITA 39 SQUASH 20/02/1998 2200 F
8. ZAREEN 37 KARATE 20/02/1998 1100 F
9. KUSH 41 SWIMMING 13/01/1998 900 M
10. SHAILYA 37 BASKETBALL 19/02/1998 1700 M
a)To show all information about the swimming show all information about the swimming coaches in the club.
b)To list names of all coaches with their date of appointment (DATOFAPP) in descending order.
c)To display a report, showing coachname, pay, age and bonus (15% of pay) for all the coaches.
d)To insert in a new row in the CLUB table with the following data: 11, “PRAKASH”,
37, “SQUASH”, 25/02/98, 2500, “M”
Q15) a) A binary file “salary.DAT” has structure [employee id, employee name, salary]. Write a function
countrec() in Python that would read contents of the file “salary.DAT” and display the details of those
employee whose salary is above 20000.

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

Q16) a) A file sports.dat contains information in following format [event, participant].


Write a program that would read the contents from file and copy only those records from sports.dat where
the event name is “Athletics” in new file named Athletics.dat
b) Write SQL commands for (a) to (d) on the basis of table CLUB.
Table: CLUB
COACHID COACH NAME AGE SPORTS DATEOFAPP PAY SEX

1. KUKREJA 35 KARATE 27/03/1997 1000 M


2. RAVINA 34 KARATE 20/01/1998 1200 F
3. KARAN 34 SQUASH 19/02/1998 2000 M
4. TARUN 33 BASKETBALL 01/01/1998 1500 M
5. ZUBIN 36 SWIMMING 12/01/1998 750 M
6. KETAKI 36 SWIMMING 24/02/1998 800 F
7. ANKITA 39 SQUASH 20/02/1998 2200 F
8. ZAREEN 37 KARATE 20/02/1998 1100 F
9. KUSH 41 SWIMMING 13/01/1998 900 M
10. SHAILYA 37 BASKETBALL 19/02/1998 1700 M
(a) To show all information about swimming coaches of table club
(b)To list names of all coaches with their date of appointment (DATOFAPP) in descending order.
(c)To display a report, showing coachname, pay, age and bonus (15% of pay) for all the coaches.
(d)To insert in a new row in the CLUB table with the following data: 11,
“PRAKASH”, 37, “SQUASH”, 25/02/98, 2500, “M”
Q17) a) A binary file “STUDENT.DAT” has structure [admission_number, Name, Percentage]. Write a
function countrec() in Python that would read contents of the file “STUDENT.DAT” and display the details
of those students whose percentage is above 75. Also display number of students scoring above 75%.
b) Write SQL command for (a) to (d ) on the basis of tables INTERIORS and NEWONES.

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

1. Jugal 34 Computer 10/01/97 12000 M


2. Sharmila 31 History 24/03/98 20000 F
3. Sandeep 32 Maths 12/12/96 30000 M
4. Sangeeta 35 History 01/07/99 40000 F
5. Rakesh 42 Maths 05/09/97 25000 M
6. Shyam 50 History 27/06/98 30000 M
7. Shiv Om 44 Computer 25/02/97 21000 M
8. Shalakha 33 Maths 31/07/97 20000 F

a)To show all information about the teacher of history department


b)To list the names of female teacher who are in Hindi department

(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

Q20)a) Write a program to count number of records present in “data.csv” file.


(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.
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

10020 FROCK 850 F 04 09-SEP-07


10089 SLACKS 750 F 03 20-OCT-08
TABLE FABRIC

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.

Q22)a) Write a program to copy the data from “data.csv” to “temp.csv”


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
4 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 –

To display all information about teachers of Female PGT Teachers.


To list names, departments and date of hiring of all the teachers in descending order of date of joining.
To count the number of teachers and sum of their salary department wise.
To find the average salary of the teacher
Q23) a) A list contains following record of customer:
[Customer_name, Room, Type]
Write the following user defined functions to perform given operations on the stack named ‘Hotel’:
(i) Push_Cust() – To Push customers’ names of those customers who are staying in ‘Delux’ Room
Type.
(ii) Pop_Cust() – To Pop the names of customers from the stack and display them. Also , display
“Underflow” when there are no customers in the stack.

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

operation to add a node to Stack. Write a POPCITY() function to

implement pop from stack like operation to remove a node

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

(b) To display Consumer details in ascending order of CName


(c) To display number of Consumers from each city
(d) To display the details of suppliers whose supplier city is ‘Panjim’
Q27 a) Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this
listpush all numbersdivisible by 5 into a stack implemented by using a list. Display thestack if it
has at least one element, otherwise display appropriate error message.
Write a function in Python POP(Arr), where Arr is a stack implemented by a list ofnumbers.
The functionreturns the value deleted from the stack.
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.
(f) To display the names of employees whose salary is not known, inalphabetical order.
(d)To display DEPTID from the table EMPLOYEEwithout repet

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

1. KUKREJA 35 KARATE 27/03/1997 1000 M


2. RAVINA 34 KARATE 20/01/1998 1200 F
3. KARAN 34 SQUASH 19/02/1998 2000 M
4. TARUN 33 BASKETBALL 01/01/1998 1500 M
5. ZUBIN 36 SWIMMING 12/01/1998 750 M
6. KETAKI 36 SWIMMING 24/02/1998 800 F
7. ANKITA 39 SQUASH 20/02/1998 2200 F
8. ZAREEN 37 KARATE 20/02/1998 1100 F
9. KUSH 41 SWIMMING 13/01/1998 900 M
10. SHAILYA 37 BASKETBALL 19/02/1998 1700 M
a)To show all information about the swimming show all information about the swimming coaches in the club.
b)To list names of all coaches with their date of appointment (DATOFAPP) in descending order.
c)To display a report, showing coachname, pay, age and bonus (15% of pay) for all the coaches.
d)To insert in a new row in the CLUB table with the following data: 11, “PRAKASH”,
37, “SQUASH”, 25/02/98, 2500, “M”

You might also like