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

ASSIGNMENT-2 (1)

The document outlines an assignment consisting of various questions related to C++ programming concepts, including class members, constructors, destructors, and data hiding. It includes both short answer questions and programming tasks, such as creating a student class and using friend functions. The assignment is structured into sections with varying mark allocations, indicating the depth of understanding required for each topic.

Uploaded by

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

ASSIGNMENT-2 (1)

The document outlines an assignment consisting of various questions related to C++ programming concepts, including class members, constructors, destructors, and data hiding. It includes both short answer questions and programming tasks, such as creating a student class and using friend functions. The assignment is structured into sections with varying mark allocations, indicating the depth of understanding required for each topic.

Uploaded by

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

ASSIGNMENT-2

2 MARKS QUESTION

1. State the difference between protected member and private member of a class.
2. What is the difference between constructor and destructor? Explain with example.
3. Define inline function.
4. What is constructor? What is a default constructor?
5. Why C++ class can be considered as Abstract Data type.
6. “A class can have many method with the same name”- Justify answer.
7. Explain the use of constructor in C++ program design.
8. Which operator are used to access members?
9. Is it possible to access private data member without using member function? If yes explain
the procedure with an example
10. What is copy constructor?

6 MARK QUESTION

1. Create a class called student which contain protected attributes such as stud_name,
stud_roll and stud_branch.Provide an appropriate method to take user input to initialise
these attributes and display details regarding 50 students of a class.
2. Differentiate between private, public and protected data member of the class with
example.
3. When do we declare a member of a class static? What is a class? How does it accomplish
data hiding?
4. What is constructor? Explain the types of constructor.
5. Write a program to calculate number of vowels presented in entered string.
6. What do you mean by static Data member? Give one Example of static data member?
7. WAP to enter positive and negative numbers. Enter at least 10 numbers. Count the
positive and negative number. Use class and object.
8. What do you mean by constructor? What are the characteristics of constructor?
9. Write short notes on- Destructor
10. Write short notes on- This pointer
11. Write a program to declare a class with private data members. Accept data through
constructor and display the data with destructor.

16 MARK QUESTION

1. A. What do you mean by Friend function?


B. WAP to declare three classes. Declare integer array as data member in each class. Perform
addition of two data member arrays into array of third class. Use friend function.
2. Write short notes on parameterized Constructor and Copy Constructor.

You might also like