0% found this document useful (0 votes)
42 views2 pages

c++ imp 03-01-2024

ghfg

Uploaded by

anubhav.gcetj
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)
42 views2 pages

c++ imp 03-01-2024

ghfg

Uploaded by

anubhav.gcetj
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/ 2

SECTION-A

1. Abstraction and Encapsulation


a) Define Abstraction and Encapsulation in object-oriented
programming. Explain classes and objects with an example.
b) Write a C++ program to define the class Circle and
implement:
o A constructor
o A member function to calculate the area of the circle
o A member function to calculate the circumference of the
circle
2. Constructors and Destructors
a) What is a Constructor? List the properties of a constructor
function. Illustrate how a copy constructor works with an
example.
b) Define Destructors. Explain their significance in resource
management with an example program.
c) Differentiate between the different types of constructors
in C++.
3. Static Members
a) What is a static member? Explain the use of static data
members and static member functions with an example program.
b) What is the difference between call-by-value and call-by-
reference? Write a program to illustrate both.
4. Friend Function and this Pointer
a) What is a friend function? How is it implemented in C++?
Write a program to demonstrate its use.
b) What is the "this" pointer? Explain its significance with
an example program.
5. Pass by Value and Pointers
a) Write a C program to illustrate the concepts of pass-by-
value and pass-by-pointer in function calls.
6. Classes and Objects
a) Define a class Student with data members name, rollNumber,
and marks. Write a program to create an array of 5 Student
objects. Include member functions for input and display of
details.
b) Differentiate between Public and Private variables in C++.
Write a program to illustrate their scope.
7. Inline Functions
a) Implement a simple inline function in C++ that returns the
square of a number. Write a program to print the squares of
numbers from 1 to 5.
SECTION-B

1. Function Overloading
a) Define Function Overloading. Write a program to demonstrate
overloading using three versions of a function named
calculateArea() for calculating the area of a circle,
rectangle, and triangle.
2. Operator Overloading
a) Explain the need for operator overloading in C++. Why can't
all operators be overloaded?
b) Write a program to overload the + operator to add two
complex numbers.
3. Inheritance
a) What is inheritance? Explain the significance of access
specifiers in inheritance.
b) List the types of inheritance supported by C++ and explain
how inheritance is implemented with an example.
4. Virtual Functions
a) Define virtual functions and explain their necessity in
object-oriented programming.
b) Write a program to demonstrate the use of virtual functions
with a base class pointer and derived classes.
5. Templates
a) What is a Template Class? Explain its advantages. Write a
program to create a template class for a stack data structure.
b) Write a function template to find the maximum of two
numbers of any data type.
6. Exception Handling
a) Explain how exception handling works in C++ and why it is
preferred over traditional error-handling techniques like
return codes.
b) Write a program to handle a divide-by-zero exception using
try, catch, and throw.
7. File Handling
a) What is random access in file handling? Explain how it is
done in C++.
b) Write a program to read and write data to a file using
ifstream and ofstream.
c) Write a program to count the number of words in a file.
(Note: Words should be separated by single spaces.)
8. Virtual Base Class
a) What is a Virtual Base Class? What issues arise if it is
not used in programs with multiple inheritance?
9. Advanced Inheritance
a) Write a program to define a class Teacher with a virtual
function salary. Derive the class Associate_Professor and
override the salary function.
10. Additional Topics
a) Differentiate between Procedural and Object-Oriented
Programming.
b) Explain the concept of polymorphism and demonstrate it with
an example program.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy