0% found this document useful (0 votes)
68 views3 pages

Sri Ram Dayal Khemka Vivekananda Vidyalaya Junior College: Half Yearly Examination 2024 - 2025

Uploaded by

Gomathy Balaji
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)
68 views3 pages

Sri Ram Dayal Khemka Vivekananda Vidyalaya Junior College: Half Yearly Examination 2024 - 2025

Uploaded by

Gomathy Balaji
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/ 3

Sri Ram Dayal Khemka Vivekananda Vidyalaya Junior College

Half Yearly Examination 2024 – 2025 - Class : XII


Subject: Computer Science Subject Code: 083
Date & Day : 26.11.2024 (Tuesday) Mark : 30

PYTHON PROGRAMS

1. Write a program in Python to implement a stack using a list data structure. Each node
should have • Book no • Book name • Book price.
2. Write a Program to integrate SQL with Python by importing the MYSQL module to
insert record for the following table Employee
Ecode Ename Edesignation
3. Assume a csv file “shop.csv” containing records of different products.
Each record has the structure [pno, pname, price]. Write a python program to add
and display the records from the file using the following functions.
Addproduct( ) – to input details of furniture and store them to the file
Showproduct( ) – to read and display the records whose price is more than 100.
4. Assume a binary file “Furniture.dat” containing records of different furniture.
Each record has the structure [ fno, fname, price]. Write a python program to add
and display the records from the file using the following functions.
Addfurniture( ) – to input details of furniture and store them to the file
Showfurniture( ) – to read and display the records whose price is more than 5000.
5. Write a python program to write 3 lines into the file “story.txt”. Then read the file and
display the words containing “a”.
6. Write a python program to write 5 lines into the file “words.txt”. Then read the file and
display all the words which are longer than 5 characters.
7. Write a function patterns(n) to display the following pattern for n lines, as per the number
passed to the function. The number to be input in main( ) function.
Enter the number:5
5
55
555
5555
55555
8. Write a python connectivity code to fetch and display all the records of a student table.
9. Assume a csv file “bikes.csv” containing records of different bikes.
Each record has the structure [bid, bname, cost]. Write a python program to add
and display the records from the file using the following functions.
Addbikes( ) – to input details of furniture and store them to the file
searchbikes(bikeid) – to read and display the bike records whose bid is passed as
the parameter to the function.
10. Assume a binary file “car.dat” containing records of different cars.
Each record has the structure [ carno, brand, kms, cost]. Write a python program to add
and display the records from the file using the following functions.
addcardata( ) – to input details of car and store them to the file
carreport( ) – to read and display the records who have run more than 100000 kms.
Sri Ram Dayal Khemka Vivekananda Vidyalaya Junior College
Half Yearly Examination 2024 – 2025 - Class : XII
Subject: Computer Science Subject Code: 083
Date & Day : 26.11.2024 (Tuesday) Mark : 30

SQL QUERIES

1. Consider the following table employee Write SQL commands for the statements
1 to 3 and outputs for 4 & 5
Table: Employee
EMPID ENAME JOBTITLE SALARY BONUS AGE
1205 Anitha CEO 30000 5000 32
1211 Rahul Manager 20000 1500 27
1213 Manisha Analyst 15000 NULL 24
1214 Megha Salesman 22000 1200 25
1216 Mohit Analyst 15000 1500 32
1217 Ramesh Salesman 25000 NULL 28
1. Create the above table. Primary key is empid
2. Display employee name and salaries of those employees whose salary is greater
than 20000
3. Update the age of the employees by 2 whose jobtitle starts with “A”
4. SELECT COUNT(*) FROM employee;
5. SELECT SUM(BONUS) FROM employee WHERE AGE>25;

2. Consider the following table Doctor Write SQL commands for the statements
1 to 3 and outputs for 4 & 5
Table Name: Doctor
dno docname Age Department Charge Sex
111 Arun 62 Surgery 300 M
222 Aparna 22 ENT 250 F
333 Kannan 32 Surgery 250 M
444 Anand 25 Surgery 300 M
555 Sundari 30 ENT 450 F
777 Supriya 28 Cardiology 450 F
888 Raj Kumar 25 ENT 400 M

1. To display the names of female doctors who are in ENT department


2. To display names of all doctors with their department in ascending order of
doctor name.
3. Update the charges of all doctors by 200
4. SELECT MAX(Charge), MIN(Charge) FROM Doctor;
5. SELECT AVG(Charge) FROM Doctor WHERE Sex = „F‟;
3. Consider the following table Stock Write SQL commands for the statements
1 to 3 and outputs for 4 & 5
Table : Stock
Ino Item Dcode Qty Uprice
5005 Pen 102 100 16
5003 Pencil 102 150 10
5009 Eraser 105 60 10
5004 Sharpener 103 100 8
1. To display details of all items in the stock table in descending order of qty.
2. To display details of all items whose Uprice is in the range 8 to 10
3. To increase the price of all item by 10
4. SELECT COUNT(*) FROM Stock;
5. SELECT Ino, Item, Dcode FROM Stock where Ino = 5009;

4. Consider the following table Books Write SQL commands for the statements
1 to 3 and outputs for 4 & 5 Table: books
Bid Bname Aname Publisher Price Type Qty
1001 The Tears William Hopkins First 750 Fiction 10
2002 Thunderbolts Anna Roberts First 700 Fiction 5
3003 My first C++ Brain and Brooke EPB 250 Text 10
4004 Brain works A.W.Rossaine TDH 325 Text 5
5001 Fast Cook Latha Kapoor EPB 350 Cookery 8

1) Insert a new record into the above table


2)To display the book names and price of books in descending order of price.
3)To increase the price of all of first publisher by 100;
4) SELECT MAX(Price), MIN(Price) from Books;
5) SELECT AVG(Qty) FROM Books WHERE Publisher=‟First‟;

You might also like