C# Interview Questions and Answers Part 14

1. What are value types and reference types?
Ans. Value types are stored in the Stack.
Examples : bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort.
Reference types are stored in the Heap.
Examples : class, delegate, interface, object, string.

2. What is the difference between string keyword and System.String class?
Ans. String keyword is an alias for Syste.String class. 
Therefore, System.String and string keyword are the same, and you can use whichever naming convention you prefer. The String class provides many methods for safely creating, manipulating, and comparing strings.

3. What are the two data types available in C#?
Ans.Value type
Reference type

4. What are the different types of Caching?
Ans.There are three types of Caching :
Output Caching: stores the responses from an asp.net page.
Fragment Caching: Only caches/stores the portion of page (User Control)
Data Caching: is Programmatic way to Cache objects for performance

5. What is difference between Class And Interface?
Ans. Class : is logical representation of object. It is collection of data and related sub procedures with defination.
Interface : is also a class containg methods which is not having any definations.Class does not support multiple inheritance. But interface can support.

6. What is Delegates?
Ans.Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it.

7. What is Authentication and Authorization?
Ans. Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password).
Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

8. What is a base class? 
Ans. A class declaration may specify a base class by following the class name with a colon and the name of the base class. omitting a base class specification is the same as deriving from type object.

9. Can “this” be used within a static method?
Ans. No ‘This’ cannot be used in a static method. As only static variables/methods can be used in a static method.

10. What is the use of using statement in C#?
Ans. The using statement is used to obtain a resource, execute a statement, and then dispose of that resource.



Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker