Sunteți pe pagina 1din 26

Class XII

Computer Science Board Practical


SET

Q1 Declare a class COUNTRY containing data members : name of the


country and its capital. Include member functions to read and display the
data members. Create a data file “COUNTRY.DAT” containing objects of
class COUNTRY. Write an interactive menu driven Object Oriented
program to do the following:
1. To append (create) records
2. To display all records
3. To search a country for a given capital
4. To modify the capital in the same file given name of country

Q2. Write SQL commands for the following:

Table: INTERIORS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double Bed 23-Feb-2006 32000 15
2 Soft touch Baby cot 20-Jan-2006 9000 10
3 Jerry‟s home Baby cot 19-Feb-2006 8500 10
4 Rough woof Office table 01-Jan-2006 20000 20
5 Comfort zone Double bed 12-Jan-2006 15000 20
6 Jerry look Baby cot 24-Feb-2006 7000 19
7 Lion king Office table 20-Feb-2006 16000 20
8 Royal tiger Sofa 22-Feb-2006 30000 25
9 Park sitting Sofa 13-Dec-2005 9000 15
10 Dine Paradise Dining Table 19-Feb-2006 11000 15

1. To show all information about the Sofa‟s from the interiors table.
2. To list the item name which are priced at more than 10000 from the interiors
table.
3. To display item name and date of stock of those items, in which the discount
percentage is more than 15 from interiors table.
4. To list item name and type of items, in which data of stock is before 22-Jan-
2002 from the interiors table in descending order of item name.
5. To count the number of items of each type from interiors table.
SET 2

Q1. Given class MOVIE with following declarations:


class MOVIE
{ int movieno;
char moviename[25];
float price;
public : int compare(char nm[ ] )
{ if (strcmp ( moviename, nm) = = 0)
return 1;
else
return 0; }
void input( );
void display ( );
};
Write a menu driven interactive program to :
a) Create and append records to a binary file “MOVIE.DAT”.
b) Search for a particular moviename(name to be input by the user ) &
display its price.
c) Increase the price of all movies by 10% in the same file for all the
records whose price > 200
d) Display all records.

Q2. Write SQL commands for the following:


Table: INTERIORS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double Bed 23-Feb-2006 32000 15
2 Soft touch Baby cot 20-Jan-2006 9000 10
3 Jerry‟s home Baby cot 19-Feb-2006 8500 10
4 Rough woof Office table 01-Jan-2006 20000 20
5 Comfort zone Double bed 12-Jan-2006 15000 20
6 Jerry look Baby cot 24-Feb-2006 7000 19
7 Lion king Office table 20-Feb-2006 16000 20
8 Royal tiger Sofa 22-Feb-2006 30000 25
9 Park sitting Sofa 13-Dec-2005 9000 15
10 Dine Paradise Dining Table 19-Feb-2006 11000 15

1. To insert new row in interiors table with following data:


11 White wood Double Bed 23-Feb-2006 20000 20

2. To count distinct types from interiors table.


3. To find average discount from interiors for each type of interiors.
4. To calculate sum of price from interiors where data of stock is before 12-Feb-
2002

5. To increase price of all Office table by 3000 from interiors table.


SET

Q1. Consider the following class definition:


class Labs
{ int Lab_Code;
char Department[30];
int Number;
public: void get_data( )
{ cout << “Lab. Code :”; cin >> Lab_Code;
cout << “Department :”; gets(Department);;
cout << “Total Labs :”; cin >> Number;
}
void Disp_data( )
cout << “Lab. Code :”; << Lab_Code;
cout << “Department :”; << Department;;
cout << “Total Labs :”; << Number;
}
int Get_code( ) { return Lab_Code;}
};
Write a menu driven program using separate functions:
a) To create and append records to a binary file called “Labs.dat”
b) To read the file the file and display it‟s contents.
c) To search for a record for a Lab_Code given by the user and replace
the record with a new record given by the user.

Q2. Write SQL commands for the following:


Table : BOOKS
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++ Brains & Brroke EPB 350 Text 10
T0002 C++ A.M.Rossaine TDH 350 Text 15
Brainworks
F0002 Thunderbolts Anna Roberts First Publishers 750 Fiction 50
Table : ISSUED
BOOK_ID QUANTITY_ISSUED
T0001 4
C0001 5
F0001 2
1. To show book name, author name and price of books of First Publishers.
2. To list the names from books of Text type.
3. To display the names and price from books in ascending order of their price.
4. To increase the price of all books of EPB publishers by 10%.

5. To display the book id, book name and quantity issued for all books which have been
issued.
SET

Q1. Following is the structure of each record of a binary data file named
“COLONY.DAT”.
struct COLONY
{ char Colony_Code[10];
char Colony_Name[10];
int No_of_People;
};
Write a menu driven program using functions to
i) create a binary file “COLONY.DAT”
ii) display the contents of the file. (Name of the file to be taken as parameter.)
iii) to update the file with a new value of No_of_People. The value of
Colony_Code and No_of_People are to be read during the execution of
the program.

Q2. Write SQL commands for the following:

Table : BOOKS
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++ Brains & Brroke EPB 350 Text 10
T0002 C++ A.M.Rossaine TDH 350 Text 15
Brainworks
F0002 Thunderbolts Anna Roberts First Publishers 750 Fiction 50
Table : ISSUED
BOOK_ID QUANTITY_ISSUED
T0001 4
C0001 5
F0001 2

1. To insert new row in the table issued having the following data:
„F3003‟, 1
2. To display the total no. of books (quantity) of each type.
3. To find the maximum price from books which have quantity more than 15.
4. To count unique publishers from books
5. To display the no. of titles available of each publishers.
SET 5
Q1 A chain of grocery store keeps the records of all its customers and their
dealings with the store. The records need to be kept in order and updated
as and when required. Consider the following class definition and perform
the following operations using separate functions:
Note : Write the required member function for the class
class store
{ int ID_No;
char Name[30]; char Address[40];
long Tel_No;
char Status; // „M‟ for Member and „N‟ for non-members
public:
long R_Tel_No() { return Tel_no;}
char R_status() { return Status;}
void Assign_Tel(long Tel) (Tel_No = Tel ;)
char* R_Name() { return Name ;}
};
Write a menu driven program with separate functions to perform the
following:
a. Create a file called “CUSTOMER.DAT” and write objects to it.
b. View all the records from the file where status is „M‟ (i.e.display records
of all the members).
c. Change the telephone number of a customer in his record by taking
the new number of the customer as an input.
d. Display the entire contents of the file.

Q2. Write SQL commands for the following:


Table : GAMES
GCODE GAMENAME NUMBER PRIZEMONEY SCHEDULEDATE
101 Carom Board 2 5000 23-Jan-2006
102 Badminton 2 12000 12-Dec-2005
103 Table Tennis 4 8000 14-Feb-2006
105 Chess 2 9000 01-Jan-2006
108 Lawn Tennis 4 25000 19-Nov-2005
Table : PLAYER
PCODE NAME GCODE
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103
1. To display the names of all games where schedule data is after 31-Dec-2005.
2. To display the name of the players in the table player with their gamesname.
3. To display the content of the games table in ascending order of scheduledate.
4. To display the sum of prize money received by players in the table games.
5. To add a new column (attribute) ADDRESS of type Char(20) in the table
PLAYER.
SET 6

Q1. Write a menu driven program using separate functions to perform the
following :
i) create a text file “STORY.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter.)
iii) to count and display the number of lines not starting with alphabet „A‟
present in a text file “STORY.TXT”.
iv) to reverse each line of a text file and store it in “NEWFILE.TXT”. Display
the contents of the file “NEWFILE.TXT”

Q2. Write SQL commands for the following:


Table : GAMES
GCODE GAMENAME NUMBER PRIZEMONEY SCHEDULEDATE
101 Carom Board 2 5000 23-Jan-2006
102 Badminton 2 12000 12-Dec-2005
103 Table Tennis 4 8000 14-Feb-2006
105 Chess 2 9000 01-Jan-2006
108 Lawn Tennis 4 25000 19-Nov-2005

Table : PLAYER
PCODE NAME GCODE
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103

1. To display maximum and minimum schedule date.


2 To change the prize money for Chess from 9000 to 10000.
3. To display unique gcodes from players.
4. To delete all rows from games table where schedule date was before 01-Jan-
2006.
5. To insert a new record in the player table as follows:
5 Anand 105
SET 7
Q1. Write a menu driven program using separate functions to perform the
following :
i) create a text file “MYFILE.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter.)
iii) to read the contents of an existing text file MYFILE.TXT and print each
of its words in a different line. Example, if the string in the file is
“Hello how are you”
Then the output should appear as
Hello
how
are
you
iv) to count and display the number of lines in the file
v) to create a new file called “NEW.TXT” with all uppercase letters
converted to lowercase and vice versa from “MYFILE.TXT”. Display
the contents of the file “NEW.TXT”
Q2. Write SQL commands for the following:
Table : HOSPITAL
NO NAME AGE D_CODE DATOFADM CHARGES SEX
1 Sandeep 65 D101 23-Feb-2006 300 M
2 Ravina 24 D105 20-Jan-2006 200 F
3 Karan 45 D105 19-Feb-2006 200 M
4 Tarun 12 D101 01-Jan-2006 300 M
5 Zubin 36 D108 12-Jan-2006 250 M
6 Ketaki 16 D108 24-Feb-2006 300 F
7 Ankita 29 D120 20-Feb-2006 800 F
8 Zareen 45 D115 22-Feb-2006 300 F
9 Kush 19 D120 13-Jan-2006 800 M
10 Shailya 31 D125 19-Feb-2006 400 F
Table : DEPARTMENT
D_CODE DEPARTMENT DOCTOR
D101 Surgery Dr.D.Nayar
D105 Orthopedic Dr.M.Roy
D108 ENT Dr.K.Bhatia
D115 Gynecology Dr.P.Tejpal
D120 Cardiology Dr.D.Singh
D125 Nuvlear Medicine Dr.A.Banerjee

1. To show information about the patients of cardiology department.


2. To list names of female patients with their date of admission in ascending
order.
3. To list name of patients who are admitted after 15-Jan-2006.
4. To display Patients name and name of the Doctor with their Department.
5. To count the number of patients with age> 30.
SET 8

Q1. Write a menu driven program using separate functions to perform the
following :
i) create a text file “HAPPY.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter.)
iii) to count and display the number of lines starting with alphabet „T‟
present in a text file “HAPPY.TXT”.
iv) to reverse each line of a text file and store it in “NEWFILE.TXT”. Display
the contents of the file “NEWFILE.TXT”

Q2. Write SQL commands for the following:


Table : HOSPITAL
NO NAME AGE D_CODE DATOFADM CHARGES SEX
1 Sandeep 65 D101 23-Feb-2006 300 M
2 Ravina 24 D105 20-Jan-2006 200 F
3 Karan 45 D105 19-Feb-2006 200 M
4 Tarun 12 D101 01-Jan-2006 300 M
5 Zubin 36 D108 12-Jan-2006 250 M
6 Ketaki 16 D108 24-Feb-2006 300 F
7 Ankita 29 D120 20-Feb-2006 800 F
8 Zareen 45 D115 22-Feb-2006 300 F
9 Kush 19 D120 13-Jan-2006 800 M
10 Shailya 31 D125 19-Feb-2006 400 F
Table : DEPARTMENT
D_CODE DEPARTMENT DOCTOR
D101 Surgery Dr.D.Nayar
D105 Orthopedic Dr.M.Roy
D108 ENT Dr.K.Bhatia
D115 Gynecology Dr.P.Tejpal
D120 Cardiology Dr.D.Singh
D125 Nuvlear Medicine Dr.A.Banerjee

1. To insert a new row in the Hospital table with following data:


11 Rakesh 40 D125 25-Feb 2006 350 M
2. To reduce charges by 10% for all female patients.
3. To add a new column named MOBILENO of Number(10) in the table
Department.
4. To calculate average charges of the patients in each department.
5. To delete Zareen from hospital table.
SET 9

Q1. Write a menu driven program using separate functions to


i) create a text file “FUNNY.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter.)
iii) to count and display the number of lines, number of words, number of
uppercase characters and number of lowercase characters in the file
iv) to create a new file called “STRANGE.TXT” with all uppercase letters
converted to lowercase and vice versa from “FUNNY.TXT”. Display the
contents of the file “STRANGE.TXT”

Q2. Write SQL commands for the following:

Table STOCK
NO ITEMCODE QUANTITY DATEOFPURCHASE WARRANTY
1 C201 9 21-May-2005 2
2 P1010 3 21-May-2005 4
3 S203 1 29-Sep-2004 3
4 C201 2 13-Jun-2005 1
5 P1010 1 31-Oct-2004 2
6 U34 5 21-May-2005 1
7 P1010 2 11-Jan-2006 2
Table: ITEM
ITEMCODE ITEMNAME PRICE
C201 Computer 39000
P1010 Printer 11000
S203 Scanner 4500
WC05 Camera 1200
U34 UPS 1900
1. To select item purchased after 31-Jan-2005.
2. To list the item name in descending order of date of purchase where quantity
is more than three
3. To count number of Items (total quantity) whose cost is more than 10000.
4. To insert a new record in the table STOCK with following data:
8 C201 5 13-Jun- 1
2005

5. To find distinct item type (itemcode) from STOCK.


SET
1010

Q1 Declare a class STATE containing data members : name of the state and
its capital. Include member functions to read and display the data
members. Create a data file “STATE.DAT” containing objects of class
STATE. Write an interactive menu driven Object Oriented program to do
the following:
1. Append (create) records
2. Display all records
3. Determine the capital if the name of the state is known
4. To modify the capital in the same file for the state name input by
the user.

Q2. Write SQL commands for the following:

Table STOCK
NO ITEMCODE QUANTITY DATEOFPURCHASE WARRANTY
1 C201 9 21-May-2005 2
2 P1010 3 21-May-2005 4
3 S203 1 29-Sep-2004 3
4 C201 2 13-Jun-2005 1
5 P1010 1 31-Oct-2004 2
6 U34 5 21-May-2005 1
7 P1010 2 11-Jan-2006 2

Table: ITEM
ITEMCODE ITEMNAME PRICE
C201 Computer 39000
P1010 Printer 11000
S203 Scanner 4500
WC05 Camera 1200
U34 UPS 1900
1. To generate a report on each item code with the item name and total value
(quantity * Price).
2. To find average cost of all items with quantity more than 2 items.
3. To find average cost of items with date of purchase is before 1-Jan-2005.
4. To reduce the cost of all UPS by 100.
5. To delete all the records in the table STOCK.
SET
Q1 Following is the structure of each 1111 record of a binary data file named
“PLAYER.DAT”. struct PLAYER
{ char P_Code[10];
char P_Name[10];
int score; };
Write a menu driven program using functions to
i) create a binary file “PLAYER.DAT”
ii) display the contents of the file. (Name of the file to be taken as parameter.)
iii) to update the file with a new value of score for a given player code. The
values of P_Code and score are to be read during the execution of the
program.
Q2. Write SQL commands for the following:
TABLE: DOCTOR
ID NAME DEPT SEX EXPERIENCE
101 John ENT M 12
104 Smith ORTHOPEDIC M 5
107 George CARDIOLOGY M 10
114 Lara SKIN F 3
109 K George MEDICINE F 9
105 Johnson ORTHOPEDIC M 10
117 Lucy ENT F 3
111 Bill MEDICINE F 12
130 Morphy ORTHOPEDIC M 15
TABLE: SALARY
ID BASIC ALLOWANCE CONSULTATION
101 12000 1000 300
104 23000 2300 500
107 32000 4000 500
114 12000 5200 100
109 42000 1700 200
105 18900 1690 300
130 21700 2600 300
1. Display NAME of all doctors who are in "MEDICINE" having more than 10 years
experience from the table DOCTOR.
2. Display the average salary of all doctors working in "ENT" department using the tables
DOCTOR and SALARY. Salary = BASIC + ALLOWANCE
3. Display the minimum ALLOWANCE of female doctors.
4. Display the highest consultation fee among all male doctors.
5. Display the number of records of female doctors
SET
1212
Q1 Consider the following class definition:
class Room
{ int R_Code;
char Department[30];
int Number;
public:
void get_data( )
{ cout << “Room Code :”; cin >> R_Code;
cout << “Department :”; gets(Department);;
cout << “Total Labs :”; cin >> Number;
}
void Disp_data( )
cout << “Room Code :”; << R_Code;
cout << “Department :”; << Department;;
cout << “Total Labs :”; << Number;
}
int Get_code( ) { return R_Code;}
};
Write a menu driven program using separate functions:
a) To create and append records to a binary file called “Rooms.dat”
b) To read the file the file and display it‟s contents.
c) To search for a record for a R_Code given by the user and replace
the record with a new record given by the user.
Q2. Write SQL commands for the following:
TABLE :CONSIGNOR
CnorID CnorName CnorAddress City
ND01 R Singhal 24,ABC Enclave New Delhi
ND02 Amit Kumar 123,Palm Avenue New Delhi
MU15 R Kohli 5/A,South Street Mumbai
MU50 S Kaur 27-K,Westend Mumbai
TABLE:CONSIGNEE
CneeID CnorID CneeName CneeAddress CneeCity
MU05 ND01 Rahul Kishore 5,Park Avenue Mumbai
ND08 ND02 P Dhingra 16/J,Moore Enclave New Delhi
KO19 MU15 A P Roy 2A,Central Avenue Kolkata
MU32 ND02 S Mittal P 245 AB Colony Mumbai
ND48 MU50 B P Jain 13,Block D,A Vihar New Delhi

i). To display the names of all Consignors from Mumbai.


ii). To display the CneeID, CnorName, CnorAddress, CneeName,
CneeAddress for every Consignee.
iii). To display consignee details in ascending order of CneeName.
iv). To display number of consignors from each city.
v). To display the unique cities from Consignee.
SET
1313
Q1 Write a menu driven program using separate functions to
i) create a text file “JOKE.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter)
iii) to count and display the number of lines, number of words, number of
uppercase characters and number of lowercase characters in the file
iv) to create a new file called “STRANGE.TXT” that contains all the lines
form the file “JOKE.TXT” that start with a vowel. Display the contents
of the file “STRANGE.TXT”

Q2. Write SQL commands for the following:

Table :Sender
SenderID SenderName SenderAddress SenderCity
ND01 R Jain 2, ABC Appts New Delhi
MU02 H Sinha 12, Newtown Mumbai
MU15 S Jha 27/A, Park Street Mumbai
ND50 T Prasad 122 – K, SDA New Delhi

Table : Recipient

RecID SenderID RecName RecAddress RecCity


KO05 ND01 R Bajpayee 5, Central Avenue Kolkata
ND08 MU02 S Mahajan 116, A Vihar New Delhi
MU19 ND01 H Singh 2A, Andheri East Mumbai
MU32 MU15 P K Swamy B5, C S Terminus Mumbai
ND48 ND50 S Tripathi 13, Bl D, Mayur Vihar New Delhi

(i) To display the names of all Senders from Mumbai


(ii) To display the RecID, SenderName, SenderAddress, RecName,
Rec Address for every Recipient
(iii) To display Recipient details in ascending order of RecName
(iv) To display number of Recipients from each city
(v) To display the SenderName,RecName of those Senders whose
Recipients are from Mumbai.
SET
1414
Q1 Write a menu driven program using separate functions to
i) create a text file “COMPUTER.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter.)
iii) create a new file called “LAPTOP.TXT” with all uppercase letters
converted to lowercase and vice versa from “COMPUTER.TXT”.
Display the contents of the file “LAPTOP.TXT”
iv) to count and display the number of lines, number of words, number of
uppercase characters and number of lowercase characters in the file

Q2. Write SQL commands for the following:

Table: INTERIORS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double Bed 23-Feb-2006 32000 15
2 Soft touch Baby cot 20-Jan-2006 9000 10
3 Jerry‟s home Baby cot 19-Feb-2006 8500 10
4 Rough woof Office table 01-Jan-2006 20000 20
5 Comfort zone Double bed 12-Jan-2006 15000 20
6 Jerry look Baby cot 24-Feb-2006 7000 19
7 Lion king Office table 20-Feb-2006 16000 20
8 Royal tiger Sofa 22-Feb-2006 30000 25
9 Park sitting Sofa 13-Dec-2005 9000 15
10 Dine Paradise Dining Table 19-Feb-2006 11000 15

1. To show all information about the Sofa‟s from the interiors table.
2. To list the item name which are priced at more than 10000 from the interiors
table.
3. To display item name and date of stock of those items, in which the discount
percentage is more than 15 from interiors table.
4. To list item name and type of items, in which data of stock is before 22-Jan-
2002 from the interiors table in descending order of item name.
5. To count the number of items of each type from interiors table.
SET
1515
Q1. The following data items are to be stored for a student:
a) Stu_no
b) Stu_name
c) Percentage
Write an object oriented program to store the data for a student in a
STACK using LINKED implementation. Your program should have the
following member functions.
a) push()
b) pop()
c) display()
These functions are called as per the user‟s choice

Q2. Write SQL commands for the following:

Table: INTERIORS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double Bed 23-Feb-2006 32000 15
2 Soft touch Baby cot 20-Jan-2006 9000 10
3 Jerry‟s home Baby cot 19-Feb-2006 8500 10
4 Rough woof Office table 01-Jan-2006 20000 20
5 Comfort zone Double bed 12-Jan-2006 15000 20
6 Jerry look Baby cot 24-Feb-2006 7000 19
7 Lion king Office table 20-Feb-2006 16000 20
8 Royal tiger Sofa 22-Feb-2006 30000 25
9 Park sitting Sofa 13-Dec-2005 9000 15
10 Dine Paradise Dining Table 19-Feb-2006 11000 15

1. To insert new row in interiors table with following data:


11 White wood Double Bed 23-Feb-2006 20000 20

2. To count distinct types from interiors table.


3. To find average discount from interiors for each type of interiors.
4. To calculate sum of price from interiors where data of stock is before 12-Feb-
2002
5 To increase price of all Office table by 3000 from interiors table.
SET
1616

Q1. The following data items are to be stored for an employee:-


a) Emp_no
b) Emp_name
c) Salary
Write an object oriented program to create a data structure (QUEUE) to
store the data using circular array implementation. Your program should
have the following member functions:
a) qadd()
b) qdelete()
c) qdisplay()
These functions are called as per the user‟s choice.

Q2. Write SQL commands for the following:

Table : BOOKS

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++ Brains & Brroke EPB 350 Text 10
T0002 C++ A.M.Rossaine TDH 350 Text 15
Brainworks
F0002 Thunderbolts Anna Roberts First Publishers 750 Fiction 50

Table : ISSUED

BOOK_ID QUANTITY_ISSUED
T0001 4
C0001 5
F0001 2

1. To show book name, author name and price of books of First Publishers.
2. To list the names from books of Text type.
3. To display the names and price from books in ascending order of their price.
4. To increase the price of all books of EPB publishers by 10%.
5. To display the book id, book name and quantity issued for all books which
have been issued.
SET
1717
Q1 A QUEUE is to be created using circular array implementation, each element
of the queue having the following information
a) Roll number of the student
b) Age of the student
Front and Rear are two variables that indicate the position of the first and
the last element. Write the following functions;
a) QINSERT( ) -to add an element in to the QUEUE. [Check for overflow]
b) QDELETE( )-to remove an element from QUEUE [check for underflow]
c) QDISPLAY( )-to display all elements of the QUEUE.
Write a complete object oriented menu driven program to implement the QUEUE.

Q2. Write SQL commands for the following:

Table : BOOKS
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++ Brains & Brroke EPB 350 Text 10
T0002 C++ A.M.Rossaine TDH 350 Text 15
Brainworks
F0002 Thunderbolts Anna Roberts First Publishers 750 Fiction 50

Table : ISSUED
BOOK_ID QUANTITY_ISSUED
T0001 4
C0001 5
F0001 2

1. To insert new row in the table issued having the following data:
„F3003‟, 1
2. To display the total no. of books (quantity) of each type.
3. To find the maximum price from books which have quantity more than 15.
4. To count unique publishers from books
5. To display the no. of titles available of each publishers.
SET
1818

Q1 Write a complete object oriented menu driven program to implement a


STACK using an array.
Each node contains the following information.
a) Item code
b) Item description
Use a class to perform the PUSH( ), POP( ) and DISPLAY() functions.

Q2. Write SQL commands for the following:

Table : GAMES

GCODE GAMENAME NUMBER PRIZEMONEY SCHEDULEDATE


101 Carom Board 2 5000 23-Jan-2006
102 Badminton 2 12000 12-Dec-2005
103 Table Tennis 4 8000 14-Feb-2006
105 Chess 2 9000 01-Jan-2006
108 Lawn Tennis 4 25000 19-Nov-2005

Table : PLAYER

PCODE NAME GCODE


1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103

1. To display the names of all games where schedule data is after 31-Dec-2005.
2. To display the name of the players in the table player with their gamesname.
3. To display the content of the games table in ascending order of scheduledate.
4. To display the sum of prize money received by players in the table games.
5. To add a new column (attribute) ADDRESS of type Char(20) in the table
PLAYER.
SET
1919

Q1. Each node of a QUEUE contains the following information along with a
pointer which stores the address of the next node.
a) Roll number of the student.
b) Age of the student
FRONT & REAR are pointers pointing to the first and last node of the
QUEUE. Write the following function.
a) QINSERT()-To insert a node in the QUEUE which is allocated
dynamically
b) QDELETE( ) – To remove a node from the QUEUE and release the
memory
c) QDISPLAY( ) – To display the QUEUE
Write a complete menu driven object oriented program to implement the
above.

Q2. Write SQL commands for the following:

Table : GAMES
GCODE GAMENAME NUMBER PRIZEMONEY SCHEDULEDATE
101 Carom Board 2 5000 23-Jan-2006
102 Badminton 2 12000 12-Dec-2005
103 Table Tennis 4 8000 14-Feb-2006
105 Chess 2 9000 01-Jan-2006
108 Lawn Tennis 4 25000 19-Nov-2005

Table : PLAYER
PCODE NAME GCODE
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103

1. To display maximum and minimum schedule date.


2 To change the prize money for Chess from 9000 to 10000.
3. To display unique gcodes from players.
4. To delete all rows from games table where schedule date was before 01-Jan-
2006.
5. To insert a new record in the player table as follows:
5 Anand 105
SET 20

Q1 Each element of the QUEUE is a structure having information about books


in the Library such as
(a) Book Code (b) Book Name (c) No of pages.
The above data is to be stored in a QUEUE implemented as a circular
array using classes. Define the member function
CQAdd( )
CQDelete( )
CQDisplay( )
Write a complete menu driven object oriented program to implement the
above.

Q2. Write SQL commands for the following:

Table : HOSPITAL
NO NAME AGE D_CODE DATOFADM CHARGES SEX
1 Sandeep 65 D101 23-Feb-2006 300 M
2 Ravina 24 D105 20-Jan-2006 200 F
3 Karan 45 D105 19-Feb-2006 200 M
4 Tarun 12 D101 01-Jan-2006 300 M
5 Zubin 36 D108 12-Jan-2006 250 M
6 Ketaki 16 D108 24-Feb-2006 300 F
7 Ankita 29 D120 20-Feb-2006 800 F
8 Zareen 45 D115 22-Feb-2006 300 F
9 Kush 19 D120 13-Jan-2006 800 M
10 Shailya 31 D125 19-Feb-2006 400 F

Table : DEPARTMENT
D_CODE DEPARTMENT DOCTOR
D101 Surgery Dr.D.Nayar
D105 Orthopedic Dr.M.Roy
D108 ENT Dr.K.Bhatia
D115 Gynecology Dr.P.Tejpal
D120 Cardiology Dr.D.Singh
D125 Nuvlear Medicine Dr.A.Banerjee

1. To show information about the patients of cardiology department.


2. To list names of female patients with their date of admission in ascending
order.
3. To list name of patients who are admitted after 15-Jan-2006.
4. To display Patients name and name of the Doctor with their Department.
5. To count the number of patients with age> 30.
SET

Q1 The following data item to be stored for a student:-


a) Stu_no
b) Stu_name
c) Percentage
Create a data structure (QUEUE) to store the data using LINKED
implementation. Your program will have the following member functions.
a) add( ) b) delete( ) c) display( )
These functions are called as per the user‟s choice.
Write a complete menu driven object oriented program to implement the
above

Q2. Write SQL commands for the following:

Table : HOSPITAL
NO NAME AGE D_CODE DATOFADM CHARGES SEX
1 Sandeep 65 D101 23-Feb-2006 300 M
2 Ravina 24 D105 20-Jan-2006 200 F
3 Karan 45 D105 19-Feb-2006 200 M
4 Tarun 12 D101 01-Jan-2006 300 M
5 Zubin 36 D108 12-Jan-2006 250 M
6 Ketaki 16 D108 24-Feb-2006 300 F
7 Ankita 29 D120 20-Feb-2006 800 F
8 Zareen 45 D115 22-Feb-2006 300 F
9 Kush 19 D120 13-Jan-2006 800 M
10 Shailya 31 D125 19-Feb-2006 400 F

Table : DEPARTMENT
D_CODE DEPARTMENT DOCTOR
D101 Surgery Dr.D.Nayar
D105 Orthopedic Dr.M.Roy
D108 ENT Dr.K.Bhatia
D115 Gynecology Dr.P.Tejpal
D120 Cardiology Dr.D.Singh
D125 Nuvlear Medicine Dr.A.Banerjee

1. To insert a new row in the Hospital table with following data:


11 Rakesh 40 D125 25-Feb 2006 350 M
2. To reduce charges by 10% for all female patients.
3. To add a new column named MOBILENO of Number(10) in the table
Department.
4. To calculate average charges of the patients in each department.
5. To delete Zareen from hospital table.
SET

Q1. A Queue containing telephone numbers is to be implemented using linked


list. Write a menu driven object oriented program to do the following:
a) to add (append) a telephone number
b) to display all stored numbers
c) to delete a telephone number from the queue

Q2. Write SQL commands for the following:

Table STOCK
NO ITEMCODE QUANTITY DATEOFPURCHASE WARRANTY
1 C201 9 21-May-2005 2
2 P1010 3 21-May-2005 4
3 S203 1 29-Sep-2004 3
4 C201 2 13-Jun-2005 1
5 P1010 1 31-Oct-2004 2
6 U34 5 21-May-2005 1
7 P1010 2 11-Jan-2006 2

Table: ITEM
ITEMCODE ITEMNAME PRICE
C201 Computer 39000
P1010 Printer 11000
S203 Scanner 4500
WC05 Camera 1200
U34 UPS 1900

1. To select item purchased after 31-Jan-2005.


2. To list the item name in descending order of date of purchase where quantity
is more than three
3. To count number of Items (total quantity) whose cost is more than 10000.

4. To insert a new record in the table STOCK with following data:


8 C201 5 13-Jun-2005 1

5. To find distinct item type (itemcode) from STOCK.


SET

Q1 Write a complete menu driven object oriented program to implement a


QUEUE using an array. Each node contains the following information.
(1) Item Code
(2) Item description
Use a class to perform the QADD( ),QDELETE ( ) and QDISPLAY( )
functions.

Q2. Write SQL commands for the following:

Table STOCK
NO ITEMCODE QUANTITY DATEOFPURCHASE WARRANTY
1 C201 9 21-May-2005 2
2 P1010 3 21-May-2005 4
3 S203 1 29-Sep-2004 3
4 C201 2 13-Jun-2005 1
5 P1010 1 31-Oct-2004 2
6 U34 5 21-May-2005 1
7 P1010 2 11-Jan-2006 2

Table: ITEM
ITEMCODE ITEMNAME PRICE
C201 Computer 39000
P1010 Printer 11000
S203 Scanner 4500
WC05 Camera 1200
U34 UPS 1900
1. To generate a report on each item code with the item name and total value
(quantity * Price).
2. To find average cost of all items with quantity more than 2 items.
3. To find average cost of items with date of purchase is before 1-Jan-2005.
4. To reduce the cost of all UPS by 100.
5. To delete all the records in the table STOCK.
SET

Q1 Write an object oriented menu driven program to implement a queue using


an array of float values. The program should include QINSERT( ),
QDELETE( ) and QDISPLAY( ).

Q2. Write SQL commands for the following:

TABLE: DOCTOR
ID NAME DEPT SEX EXPERIENCE
101 John ENT M 12
104 Smith ORTHOPEDIC M 5
107 George CARDIOLOGY M 10
114 Lara SKIN F 3
109 K George MEDICINE F 9
105 Johnson ORTHOPEDIC M 10
117 Lucy ENT F 3
111 Bill MEDICINE F 12
130 Morphy ORTHOPEDIC M 15
TABLE: SALARY
ID BASIC ALLOWANCE CONSULTATION
101 12000 1000 300
104 23000 2300 500
107 32000 4000 500
114 12000 5200 100
109 42000 1700 200
105 18900 1690 300
130 21700 2600 300
1. Display NAME of all doctors who are in "MEDICINE" having more than 10 years
experience from the table DOCTOR.
2. Display the average salary of all doctors working in "ENT" department using the tables
DOCTOR and SALARY. Salary = BASIC + ALLOWANCE
3. Display the minimum ALLOWANCE of female doctors.
4. Display the highest consultation fee among all male doctors.
5. Display the number of records of female doctors
SET 25

Q1 Write a program using functions to


i) create a text file “MYFILE.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter.)
iii) to read the contents of an existing text file MYFILE.TXT and print each
of its words in a different line. Example, if the string is “Hello how are you”

Then the output should appear as


Hello
how
are
you
vi) to count the number of lines in the file
vii) to create a new file called “ NEW.TXT” with all uppercase letters
converted to lowercase and vice versa from “MYFILE.TXT”

Q2. Write SQL commands for the following:


TABLE :CONSIGNOR
CnorID CnorName CnorAddress City
ND01 R Singhal 24,ABC Enclave New Delhi
ND02 Amit Kumar 123,Palm Avenue New Delhi
MU15 R Kohli 5/A,South Street Mumbai
MU50 S Kaur 27-K,Westend Mumbai
TABLE:CONSIGNEE
CneeID CnorID CneeName CneeAddress CneeCity
MU05 ND01 Rahul Kishore 5,Park Avenue Mumbai
ND08 ND02 P Dhingra 16/J,Moore Enclave New Delhi
KO19 MU15 A P Roy 2A,Central Avenue Kolkata
MU32 ND02 S Mittal P 245 AB Colony Mumbai
ND48 MU50 B P Jain 13,Block D,A Vihar New Delhi

vi). To display the names of all Consignors from Mumbai.


vii). To display the CneeID, CnorName, CnorAddress, CneeName,
CneeAddress for every Consignee.
viii). To display consignee details in ascending order of CneeName.
ix). To display number of consignors from each city.
x). To display the unique cities from Consignee.
SET

Q1 Write a menu driven program using separate functions to


i) create a text file “JOKE.TXT”
ii) display the contents of the file. (Name of the file to be taken as
parameter)
v) to count and display the number of lines, number of words, number of
uppercase characters and number of lowercase characters in the file
vi) to create a new file called “STRANGE.TXT” that contains all the lines
form the file “JOKE.TXT” that start with a vowel. Display the contents
of the file “STRANGE.TXT”

Q2. Write SQL commands for the following:

Table :Sender
SenderID SenderName SenderAddress SenderCity
ND01 R Jain 2, ABC Appts New Delhi
MU02 H Sinha 12, Newtown Mumbai
MU15 S Jha 27/A, Park Street Mumbai
ND50 T Prasad 122 – K, SDA New Delhi

Table : Recipient

RecID SenderID RecName RecAddress RecCity


KO05 ND01 R Bajpayee 5, Central Avenue Kolkata
ND08 MU02 S Mahajan 116, A Vihar New Delhi
MU19 ND01 H Singh 2A, Andheri East Mumbai
MU32 MU15 P K Swamy B5, C S Terminus Mumbai
ND48 ND50 S Tripathi 13, Bl D, Mayur Vihar New Delhi

(iv) To display the names of all Senders from Mumbai


(v) To display the RecID, SenderName, SenderAddress, RecName,
Rec Address for every Recipient
(vi) To display Recipient details in ascending order of RecName
(iv) To display number of Recipients from each city
(vi) To display the SenderName,RecName of those Senders whose
Recipients are from Mumbai.

S-ar putea să vă placă și