You are on page 1of 6

Computer Science (083) Practical File for Class XII

C++ Programming
SNo
.

Program Description

1.

Write a program to calculate simple interest and compound interest using


user-defined functions
Write a program to find power n of a number x. n should be a positive
number
Write a program to read a string and print out the following :
1) No. of capital alphabets,
2) No. of small alphabets,
3) No. of non-alphabets
Write a program to read a string and print it after replacing each of its
capital alphabets by the corresponding small alphabet and each small
alphabet by its corresponding capital alphabet.
Write a program to input 10 elements in an array and then display these
elements.
Write a program to input 10 elements in an array and then display these
elements in reverse order.
Write a program to print sum, difference and product of two 2D arrays
based on user input
Write a program to input elements in a 2D array and then display the sum of
main diagonal elements of this array.
WAP to create a structure of Students and show report card of student.

2.
3.

4.
5.
6.
7.
8.
9.
10.
11.

12.

13.

Dat
e

Write a program using function overloading to calculate area of a circle,


square and rectangle.
Define a class student with the following specifications:
Private members of the class:
Roll Number - An Integer
Name
- string of 30 characters
Address
- string of 50 characters
Class
- Integer
Percentage
- Float
Public members of the class:
getdata() - To input the data
putdata() - To display the data
ret_rollno() To return roll no
ret_clas() To return class
Write a program to define an array of 5 objects of this class, input the data
in this array and then display this list and search for a student using roll no
and class both.
Create a class student with data members name, class, section, roll No. and
function members getdata(), printdata(), and promote(). From this class
derive a class 'Sr_std' with additional data member stream. Also include
another function member change_stream().
Use these classes in a program.
Create a class Person with data members name, address and phone number
and member functions readinfo() and showinfo(). From Person class derive
classes Student and Employee with additional data members and member
functions to show and display details of each derived class

#1/6

Nn

Sign
.

14.

15.

16.

17.
18.
19.

20.

21.

22.

23.

Create a class Person with data members name, address and phone number
and member functions readinfo() and showinfo(). From Person class derive
class Student with additional data members and member functions to show
and display details. Using the Student class derive a class Graduate Student
with additional data members and member functions to show and display
details.
Create a class Clothing with data members code, type, size and material
and member functions to enter, show and calculate prize of each item by
the material i.e. if Material is cotton price is 1500, if Lycra then 1200. Write
constructor (to assign initial values) and destructor of the class and show its
working.
Create a class Bank with data members account no, name, address, balance
and data members to read, display, withdraw and deposit amount.
(minimum balance 1000)
Create objects to show working.
Write a program to implement call by reference using pointer
Write a program using pointers to show array elements using a pointer and
perform arithmetic operations on the array elements (1D Array)
Write an interactive C++ program to open a text file and then display the
following:
1) Number of vowels
2) Number of digits
3) Number of words
Declare a structure telerec in C++, containing name (20 characters) and
telephone number. Write a program to maintain a file of telephone records.
The program should allow the following functions on the file:
1) To append records in the file.
2) Display the name for a given telephone number. If the telephone
number does not exist then display error message "record not found".
A blood bank maintains a data file that contains the following information
for every donor: Name, Date of Birth, Telephone number, Blood group.
Write a program in C++ to do the following:
1) Given a blood group, display name, date of birth and phone number of
all the persons of the given blood group.
2) Append records in the file.
3) Input a telephone number and modify the corresponding record.
Write a menu driven program in C++ to perform the following functions on a
binary file BOOK.DAT containing objects of the following class:
class Book
{
int BookNo;
char Book_name[20];
float price;
public:
void input();
void display();
int getbno() {return Book_no;}
void setprice();
};
1. Append Records
2. Modify a record for a given book no.
3. Search for a record with a given Book name
Write a menu driven program which allows the user to perform the
following operations on a one dimensional array:
Insertion, deletion, searching, sorting (bubble, selection, insertion),
display.
The program should automatically perform binary search if the array is
sorted and linear search otherwise.
#2/6

24.

25.

26.
27.

28.

29.

30.

31.

Write a program to input integer data in two arrays. Input arrays one in
ascending order and the other one in descending order and then merge
them into a third array so that the data in the third array is in ascending
order.
Write a program to input elements of a 2D array and write functions to
print:
1) Upper diagonal of the matrix
2) Lower diagonal of the matrix
3) Diagonal elements of the matrix
Write a program to implement a linked list
Write a menu driven program which allows the user to perform the
following operations on a stack (Array implementation):
1) Push
2) Pop
3) Display
Write a menu driven program which allows the user to perform the
following operations on a queue (Array implementation):
1) Insert
2) Delete
3) Display
Write a menu driven program which allows the user to perform the
following operations on a stack (Linked implementation):
1) Push
2) Pop
3) Display
Write a menu driven program which allows the user to perform the
following functions on a queue of Employees (Linked implementation):
1) Insert
2) Delete
3) Display
Write a menu driven program which allows the user to perform the
following functions on a circular queue (Array implementation):
1) Insert
2) Delete
3) Display

#3/6

Index for SQL


Consider the tables given below and answer the questions that follow:
No
101
102
103
104
105
106
107
108
109
110
111
Dept
10
20
30
40
50
60

Name
John
Smith
George
Lara
K George
Johnson
Lucy
Bill
Morphy
Sarah
Henry

Salary
29000
35000
32000
38000
32000
37000
36000
42000
35000
40000
33000

DName
Sales
Finance
Admin
IT
HR
Logistics

Address
33 Elm St
440 US 110
24 Friends Street
9 Fifth Cross
12 Moore Street
121 Harris St
11 Red Road
87 Lake View
900 Park Street
124 Greenway St
109 Halt Road
Table: Department
MinSal
25000
30000
25000
25000
30000
15000

City
Paris
Upton
New Delhi
Washington
London
Boston
New Delhi
London
London
Boston
Boston
MaxSal
32000
50000
40000
45000
48000
23000

Dept
10
20
20
30
20
40
40
50
50
30
10
HOD
111
102
110
106
108

Write SQL commands to:


Create Table
1.
Create the table Employee.
2.

Create the table Department.

Insert data in a table


3.
Insert data in the table Employee
4.

Insert data in the table Department.

Simple Select
5.
Display the details of all the employees.
6.

Display the Dept number, Dept Name and HOD of all the departments.

7.

Display the Minimum Salary of all departments with their department names.

8.

Display the records of all the employees along with their annual salaries. The Salary column of the table
contains monthly salaries of the employees. The new column should be given the name Annual Salary.
Conditional Select using Where Clause

#4/6

9.

Display the details of all the employees who are working in London.

10.

Display the names of all the employees whose salary is greater than 40000

11.

Display the salaries of all the employees of department 10.

Using NULL
12.
Display the details of all the department who has no HOD assigned.

Using DISTINCT Clause


13.
Display the names of various City from the table Employee. A City name should appear only once.
14.

Display the various department numbers from the table Employee. A department number should be
displayed only once.
Using Logical Operators (NOT, AND, OR)
15.
Display the details of all the employees of department 10 who have salary above 32000.
16.
17.

Display the details of all the employees who are getting a salary of more than 30000 in the department
10.
Display the names and salaries of all the employees who are not working in department 20.

18.

Display the names and salaries of all the employees who are working neither in New Delhi nor in Boston

19.

Display the names of all the employees who are working in department 20 or 30.

20.

Display the details of all the employees whose salary is between 32000 and 38000.

Using IN Operator
21.
Display the names of all the employees who are working in department 20 or 30. (Using IN operator)
22.

Display the names and salaries of all the employees who are working neither in New Delhi nor in Boston
(Using IN operator)
Using BETWEEN Operator
23.
Display the details of all the employees whose salary is between 32000 and 38000.
(Using BETWEEN operator)
Using LIKE Operator
24.
Display the name, salary, and age of all the employees whose names start with M.
25.

Display the name, salary, and age of all the employees whose names end with a.

26.

Display the name, salary, and age of all the employees whose names contain a

27.

Display the name, salary, and age of all the employees whose names do not contain a

28.

Display the details of all the employees whose names contain a as the second character.

Using Aggregate functions


29.
Display the sum and average of the salaries of all the employees.
30.

Display the highest and the lowest salaries being paid in department 10.

#5/6

31.

Display the number of employees working in department 20.

Using ORDER BY clause


32.
Display the details of all the employees in the ascending order of their salaries.
33.

Display the details of all the employees in the descending order of their names.

34.

Display the details of all the employees in the ascending order of their City and within City in the
descending order of their salaries.
Using GROUP BY clause
35.
Display the total number of employees in each department.
36.

Display the highest salary, lowest salary, and average salary of each department.

37.

Display the average salary of employees in each department only for those departments in which average
salary is more than 35000.
Using UPDATE, DELETE, ALTER TABLE
38.

Increase the salary of all the employees in department 40 by 10%.

39.

Delete the records of all the employees whose salary is below 30000.

40.

Delete the records of all the employees of department 10 having salary less than 30000.

41.

Add another column HireDate of type Date in the Employee table.

JOIN of two tables


42.
Display the details of all the employees who work in Sales department.
43.

Display the Name and Department Name of all the employees.

44.

Display the details of employees who are HOD and working in Boston

45.

Display the name of the department and the name of the corresponding HOD for all the departments.

#6/6

You might also like