Sei sulla pagina 1di 10

1

RYAN INTERNATIONAL SCHOOL


MAYUR VIHAR
LIST OF PROGRAMS FOR BOARD PRACTICALS
SESSION 2019 - 2020
STD : XII SCIENCE
SUBJECT : COMPUTER SCIENCE

STRUCTURES

(1)Q1. Write a program to define a structure HONOUR with the following data members:
1. Name of the Winners 2.Type of the Award 3.Prize Amount
Now declare an array of structure with N number of elements and perform the following using
separate functions for each:
1. Fill the array
2. Show the contents of the array in a tabular form
3. Display all those winners who have earned a prize amount more than 50,000
4. Display the name and the prize amount of the biggest prize amount winner

(2)Q2. Declare a structure ELECTRIC having the following members:


Cust_NO, Name, No_of_unitsconsumed and bill.
Then the bill has to be calculated as below:
Units consumed Tariff
For the first 100 units Rs. 0.40 per unit
For the next 200 units Rs. 0.50 per unit
For the next 300 units Rs. 0.75 per unit
For the next 400 units Rs. 1.00 per unit
Beyond 1000 units Rs. 1.50 per unit
Write a complete C++ program to calculate the bill and display the information of all the customers
using array of structures in the sorted order of customer number using array sort.
Make use of functions and make the program interactive and menu driven.

FUNCTION OVERLOADING
(3)Q 1.Write a program to illustrate working of function overloading. Calculate interest amount using
function overloading.

(4)Q 2.Write a C++ program that uses an area( ) function for the calculation of area of a triangle or a
rectangle or a square. Number of sides (3 for triangle, 2 for rectangle, 1 for square) suggest about the
shape for which area is to be calculated.
2

CLASSES AND OBJECTS

(5)Q1. Declare a class to represent bank account of 10 customers with the following data members.
Name of the depositor, Account number, Type of account, (S for Saving and C for Current),
Balance amount. The class also contains member functions to do the following:
(i) To initialize data members (ii) To deposit money
(iii) To withdraw money after checking (iv) to display the data Members.
The balance (minimum balance in Rs. 1000)

(6)Q 2.Write a C++ program using classes and objects to simulate result preparation system for 20
students. The data available for each student includes rollno, name and marks in 3 subjects. The
percentage marks are the average marks and the grade is calculated as follows:
Percentage marks grade
<50 ‘E’
>=50<60 ‘D’
>=60<75 ‘C’
>=75<90 ‘B’
>=90<100 ‘A’

(7)Q 3. Write a C++ program to perform the various operations on a string class without using
language supported built-in string functions. The operations to be done on the class are:
(a) Read a string
(b) Display the string
(c) Reverse the string
(d) Copy the string into an empty string
(e) Concatenate two strings

(8)Q 4. Write a class to represent a vector (1 – dimensional numeric array) . Include the following
member functions :
1. For vector creation
2. For modification of a given element
3. For displaying the largest value in the vector
4. For displaying the smallest value in the vector
5. For displaying the entire vector

CONSTRUCTORS AND DESTRUCTORS

(9)Q 1. Define a class TravelPlan in C++ with the following descriptions:


Private members :
PlanCode Of type long
Place Of type character array (string)
Number_of_travellers Of type integer
Number_of_buses Of type integer

Public members :
 A constructor to assign initial values of PlanCode as 1001, Place as “Agra”,
Number_of_travellers as 5, Number_of_buses as 1
3

 A function NewPlan( ) which allows user to enter PlanCode, Place and Number_of_travellers.
Also, assign the value of Number_of_buses as per the following conditions :

Number_of_travellers Number_of_buses
Less than 20 1
Equal to or more than 20 and less than 40 2
Equal to 40 or more than 40 3

(10)Q 2. Define a class Outfit in C++ with the following descriptions :


Private members :

OCode Of type string


OType Of type string
OSize Of type integer
OFabric Of type string
OPrice Of type float

A function InitPrice( ) which calculates and assigns the values of OPrice as follows :
For the value of OFabric “DENIM”,
OType OPrice(Rs)
TROUSER 1500
JACKET 2500
For fabric other than “DENIM” the above mentioned OPrice gets reduced by 25%.

Public members:
 A constructor to assign initial values of OCode, OType and OFabric with the word “NOT
INITIALISED” and OSize and OPrice with 0.
 A function Input( ) to input the values of the data members OCode, OType, OSize and OFabric
and invoke the InitPrice( ) function.
 A function Display( ) which displays the content of all the data members for an Outfit.

INHERITANCE
(11)Q 1.Write a C++ program to read and display information about employees and managers.
Employee is a class that contains employee number (int), name (char array), address (char array) and
department (char array). Manager class contains all information of the employee class and a list of
employees working under a manager.

DATA FILE HANDLING

(12)Q1.Write a complete menu driven program that creates a file ,calculates and displays the total
number of vowels in the file ,calculates and displays the total number of spaces in the file ,
calculates and displays the total number of alphabets in the file , calculates and displays the total
number of words in the file. Make use of the following functions and ask the user for his/her choice
:
1. createfile( ) 2. displayfile( ) 3. vowelcheck( )
4. spacecount( ) 5. alphacount ( ) 6. wordscount( )
4

(13)Q 2.Given a Binary file phone.dat , containing records of the following type:
class Phonelist
{
char Name[20];
char Address[30];
char Areacode[5];
char PhoneNum[15];
public:
void Register( );
void Show( );
void Transfer( );
int CheckCode(char AC[])
{
return strcmp(Areacode, AC);
}
};
Write complete menu driven program , complete the definitions of the functions.Void Register( )
function to input all data and write the records to the file , void Show( ) to display all data after
reading from the file .Void Transfer( ) to copy those records which are having Areacode as “DEL”
from Phone.dat to Phone_new.dat .

(14)Q 3. Given a Binary file APPLY.DAT , containing records of the following class Applicant type:
Class Applicant
{
Char A_Rno[10];
Char A_Name[30];
Int A_score;
Public:
Void Enrol ( )
{
Gets(A_Rno);
Gets(A_Name);
Cin>>A_Score;
}
Void Status( )
{ cout<<setw(12)<<A_Rno;
Cout<<setw(32)<<A_Name;
Cout<<setw(3)<<A_Score<<endl;
}
Int ReturnScore( )
{ return A_Score;
};
Write functions in C++
1.to write the objects of the file on to disk
2. To read objects from the file and display on screen
3. to read and display the details of those students whose A_Score is > 70.
Develop into a complete menu driven C++ program
5

(15)Q4. Assuming the class Applicant given below, write functions in C++ to perform the following:
class Applicant
{ char A_Rno[10];
char A_Name[20];
int A_Score; };
(i) Write the objects of class to a binary file.
(ii) Reads the objects of class from binary file and display them on screen.
(iii) Searches for a particular A_Rno.
(iv) Reads the file and lets the user make changes in data and invokes the function to display the
values.
(v) Just displays contents of the file.
Note : Include all the required function’s prototypes in the public section of the class.

(16)Q 5 . Write a menu driven program to read, display, append, and delete records in the file
MOVIE.DAT .Use the class given below.
class Movie
{ int movie_id;
char movie_name[20];
int no_of_seats;
int ticketcode;
int hallno;
public:
void readdata( );
void display( );
void append( );
void delete( );
};

(17)Q 6. Write a complete program that reads characters from the keyboard one by one. All lower case
characters get stored inside the file LOWER, all upper case characters get stored inside the file UPPER
and all other characters get stored inside file OTHERS. Use functions.

(18)Q 7. Write a complete file handling program which does the following on a text file :
(Make the program interactive, menu driven and using functions and switch case )
1. Create file 2. Display data from file 3. Show digit count 4. show alphabet count 5. show word
count 6. show line count 7. show space count 8. show vowel count 9. show count of consonants
10. show count of all uppercase characters 11. show count of all lowercase characters 12. show
occurrence of the word "THE" or "the" or 'The" 13.show count of all 3 lettered words 14. exit

(19)Q 8. Write a complete program in C++ that reads a text file ORIG.TXT and creates another identical file
NEW.TXT except for the fact that every sequence of consecutive blank space is replaced by a single space.

(20)Q9. Consider the class given:

class BUS
{
int Bus_No;
char Destination[15];
float Distance;
6

public:
void READ( );
void WRITE( );
void ENTER ( );
void SHOW( );
void UPDATE ( ); // to ask for a Bus_No and update the other details
};

Complete the member functions definition of all methods. Use the binary file "BUS.dat". Ensure that required
validations(file existing) are done before displaying the records, in the main ( ).Records should be displayed
sequentially from beginning to end. Also, add any other function , if needed.

(21)10. Consider the class given:

class CAR
{
int CAR_No;
char Destination[15];
float Distance;
public:
void READ( );
void WRITE( );
void ENTER();
void SHOW( );
void DELETE( ); // to delete records as per user's choice
};

Complete the definition of all methods .Use the binary file "CAR.dat" . Ensure that required validations(file
existing) are done before displaying the records, in the main ( ).Records should be displayed sequentially from
beginning to end. Add any function if needed.

ARRAYS (USING FUNCTIONS)

(22)Q1. Write a program to 1.add two matrices 2. Subtract 2 matrices 3. Multiply 2 matrices. Use
switch case and use functions to achieve the task.
(23)Q2. Write a program to 1.transpose a matrix 2. Find the row sum 3. Find the column sum 4. sum
diagonal elements 5. sum elements below main diagonal 6. sum elements above main diagonal of a
given matrix. Use switch case and use functions to achieve the task.
(24)Q3. Write a program to illustrate the two types of searches in an integer type array. Make use of
functions and make a menu driven program.
(25)Q4. Write a program to illustrate all the three sorts – Insertion, Selection and Bubble sort in an
array. Make use of functions to do the same. Make a menu driven and user friendly program.
(26)Q5. Write a program to merge two given arrays into the third array C .Use switch case and
implement the same with atleast 4 different combinations. Make use of functions.
(27)Q6. An array, ARRAY [20], consists of 20 positive integers .Write a complete user friendly, menu
driven functions oriented C++ program to do the following:
1. Find the pairs of integers stored in A having sum = 50
2. Find the number of elements which are odd
3. Find the number of elements which are even
7

4. Find the number of elements which are divisible by 30


5. Find the largest of all the elements
6. Find the smallest of all the elements
7. Find the average of all the elements
(28)Q7. Let A be N X N two-dimensional array. Write user-defined functions in C++ for the following:
1. To find the number of non-zero elements in A.
2. To find the sum of all elements in A.
3. To find the sum of all elements A[i][j] for which i > j.
4. To find the sum of all elements A[i][j] for which i < j.
5. To find the product of all elements A[i][j] for which i = j.
(29)Q8. Program of project work done in Std 11.

LINKED LISTS, STACKS & QUEUES

(30)Q1. Write a program in C++ that creates a complete linked list class.

(31)Q2. Write a program to implement the use of Queue class.

(32)Q3. Write a program to implement the use of Stack class.

(33)Q4. Write a program in C++ to add, delete, search and display an element in a linked queue.

(34)Q5. Write a complete menu driven program in C++ for the implementation of linked stack.

(35)Q6. Write an interactive menu driven C++ program to implement circular queue using an array
consisting of integer data values.

SQL
(36)Q1. Write SQL commands for (a) to (f) on the basis of teacher relation given below:
Relation teacher
No. Name. Age Dept. Date of Salary Sex
join
1. Jugal 34 Computer 10/01/97 12000 M
2. Sharmila 31 History 24/03/98 20000 F
3. Sandeep 32 Math 12/12/96 30000 M
4. Sangeeta 35 History 01/07/99 40000 F
5. Rakesh 42 Math 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 Math’s 31/07/97 20000 F
(a) To show all information about the teachers of the history dept.
(b) To list the names of the female teachers who are in the Hindi Dept.
(c) To list all the teachers with their Date of joining in ascending order.
(d) To display student’s Name, Fee, Age for Male teachers only.
(e) To count the number of teachers with Age<23.
(f) TO insert a new row in the TEACHER table .
8

(37)Q2 Consider the following tables WORKERS and DESIG .Write the SQL commands for the
statements (i) to (v)
WORKERS
W-ID FIRST NAME LAST NAME ADDRESS CITY
102 Sam Tones 33 Elm St. Paris
105 Sarah Ackerman 440 U.S. 110 New York
144 Manila Sengupta 24 Friends New Delhi
Street
210 George Smith 83 First Street Howard
255 Mary Jones 842 Vine Ave. Losantiville
300 Robert Samuel 9 Fifth cross Washington
335 Henry Williams 12 Moore Boston
Street
403 Ronny Lee 121Harrison New York
Street
451 Pat Thompson 11 Red road Paris

DESIG
W_ID SALARY BENEFITS DESIGNATION
102 75000 15000 Manager
105 85000 25000 Director
144 70000 15000 Manager
210 75000 12500 Manager
255 50000 12000 Clerk
300 45000 10000 Clerk
335 40000 10000 Clerk
403 32000 7500 Salesman
451 28000 7500 Salesman

(i) To display W_ID first name, Address and City Of all the employees living in New York
from the table workers.
(ii) To display the contents of WORKERS table in ascending order of LASTNAME.
(iii) To display the First name, last name and total salary of all clerks from the tables
WORKERS and DESIG ,where Total Salary is calculated as salary + benefits.
(iv) To display the minimum salary among mangers and clerks from the table DESIG
(v) To display firstname, lastname and their designation who have their salaries above 60000.

(38)Q3.Consider the following table CONSIGNOR and CONSIGNEE. Write SQL commands for
following statements.
TABLE : CONSIGNOR
CnorID CnorName CnorAddress City

ND01 R Singhal Park avenue New Delhi

ND02 Amit Kumar 123, Palm Avenue New Delhi

MU15 R Kohli 5/A South Park Mumbai


9

MU50 S Kaur 27-K, westend Mumbai

TABLE : CONSIGNEE
CneeID CnrID CneerName CneeAddress city

MU05 ND01 Rahul Kishore ABC enclave Mumbai


ND08 ND02 P Dhingra 16/J, Moore enclave New Delhi
KO09 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

1. To display names of all CONSIGNOR from MUMBAI.


2. To display the CneeName, CnorName where consignor city is same as consignee
city.
3. To display consignee detalils in ascending order of CneeName.
4. To display distinct city from consignor.
5. To display CneeName and CnorName Where city is Mumbai.

(39)Q 4 study the following tables FLIGHTS and FARES and write the SQL commands for the
questions that follow
Flights
FL_NO. STARTING ENDING NO_FLIGHTS NO_STOPS
IC301 MUMBAI DELHI 8 0
IC799 BANGLORE 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 AHEMDABAD 4 0

FARES

FL_NO AIRLINES FARE TAX


10

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

Q1 Display FL_NO and NO_FLIGHTS from “KANPUR” to “BANGALORE” .


Q2 Display the total fare collected by INDIAN AIRLINES
Q3 display the FL_NO and FARE to be paid for the flights from DELHI to MUMBAI
Q4 Display STARTING, ENDING, AIRLINES and FARE from FLIGHTS and FARES where TAX
greater than 5
Q5 Display FL_NO and DISTINCT AIRLINES from FLIGHTS and FARES
************************************************************************

note: Rearrange topics as per the syllabus.

Potrebbero piacerti anche