0% found this document useful (0 votes)
7 views

Lab Manual

The OOPL Lab manual contains a series of programming exercises focused on fundamental concepts of object-oriented programming in C++. It includes tasks such as calculating sums, interchanging numbers, creating patterns, using classes and constructors, handling exceptions, and working with files. The exercises aim to enhance programming skills through practical application in C++.

Uploaded by

seema.chaudhary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Lab Manual

The OOPL Lab manual contains a series of programming exercises focused on fundamental concepts of object-oriented programming in C++. It includes tasks such as calculating sums, interchanging numbers, creating patterns, using classes and constructors, handling exceptions, and working with files. The exercises aim to enhance programming skills through practical application in C++.

Uploaded by

seema.chaudhary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

OOPL Lab manual

Q1) Write a program calculate sum of two no.

Q2) Write a program to interchange two numbers by using third variable

Q3) Write a program to calculate cube of a number.

Q4) Write a program to show table of a no.

Q5) Write a program to check number is even or odd

Q6) Write a program to show the greatest no. b/w three no.

Q7)Write a program to create table of a no by a user define function.

Q8) Write a program to show following pattern.

*****

****

***

**

Q9) Q5) Write a program to show following pattern

12345

1234

123

12

Q10). Write a program show even number from 1 to 10


Q11) Write a program to enter a no. then calculate sum of its digit.

Q12)create a class then calculate sum of two no.

Q13)Write a program to input rollno and name of a students and display


them.

Q13)Write a program to input rollno and name of 5 students and display


them,

Q14)Write a Program of scope resolution operator(::).


Q15) Write a program of default constructor

Q16) Write a program of parameterize constructor

Q17) Write a program to calculate factorial using constructor.

Q18) Write a Program using copy constructor to copy data of an


object to another object.
Q19) Write a program to use static variable and function.
Q20) Write a program to use friend function .
Q21) Write a program to swap to number using pointer.
Q22) Write a program in C++ to print first 10 nos of Fibonacci series
Series is 0,1,1,2,3,5,8------

Q23) ) Write a program in C++ to find area of Rectangle ,triangle, sphere


by using function overloading

Q24) Write a program to overload binary + operator

Q25)Write a program to check whether a given number is prime or not.

Q26) Write a C++ program to store students data in a sequential


file called student.txt. Use the fields Roll-Numbers, name, Course-
code,
Q27) What is a template? Write a template for adding two
numbers of difference data types.
Q28)Write a program containing a possible exception. Use
a try block to throw it and a catch block to handle it
property.
Q29)Write a C++ program that throws an arithmetic exception
whenever the input numbers is less than zero.
30)Define a class name Train representing Following members
Data Members Members Function
Train Number Initialize members
Train Name Input Train data
Source
Destination
Journey Date
Capacity
Write a c++ program to test the train class.
Q31)Write a C++ program illustrating Virtual classes & virtual functions.
Q32) Write a Program to design a student class representing
student roll no. and a test class (derived class of student)
representing the scores of the student in various subjects and
sports class representing the score in sports. The sports and test
class should be inherited by a result class having the functionality
to add the scores and display the final result for a student.
Q33) Given that an EMPLOYEE class contains following members: data
members: Employee number, Employee name, Basic, DA, IT, Net Salary
and print data members.

Q34) Write a C++ program to read the data of N employee and compute
Net salary of each employee (DA=52% of Basic and Income Tax (IT) =30%
of the gross salary).

You might also like