Vous êtes sur la page 1sur 7

LIST OF PRACTICALS

SESSION 2014-15
SUBJECT- COMPUTER SCIENCE (083)
List of practicals of Computer Science of class XII:
1. Write menu driven program to find to
i) Find the row sum and column sum of a given matrix.
ii) Transpose of the matrix.
The matrix and its size should be sent as function arguments.
2. Write a program to find the sum of both the diagonals of a matrix using function.
3. Write a program to swap any two numbers without using third variable.
4. Write a program to store information of 10 employees and to display of an
employee depending upon the employee no given by the user using structure.
5. Write a program (Telephone directory) that can sort a list of names and telephone
number alphabetically. Name to be treated as a unit. (Define them inside a structure).
Persons are sorted alphabetically be their first names. Persons with the same first
name are sorted by their last names.
6. Define a class report with the following specification:
Private:
adno, name, marks- array of five integers, average- float type
getavg( )- to compute the average obtained.
Public:
Report()- constructor
readinfo( )- to read all values
displayinfo( )- to display data members of report on the screen.
Implement this class in C++.
7.Define a class CARRENTAL in c++ with the following Description:
Private Member:
CarID of type long int
AboutCar of type string
Cartype of type string
Rent of type float

A member function AssignRent() to assign the following values


for rent as per the given Cartype
Cartype
Rent
Small
1000
Van
800
SUV
2500

Public members
A function GETCar() to allow user to enter values for CarID,
About Car, Cartype and call Function AssignRent() to assign Rent.
A function ShowCar() to allow user to view the content of all the
data members.
8. Write a program that reads two matricesM1[]mXn and M2[]mXn and compare them for
equality.
9. Write a program to accept the name and total marks of 20 students in an array.
Display the names of the students (including marks) securing highest and lowest
marks. (use array of structure).
10. Write a program using a class to store price list of 50 items and to print the largest
price as well as the sum of all prices. You can take name of class as ITEM.
11. Write a menu driven program using class to show the details of 10 students and
provide the facility of viewing details of the topper as well as of specific student by
providing his/her roll number. (Take the name of class as STUDENT).
12. Write a C++ Program using classes and objects to simulate result preparation
system for 30 students. The data available for each student includes rollno, name and
marks in 3 subjects. The percentage marks and grade are to be calculated from the
above information. The percentage marks are the average marks and the grade is
calculated as:
percentage marks
grade
<50
F
>= 50 & <60
D
>=60 & <75
C
>= 75 & <90
B
>= 90 & <100
A
13. Write a program to implement multilevel inheritance in C++ using classes.
14. Write a program in C++ to implement multiple and multilevel both inheritance.
By taking three classes as STUDENT Base class, TEST derived from Student, Class
SPORTS, and also a class RESULT- derived from TEST and SPORTS.
15. Write a program in C++ to write text to a file Test.txt and again reading back the
contents of the file & display it on the screen.
The contents is give asComputer Science Class XII.

CBSE Board
Programming in C++
16. Write a program in C++ to create a single file and display the contents of file. The
file should contain the record of 5 students.
17. Write a program in C++ to write and read a structure using write and read function
using a binary file. (The name of structure is customer and the structure variables are
name and balance).
18. Assuming the class EMPLOYEE given below write functions in C++ to perform
the following:
Write the objects of EMPLOYEE to a binary file, and Reads the objects of
EMPLOYEE from binary file and display them on screen.
class EMPLOYEE
{
int eno;
char ename[20];
public:
void getit( )
{
cin>> eno;
gets(ename);
}
void showit( )
{
cout<< eno<<ename<<endl;
}
};
19. Write a program in C++ to count number of alphabets present in a text file
record.txt.
20. Write a function in C++ to read the content from a text file NOTES. TXT, count
and display the number of blank spaces present in it.
21. Write a program that displays the size of a file in bytes.
22. Given a file studata.dat that stores the details of some students. These details
include rollno, name, class, and marks in five subjects. Using details in this file, create
another file called result.dat, which should store fields:
Rollno, percentage, grade.
The grade should be obtained as follows:
if percentage
then grade
<50
F
>= 50 & <60
D
>=60 & <75
C
>= 75 & <90
B

>= 90 & <100

23. Declare a class student having fields sname, section and marks and member
functions to
1) Append the records into a data file Student.dat
2) Display the records of the students having scoured more than 40%. Implement the
class using a menu driven program.
24. Write a menu driven program with function to1) Create an array of 10 integers
2) Sort the array using bubble sort
3) Search for a given integer from the array using binary search.
25. Suppose A,B, C are arrays of integers of sizes m,n, m+n respectively. The
numbers in A appear in ascending order while the numbers in B appear in descending
order. Write user defined function to produce a third array C by merging arrays A and
B in ascending order. The function has A,B, C and m,n as arguments. Implement it in
C++.
26. Write a C++ program to implements a stack using Linked List. The stack stores
integer data. The program should allow the user to PUSH elements into the STACK,
POP elements from the STACK & display the elements of the STACK.
27. Write a menu driven program with function to1) Insert a node in queue
2) Delete a node from queue
3) Search for a given node in the queue.
28. Write a menu driven program with function to1) Insert an element in circular queue
2) Delete an element from the circular queue
SQL QUERIES:
1.

Table : School Bus


Rtno Area_overed
Capacity Noofstudents Distance Transporter
1
Vasant kunj
100
120
10
Shivamtravels
2
Hauz Khas
80
80
10
Anand travels
3
Pitampura
60
55
30
Anand travels
4
Rohini
100
90
35
Anand travels
5
Yamuna Vihar
50
60
20
Bhalla Co.
6
Krishna Nagar
70
80
30
Yadav Co.
7
Vasundhara
100
110
20
Yadav Co.
8
Paschim Vihar
40
40
20
Speed travels
9
Saket
120
120
10
Speed travels
10
Jank Puri
100
100
20
Kisan Tours
(a) To show all information of students where capacity is more than the no of
student in order of rtno.
(b) To show area_covered for buses covering more than 20 km., but charges less
then 80000.

Charges
100000
85000
60000
100000
55000
80000
100000
55000
100000
95000

(c) To show transporter wise total no. of students traveling.


(d) To show rtno, area_covered and average cost per student for all routes where
average cost per student is - charges/noofstudents.
(e) Add a new record with following data:
(11, Moti bagh,35,32,10, kisan tours , 35000);
(f) Add a new record with following data:
(11, Moti bagh,35,32,10, kisan tours , 35000);
(g) Give the output considering the original relation as given:
(i) select sum(distance) from schoolbus where transporter= Yadav travels;
(ii) select min(noofstudents) from schoolbus;
(iii) select avg(charges) from schoolbus where transporter= Anand travels;
(iv) select distinct transporter from schoolbus;

2.

TABLE : GRADUATE
S.NO
1
2
3
4
5
6
7
8
9
10

(a)
(b)
(c)
(d)
(e)

(f)

NAME
KARAN
DIWAKAR
DIVYA
REKHA
ARJUN
SABINA
JOHN
ROBERT
RUBINA
VIKAS

STIPEND
400
450
300
350
500
400
250
450
500
400

SUBJECT
PHYSICS
COMP. Sc.
CHEMISTRY
PHYSICS
MATHS
CEHMISTRY
PHYSICS
MATHS
COMP. Sc.
MATHS

AVERAGE
68
68
62
63
70
55
64
68
62
57

DIV.
I
I
I
I
I
II
I
I
I
II

List the names of those students who have obtained DIV 1 sorted by NAME.
Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend
received in a year assuming that the STIPEND is paid every month.
To count the number of students who are either PHYSICS or COMPUTER SC
graduates.
To insert a new row in the GRADUATE table:
11,KAJOL, 300, computer sc, 75, 1
Give the output of following sql statement based on table GRADUATE:
(i) Select
MIN(AVERAGE)
from
GRADUATE
where
SUBJECT=PHYSICS;
(ii) Select SUM(STIPEND) from GRADUATE WHERE div=2;
(iii) Select
AVG(STIPEND)
from
GRADUATE
where
AVERAGE>=65;
(iv) Select COUNT(distinct SUBDJECT) from GRADUATE;
Assume that there is one more table GUIDE in the database as shown below:
Table: GUIDE

MAINAREA
PHYSICS
COMPUTER SC
CHEMISTRY
MATHEMATICS

ADVISOR
VINOD
ALOK
RAJAN
MAHESH

g) What will be the output of the following query?


SELECT NAME, ADVISOR FROM
GRADUATE,
SUBJECT= MAINAREA;

cout <<"Enter the password : " ;


pass1 = getch() ;
cout <<"*" ;
pass2 = getch() ;
cout <<"*" ;

GUIDE

WHERE

pass3 = getch() ;
cout <<"*" ;
;
if (pass1 == 'h' && pass2 == 'm' && pass3 == 's')
return ;
gotoxy(30,12) ;
cout <<" WORNG PASSWORD
";

Vous aimerez peut-être aussi