C# Classes and Objects Programming Interview Questions - 1
Question: 1
Define constructor?
A constructor is a special method declared in a class to initialize the fields at the time of the creation of an instance/object of a class.
It is a special method because the name of the method is same as that of class name.
Question: 2
Define destructor?
A destructor is a mechanism to release the resources when an object is reclaimed by the garbage collector.
The name of the destructor is the same as the class name and is preceded by a tilde (~).
Question: 3
What is called default constructor?
A public parameter less constructor called default constructor. It returns a default values for the value type.
Question: 4
Define static members and methods?
The members declared with the keyword static is called as static members. It is also called as class variables. These variables are used when we want to have a variable common to all instances of a class.
The methods declared with the keyword static is called as static methods. It is also called as Class methods. It can be called without using the object. They are also available for use by other classes.
Question: 5
What is called Field and Methods?
Fields : Variables declared in the class. to hold data.
Methods : Function members defined in the class. Used to implement the computations and actions to be performed.
Maths Quantitative Aptitude Questions and Answers for Bank Exams Pdf More
1000+ GRE Non Verbal Reasoning Questions and Answers Pdf More
1000+ Non Verbal Reasoning Grouping of Images Questions Pdf More
Non Verbal Reasoning Grouping of Identical Figures Questions More
1000+ Transformation of Sentences Worksheet with Answers Pdf More
1000+ Environmental Engineering Multiple Choice Questions & Answers Pdf More
Biodiversity Multiple Choice Questions & Answers for TNPSC, NEET More
1000+ Gate 2023 - 2024 Syllabus Mechanical Engineering Pdf More
1000+ Physics GK Questions and Answers 2022-2023 More
Top 100+ Modern Indian History GK Quiz Questions and Answers More