12th CLASS PRACTICAL LIST
1. Define a class my array to find the largest
and smallest element using member functions.
2. Define a structure employee to store employee
code, employee name, address, phone number and salary. Create objects of
employee type and read and display their details according to the sorted order
of their salary.
3. To display the details of a class Travel using
classes and objects.
4. To display the details of the class Hotel
using classes and Objects.
5. Write a program to show the working of all
types of Constructors and Destructors.
6. Write a program to print the Fibonacci series
using Copy constructor.
7. Simulation of Banking system using
inheritance.
8. Write a Program to calculate the number of
vowels in a file using data file handling.
9. Give a file student.dat that stores the
details of some students. These details include roll number, name, class and
marks in 5 subjects. Using the details in this file create another file called
result.dat, which should store fields roll number, percentage and Grade. Grade
must be assigned according to the following criteria.
Percentage
|
Grade
|
>=75
|
A
|
>=60 &&
<75
|
B
|
>=50 &&
<60
|
C
|
>=40 &&
<50
|
D
|
<40
|
E
|
10. Write a program to create a file by accepting
data fropm the user and make a menu driven program as given below
· Char by Char
i. Number of Character
ii. Number of Blank Spaces
iii. Number of Vowels
iv. Number of specific character input by the user
· Word by Word
i. Number of Words
ii. Number of a specific word input by the user
· Line by Line
i. Number of lines
ii. Number of Lines starting with a specific
character input by the user
11. Write a Program to Illustrate the use of this
Pointer.
12. Write a Program to print the address and value
at address by using the concept of array of pointers.
13. Write a Program to implement Linear search
using a 1-d array.
14. Write a Program to implement Binary search
using a 1-D array.
15. Write a Program to implement selection sort
using a 1-D array.
16. Write a Program to implement Bubble sort using
a 1-D array.
17. Write a Program to implement Insertion Sort
using a 1-D array.
18. Write a Program to implement Stack using an
array.
19. Write a Program to implement Queue using an
array.
20. Write a Program to implement Stack using
Linked Lists.
21. Write a Program to implement queue using
Linked.
22. Write a Program to implement circular queue
using an array.
SQL PRACTICALS
1. Given the following tables for a database
LIBRARY :
Book_Id
|
Book_Name
|
Author_Name
|
Publishers
|
Price
|
Type
|
Quantity
|
C0001
|
Fast Cook
|
Lata Kapoor
|
EPB
|
355
|
Cookery
|
5
|
F0001
|
The Tears
|
William Hopkins
|
First Publishers
|
650
|
Fiction
|
20
|
T0001
|
My First C++
|
Brain and Brooke
|
EPB
|
350
|
Text
|
10
|
T0002
|
C++ Brainworks
|
A. W. Rossaine
|
TDH
|
350
|
Text
|
15
|
F0002
|
Thunderbolts
|
Annaborts
|
First Publishers
|
750
|
Fiction
|
50
|
Table:ISSUED
Book_Id
|
Quantity_Issued
|
T0001
|
4
|
C0001
|
5
|
F0001
|
2
|
Write SQL queries for
(a) to (f):
a) To show Book name, Author name and Price of
books of First Publishers.
b) To list the names from books of Text type.
c) To display the names and price of all books in
ascending order of their price.
d) To increase the price of all books of EPB
Publishers by 50.
e) To display the Book_Id, Book_Name and
Quantity_Issued for all books which have been issued.
f) To insert a new row in the table ISSUED having
the following data : “F0003”,1
g) Give the output of the following queries based
on the above tables:
i. Select count(*) from BOOKS;
ii. Select max(Price) from BOOKS where
Quantity>=15;
iii. Select Book_Name, Author_Name from BOOKS where
Publisher=”EPB”;
iv. Select count(distinct Publishers) from BOOKS
where Price>=400;
2. Given the following tables for a database
FURNITURE:
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
|
Table : Arrivals
No
|
Itemname
|
Type
|
Dateofstock
|
Price
|
Discount
|
11
|
Wood comfort
|
Double bed
|
23/03/03
|
25000
|
25
|
12
|
Old fox
|
Sofa
|
20/02/03
|
17000
|
20
|
13
|
Micky
|
Baby cot
|
21/02/03
|
7500
|
15
|
Write SQL queries for
(a) to (f):
a) To show all information about Baby cots from
the FORNITURE table.
b) To list the Itemname which are priced more
than 15000 from the FURNITURE table.
c) To list the Itemname and Type of those items,
in which Dateofstock is before 22/01/02 from the FURNITURE table in descending
order of Itemname.
d) To display the Itemname and Dateofstock of
those items, in which Discount percentage is more than 25 from FURNITURE table.
e) To count the number of items, whose Type is
“Sofa” from FURNITURE table.
f) To insert a new row in the ARRIVALS table with
the following data :
14, “Velvet touch”, “Double bed”, {25/03/03}, 25000, 30
g) Give the output of the following SQL
statements :
i. Select count(distinct Type) from FURNITURE;
ii. Select max(Discount) from FURNITURE;
iii. Select avg(Discount) from FURNITURE where
type=”Baby cot”;
iv. Select sum(price) from FURNITURE where
Dateofstock<{12/02/02}.
3. Given the tables EMPLOYEE and SALARY. Write
SQL commands for the statements (i) to (iv) and Give outputs for SQL queries
(v) to (vi):
Table: EMPLOYEE
Eid
|
Name
|
Depid
|
Qualification
|
Sex
|
1
|
Deepali Gupta
|
101
|
M.C.A
|
F
|
2
|
Rajat Typagi
|
101
|
B.C.A
|
M
|
3
|
Hari Mohan
|
102
|
B.A
|
M
|
4
|
Harry
|
102
|
M.A
|
M
|
5
|
Sumit Mittal
|
103
|
B.Tech
|
M
|
6
|
Jyoti
|
101
|
M.Tech
|
F
|
Table:SALARY
Eid
|
Basic
|
DA
|
HRA
|
Bonus
|
1
|
6000
|
2000
|
2300
|
200
|
2
|
2000
|
300
|
300
|
30
|
3
|
1000
|
300
|
300
|
40
|
4
|
1500
|
390
|
490
|
30
|
5
|
8000
|
900
|
900
|
80
|
6
|
10000
|
300
|
490
|
89
|
i. To display the frequency of employees
department wise.
ii. To list the names of those employees whose
name starts with ‘H’.
iii. To add a new column in salary table. The
column name is Total_Sal.
iv. To store the corresponding values in the
Total_Sal coumn.
v. Select max(Basic) from SALARY where Bonus>40;
vi. Select count(*) from EMPLOYEE group by Sex;
vii. Select Distinct Depid from EMPLOYEE;
4. Given the following tables FLIGHTS and FARES.
Write SQL commands for the statements (i) to (iv) and give output for SQL
queries (v) to (vi):
Table:FLIGHTS
FL_NO
|
STARTING
|
ENDING
|
NO_FLIGHTS
|
NO_STOPS
|
IC301
|
Mumbai
|
Delhi
|
8
|
0
|
IC799
|
Bangalore
|
Delhi
|
2
|
1
|
MC101
|
Indore
|
Mumbai
|
3
|
0
|
IC302
|
Delhi
|
Mumbai
|
8
|
0
|
AM812
|
Kanpur
|
Bangalore
|
3
|
1
|
IC899
|
Mumbai
|
Kochi
|
1
|
4
|
AM501
|
Delhi
|
Trivandrum
|
1
|
5
|
MU499
|
Mumbai
|
Madras
|
3
|
3
|
IC701
|
Delhi
|
Ahmedabad
|
4
|
0
|
Table: FARES
FL_NO
|
AIRLINE
|
FARE
|
TAXPER
|
IC701
|
Indian Airlines
|
6500
|
10
|
MU499
|
Sahara
|
9400
|
5
|
AM501
|
Jet Airways
|
13450
|
8
|
IC899
|
Indian Airlines
|
8300
|
4
|
IC302
|
Indian Airlines
|
4300
|
10
|
IC799
|
Indian Airlines
|
10500
|
10
|
MC101
|
Deccan Airlines
|
3500
|
4
|
i. Display FL_NO and NO_FLIGHTS from “Kanpur” to
“Bangalore” from the table FLIGHTS.
ii. Arrange the contents of the table FLIGHTS in
the ascending order of FL_NO.
iii. Display the FL_NO and fare to be paid for the
flights from Delhi to Mumbai using the tables FLIGHTSS and FARES, where the
fare to be paid=FARE+FARE*TAXPER/10.
iv. Display the minimum fare ”Indian Airlines” is
offering from the table FARES.
v. Select FL_NO, NO_FLIGHTS, AIRLINES from
FLIGHTS, FARES where STARTING=”Delhi” and FLIGHTS. FL_NO=FARES.FL_NO.
vi. Select count(distinct ENDING) from FLIGHTS.
vii. Given the tables stationery and CONSUMER.
Write SQL commands for the statements (i) to (iv) and give outputs for SQL
queries (v) to (viii)
Table:STATIONERY
S_ID
|
StationeryName
|
Company
|
Price
|
DP01
|
Dot pen
|
ABC
|
10
|
PL02
|
Pencil
|
XYZ
|
6
|
ER05
|
Eraser
|
XYZ
|
7
|
PL01
|
Pencil
|
CAM
|
5
|
GP02
|
Gel pen
|
AMC
|
15
|
Table: CONSUMER
C_ID
|
ConsumerName
|
Address
|
S_ID
|
01
|
Good Learner
|
Delhi
|
PL01
|
06
|
Write Well
|
Mumbai
|
GP02
|
12
|
Topper
|
Delhi
|
DP01
|
15
|
Write and Draw
|
Delhi
|
PL02
|
16
|
Motivation
|
Bangalore
|
PL01
|
i. To display the details of those Consumers
whose Address is Delhi.
ii. To display the details of the stationery whose
Price is in the range of 8 to 15 (Including).
iii. To display the ConsumerName, Address from
table CONSUMER and Company, Price from table STATIONERY with their
corresponding matching S_ID.
iv. To increase Price of all stationery by
2.
v. Select distinct Address from CONSUMER.
vi. Select CONSUMER, max(Price), min(Price),
count(*) from STATIONERY group by Company;
vii. Select CONSUMER.ConsumerName,
STATIONERY.StationeryName, STATIONERY.price from STATIONERY, CONSUMER where
CONSUMER.S_ID=STATIONERY.S_ID;
viii. Select StationeryName, Price*3 from
STATIONERY;
No comments:
Post a Comment