Explain the difference between boxing and unboxing. Provide an example.
Boxing is the process of converting a value type to the type object, and unboxing is extracting the value type from the object. While the boxing is implicit, unboxing is explicit.
Example (written in C#):
int i = 13;
object myObject = i; // boxing
i = (int)myObject; // unboxing
What languages does the .NET Framework support?
.NET Framework supports over 60 programming languages, out of these 11 programming languages are designed and developed by Microsoft.
What is Multithreading?
Multi-threading is a process that contains multiple threads each of which performs different activities within a single process. .NET supports multithreading in two ways:
i. Starting threads with ThreadStart delegates.
ii. Using the ThreadPool class with asynchronous methods.
What are tuples in .Net?
A tuple is a fixed-size collection that can have elements of either same or different data types. The user must have to specify the size of a tuple at the time of declaration just like arrays.
Is ASP.NET different from ASP? If yes, explain how?
Yes, ASP.NET is different from ASP. These are the main differences:
- ASP.NET is developed by Microsoft to create dynamic web applications while ASP (Active Server Pages) is a Microsoft’s server side technology use to create web pages.
- ASP.NET is compiled while ASP is interpreted.
- ASP uses the technology named ADO while ASP.NET uses ADO.NET.
- ASP.NET is completely object oriented while ASP is partially object oriented.
What are Tuples?
Tuples are data structures that hold object properties and contain a sequence of elements of different data types. They were introduced as a Tuple class in .NET Framework 4.0 to avoid the need of creating separate types to hold object properties.
What is a Garbage Collector?
Garbage collection is a .Net feature to free the unused code objects in the memory.
The memory heap is divided into three generations. Generation 0, Generation 1 and Generation 2.
Generation 0 – This is used to store short-lived objects. Garbage Collection happens frequently in this Generation.
Generation 1 – This is for medium-lived objects. Usually, the objects that get moved from generation 0 are stored in this.
Generation 2 – This is for long-lived objects.
Collecting a Generation refers to collecting the objects in that generation and all its younger generations. Garbage collection of Generation 2 means full garbage collection, it collects all the objects in Generation 2 as well as Generation 1 and Generation 0.
During the Garbage collection process, as the first phase, the list of live objects is identified. In the second phase, references are updated for those objects which will be compacted. And in the last phase, the space occupied by dead objects are reclaimed. The remaining objects are moved to an older segment.
What are the event handlers that we have for the Global.asax file?
- Application Events:
- Application_Start, Application_End, Application_AcquireRequestState, Application_AuthenticateRequest,
- Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest,
- Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,
- Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState,
- Application_ResolveRequestCache, Application_UpdateRequestCache
- Session Events:
- Session_Start, Session_End
Explain the difference between value type and reference type.
Types in .NET Framework are either Value Type or Reference Type. A Value Type is stored in the stack and it holds the data within its own memory allocation. While a Reference Type is stored in the heap and it contains a pointer to another memory location that holds the real data.
What are functional and nonfunctional requirements?
Functional requirements are the basic and mandatory facilities that must be incorporated into a system. Non-functional requirements are quality-related attributes that the system must deliver.