Prac Format 24 - 25
Prac Format 24 - 25
NAME:
CLASS & SECTION: 12/A
DELHI PRIVATE SCHOOL DUBAI
CERTIFICATE
1
Review Of Python
2
User Defined Functions
3
File Handling
4
Data Structure (Stack)
5
SQL Group Functions
Write a program to create a list that contains elements from two given
1. lists, with elements from the first list positioned at even indices and
elements from the second list positioned at odd indices:
Write a Program to enter the number and print the Floyd’s Triangle in
6.
decreasing order.
Q)WAP to check if a number is negative or positive
A)
num = int(input("Enter A Number: "))
if num < 0:
print("Negative")
else:
print("Positive")
Output:
Enter A Number: 2
Positive
USER DEFINED
FUNCTIONS
IN
PYTHON
INDEX
USER DEFINED FUNCTIONS
Teacher
S. No. PROGRAMS
Signature
Write a function that takes string as an argument and return the string if
5
its palindrome or not.
Write a function that calculates the volume of a cylinder. The radius and
8
height are required arguments, while the units are optional.
FILE
HANDLING
INDEX
FILE HANDLING
Teacher
S. No. PROGRAMS
Signature
Write a program to read the content of file line by line and write it
1
to another file except for the lines contains “a” letter in it.
Write a program to read the content of file and display the total
2
number of consonants, uppercase, vowels and lower case characters.
Write a program to create CSV file and store empno, name, salary and
5 search for all names starting with ‘A’ and display name, salary and if
not found display appropriate message
Write a program to create CSV file and store empno, name, salary and
6 search for all names starting with ‘S’ with max 20 characters and
display name, salary and if not found display appropriate message.
DATA STRUCTURE
STACKS
INDEX
DATA STRUCTURE (STACKS)
Teacher
S. No. PROGRAMS
Signature
FUNCTIONS
INDEX
SQL GROUP FUNCTION
S. Teacher
No PROGRAMS Signatur
. e
Consider the table ITEM and CUSTOMER given below. Write SQL
commands in MySql for (1) to (4) and give output for SQL queries (5) to (8)
TABLE: ITEM
TABLE: CUSTOMER
A. SQL Commands:
1. To display the details of those customers whose city is Delhi
2. To display the details of those items whose Price is in the
range of 35000 to 55000.
3. To display the CustomerName and City from table Customer
and Itemname and Price from table Item, with their corresponding
matching I_Id.
4. To increase the Price of all items by 1000 in the table item
B. Output Queries:
5. SELECT DISTINCT(City) FROM Customer;
6. SELECT ItemName, MAX(Price), count(*) FROM item
GROUP BY ItemName;
7. SELECT CustomerName, Manufacturer
FROM Item,Customer WHERE Item.I_ID=Customer.I_ID;
SELECT ItemName, Price*100 FROM Item WHERE Manufacturer='ABC';
Consider the following tables DOCTOR and SALARY and write MySql
commands for the questions (1) to (4) and give output for SQL queries (5) to
2
(6)
TABLE: DOCTORS
TABLE: SALARY
A. SQL Commands:
1. Display NAME of all doctors who are in MEDICINE and
having more than 10 years from the table DOCTOR
2. Display the average salary of all doctors Working in “ENT”
department using the tables DOCTORS and SALARY.BASIC =
SALARY.BASIC + SALARY.ALLOWANCE
3. Display the minimum ALLOWANCE of female doctors
4. Display the highest consultation fee for Male doctors
B. Output Queries:
TABLE: FABRIC
3
A. SQL Commands:
1. To display GCODE and DESCRIPTION of each GARMENT
in descending order of GCODE.
2. To display the details of all the GARMENTs, which have
READYDATE in between 08-DEC-07 and 16-JUN-08 (inclusive
of both dates).
3. To display the average PRICE of all the GARMENTs, which
are made up of FABRIC with FCODE as FO3.
4. To display FABRIC wise highest and lowest price of
GARMENTs from GARMENT table. (Display FCODE of each
GARMENT along with highest and lowest Price).
B. Output Queries:
5. SELECT SUM(PRICE) FROM GARMENT WHERE FCODE
= ‘F0l’;
6. SELECT DESCRIPTION, TYPE FROM GARMENT,
FABRIC WHERE GARMENT.FCODE = FABRIC.FCODE AND
GARMENT.PRICE >= 1260;
7. SELECT MAX(FCODE) FROM FABRIC;
SELECT COUNT(DISTINCT PRICE) FROM GARMENT;
Consider the following tables worker and paylevel and write MySql
4
commands for the questions (1) to (4) and give outputs for SQL queries (5) to
(8).
TABLE: worker
TABLE: paylevel
A. SQL Commands:
1. To display the details of all WORKERs in descending order of
DOB.
2. To display NAME and DESIGN of those WORKERs whose
PLEVEL is either P001 or P002.
3. To display the content of all the WORKERs table whose DOB
is in between ‘19-Jan-1984 and ’18-Jan-1987'.
4. To add a new row in WORKER table with the following data:
19, ‘Daya Kishore’, ‘Operator’, ‘P003’, 19-Jun-2008’, ’11-Jul-1984'
B. Output Queries:
5. SELECT COUNT (PLEVEL), PLEVEL FROM WORKER
GROUP BY PLEVEL;
6. SELECT MAX(DOB), MIN(DOJ) FROM WORKER;
7. SELECT Name, Pay FROM WORKER W, PAYLEVEL P
WHERE W.PLEVEL = P.PLEVEL AND W.ECODE<13;
8. SELECT PLEVEL, PAY+ALLOWANCE FROM PAYLEVEL
WHERE PLEVEL = 'POO3';
5 Consider the following tables cabhub and customer and write MySql
commands for the questions (1) to (4) and give outputs for SQL queries (5) to
(8).
TABLE: cabhub
TABLE: customer
A. SQL Commands:
1. To display the names of all the white colored vehicles.
2. To display name of vehicle, make and capacity of all the
vehicles in ascending order of their sitting Capacity.
3. To display the highest charges at which a vehicle can be hired
from CABHUB.
4. To display all the Customer name and the corresponding name
of the vehicle hired by them.
B. Output Queries:
5. SELECT COUNT(DISTINCT Make) From CABHUB;
6. SELECT MAX(Charges), MIN(Charges) FROM CABHUB;
7. SELECT COUNT(*), Make FROM CABHUB;
8. SELECT Vehicle FROM CABHUB WHERE Capacity=4;
PYTHON
INTERFACE
WITH MYSQL
INDEX
PYTHON INTERFACE WITH MYSQL
Teacher
S. No. PROGRAMS
Signature
Write a program to create and insert the data into the following table:
Field Name Data Type Constraints
Roll no Number Primary key
Name Char(20)
Sclass Varchar(5)
1
Age Number
Gender Char(10)
Date of Date DEFAULT
Joining SYSDATE
Percentage Float
Write a python interface programs using MySQL module using
following specifications of Student table. Use appropriate connection to
perform SQL query connections.
Field Name Data Type Constraints
Roll no Number Primary key
Name Char(20)
Sclass Varchar(5)
Age Number
Gender Char(10)
2 Date of Joining Date DEFAULT
SYSDATE
Percentage Float
Write a menu driven program
a)to insert n records from user
b) to delete record based on rollno
c)to fetch the records of student whose Date of joining is in the
month of June.
d) to display all records