ASSIGNMENT-2 (1)
ASSIGNMENT-2 (1)
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