1. What is OOPS ? |
The OOPS is refer as Object-Oriented Programming in which programs are considered as a group of objects and each object consider instance of a class. |
2. What are basic concepts of OOPS ? |
Following are the concepts of OOPS and are as follows: AbstractionEncapsulationInheritancePolymorphism |
3. What is an object ? |
An object is an instance of a class and it has its own state, performance, and identity. |
4. What is a class ? |
A class is simply a illustration of a type of object and It is the blueprint which defines the details of an object. |
5. What is an Abstract Class ? |
The Abstract class is a class which cannot be instantiated, it exists widely for inheritance and it necessity be inherited. Abstract classes cannot be used to instantiate objects; because abstract classes are unfinished, it may hold only explanation of the attributes or functions and resulting classes that inherit this gears it’s attributes or functions. |
6. What is Encapsulation ? |
The Encapsulation is a mechanism to bind the data member and method in the single unite called as Class. In the OOP, Encapsulation can be achived by the class. A class is a single unite which is collection of data members, methods, propertes and attributes. |
7. What is Polymorphism ? |
The polymorphism is concept of Object Oriented Programming which is often articulated as single interface with multiple function. The Polymorphism can perform with both Static and Dynamic. In the static polymorphism, response to the function control at the compile time and In the dynamic polymorphism, the response to the function control at the run-time. |
8. What is Inheritance ? |
The Inheritance is one of the important concept of Object Oriented Programming. In the process of Inheritance, the user can define the base class with public members and methods/functions which can access in the derived/subclass. Inheritance increases the reusability of codes which make an impact on the performance of execution of the programme. |
9. What are manipulators ? |
Manipulators are the methods which can be used in aggregation with the insertion (<<) and extraction (>>) operators on an object. |
10. Define a constructor ? |
A constructor is a function used to prepare the state of an object, and it grows begged at the time of object construction. The following are important while working with Constructor: A constructor Name should be same as class name.Do not define a constructor with return type. |
11. Define Destructor ? |
A destructor is just worked opposite of Constructor and it is a method which is automatically called when the object is made of scope or destroyed. Destructor name is also same as class name but with the tilde(~) symbol before the name. |
12. What is a virtual function ? |
A Virtual method is a member function of a class, and its activities can be overridden in its derived class. This function can be applied by using a virtual keyword which can be supplied while function declaration. |
13. What is a friend function ? |
A friend function is a friend of a class that permitted to admittance to Public, private or protected data in the same class. The friend function can be defined anywhere in the class that can not be affected by access control such as Public, Private or Protected in the same class. |
14. What is function overloading ? |
The function overloading happen when we use two methods with same name but performs different action at the comple time. The overloaded methods is used to overcome the complexity and enhance the performance. Overloads can differ based on parameters. Example void add(int& a, int& b); void add(double& a, double& b); void add(struct bob& a, struct bob& b); |
15. What is operator overloading ? |
In operator overloading, we can overload an operator to perform a specific task that can overload + operator to subtract an element from other. The operator,-,* can be used to pass through the function, and it has their own precedence to execute. |
16. What is a ternary operator ? |
The ternary operator is to be an operator which takings three arguments. Arguments and results are of changed data types, and it depends on the method. The ternary operator is also known as a conditional operator. |
17. What is exception handling ? |
The exception is a problem that occurs during the execution of a program. The exceptions provide a method of transfers the one part of a program to other. The C# provide the exception blocks like Try, Catch, finally and Throw to handle the exceptions in programming. |
18. What are access modifiers ? |
The Following are access modifiers: PublicPrivateProtectedFriendProtected Friend |
19. What do we mean by partial class in OOP ? |
The partial class is a Class and is well-defined in 2 or more classes that are divided the file into several files. And developers can use these files to work discretely and later it is assembled to make a single. |
20. What are the advantages of partial classes ? |
The following are the advantages of Partial classes: The Partial classes can be divided then again can be reunited of assembling.Multiple developers can work at a time.User can separate User Interface part code and business logic code which is easy to understand by users. |
21. Can Sealed Classes inherit ? |
No, Sealed Classes can not inherit. |
22. Can Multiple Catch Blocks executed in c# ? |
Yes, the multiple catch block can be executed in C# but whenever the error occur in the try block same time control will pass to the exception block will catch the exception so it means we can use multiple catches blocks but only one can executed at once. |
23. What is boxing and unboxing ? |
Boxing is the process of converting a value type data type to the object/reference. Unboxing is the process of converting a object/reference type data type to the value type. |
24. What is sealed class in c# ? |
The Sealed classes are used to restrict the class from being inherit which means once a class is defined as a sealed class, the class cannot be inherited. |