1.List out the differences between Array and ArrayList in C#?
ANS :
ANS :
- Array stores the values or elements of same data type but ArrayList stores values of different datatypes.
- Arrays will use the fixed length but ArrayList does not use fixed length like the array.
2.What is the difference between “dispose of” and “finalize” variables in C#?
ANS :
- Dispose - This method uses interface – “IDisposable” interface and it will free up both managed and unmanaged codes like – database connection, files etc.
- Finalize - This method is called internally unlike Dispose method which is called explicitly. It is called by the garbage collector and can’t be called from the code.
3.What is the difference between “continue” and “break” statements in C#?
ANS :
- “continue” statement is used to pass the control to next iteration. This statement can be used with – “while”, “for”, “for each” loops.
- “break” statement is used to exit the loop.
4.What are the Access Modifiers in C#?
ANS :
- Different Access Modifier is - Public, Private, Protected, Internal, Protected Internal
- Public – When a method or attribute is defined as Public, it can be accessed from any code in the project. For example, in the above Class “Employee” getName() and setName() are public.
- Private - When a method or attribute is defined as Private, It can be accessed by any code within the containing class only. For example, in the above Class “Employee” attributes name and salary can be accessed within the Class Employee Only. If an attribute or class is defined without access modifiers, it's default access modifier will be private.
- Protected - When attribute and methods are defined as protected, it can be accessed by any method in the inherited classes and any method within the same class. The protected access modifier cannot be applied to classes and interfaces. Methods and fields in an interface can't be declared protected.
- Internal – If an attribute or method is defined as Internal, access is restricted to classes within the current project assembly.
- Protected Internal – If an attribute or method is defined as Protected Internal, access is restricted to classes within the current project assembly and types derived from the containing class.
5.What is Polymorphism in C#?
ANS : The ability of a programming language to process objects in different ways depending on their data type or class is known as Polymorphism. There are two types of polymorphism
Compile time polymorphism. Best example is Overloading
Runtime polymorphism. Best example is Overriding
6.What is a Destructor in C#?
ANS : The destructor is a special method that gets invoked/called automatically whenever an object of a given class gets destroyed. The main idea behind using destructor is to free the memory used by the object.
7.In which event are the controls fully loaded?
ANS : Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event
8.What is the difference between a default skin and a named skin?
ANS : The default skin is applied to all the Web server controls in a Web form, which are of similar type, and it does not provide a Skin ID attribute. The named skin provides a Skin ID attribute and users have to set the Skin ID property to apply it.
9.How can you enable impersonation in the web.config file?
ANS : To enable impersonation in the web.confing file, you need to include the <identity> element in the web.config file and set the impersonate attribute to true as shown in the following code snippet:
<identity impersonate = "true" />
10.What is the difference between a class and an object, and how do these terms relate to each other?
ANS : A class is a comprehensive data type that is the primary building block, or template, of OOP. The class defines attributes and methods of objects and contains an object’s behavior and data. An object, on the other hand, represents an instance of the class. As a basic unit of a system, objects have identity and behavior as well as attributes.
During the.NET interview, make sure candidates respond to the second part of this question, about how these terms are related to each other. Answer: The relationship is based on the fact that a class defines the states and properties that are common to a range of objects.
Further Dot Net Training Details to Reach us to click : - Dot Net Training in Chennai , .Net Training in Chennai , Dot Training Institute in Chennai , Best Dot Net Training in Chennai Dot Net Training in Chennai with Placement , .Net Training Course in Chennai , Dot Net Training Classes in Chennai

No comments:
Post a Comment